From gclayton at apple.com Mon Aug 1 00:05:43 2011
From: gclayton at apple.com (Greg Clayton)
Date: Mon, 01 Aug 2011 05:05:43 -0000
Subject: [Lldb-commits] [lldb] r136606 - in /lldb/trunk:
lldb.xcodeproj/project.pbxproj resources/LLDB-Info.plist
tools/debugserver/debugserver.xcodeproj/project.pbxproj
Message-ID: <20110801050543.AC66B2A6C12C@llvm.org>
Author: gclayton
Date: Mon Aug 1 00:05:43 2011
New Revision: 136606
URL: http://llvm.org/viewvc/llvm-project?rev=136606&view=rev
Log:
Update Xcode project versions to lldb-70 and debugserver-142.
Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/resources/LLDB-Info.plist
lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj
Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=136606&r1=136605&r2=136606&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Mon Aug 1 00:05:43 2011
@@ -3542,10 +3542,10 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 68;
+ CURRENT_PROJECT_VERSION = 70;
DEBUG_INFORMATION_FORMAT = dwarf;
DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 68;
+ DYLIB_CURRENT_VERSION = 70;
EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -3594,11 +3594,11 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 68;
+ CURRENT_PROJECT_VERSION = 70;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 68;
+ DYLIB_CURRENT_VERSION = 70;
EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -3645,8 +3645,8 @@
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 68;
- DYLIB_CURRENT_VERSION = 68;
+ CURRENT_PROJECT_VERSION = 70;
+ DYLIB_CURRENT_VERSION = 70;
EXECUTABLE_EXTENSION = a;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -3684,9 +3684,9 @@
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 68;
+ CURRENT_PROJECT_VERSION = 70;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
- DYLIB_CURRENT_VERSION = 68;
+ DYLIB_CURRENT_VERSION = 70;
EXECUTABLE_EXTENSION = a;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -3724,9 +3724,9 @@
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 68;
+ CURRENT_PROJECT_VERSION = 70;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
- DYLIB_CURRENT_VERSION = 68;
+ DYLIB_CURRENT_VERSION = 70;
EXECUTABLE_EXTENSION = a;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -3794,7 +3794,7 @@
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 68;
+ CURRENT_PROJECT_VERSION = 70;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -3825,11 +3825,11 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 68;
+ CURRENT_PROJECT_VERSION = 70;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 68;
+ DYLIB_CURRENT_VERSION = 70;
EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -3954,7 +3954,7 @@
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 68;
+ CURRENT_PROJECT_VERSION = 70;
DEBUG_INFORMATION_FORMAT = dwarf;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -3986,7 +3986,7 @@
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 68;
+ CURRENT_PROJECT_VERSION = 70;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
Modified: lldb/trunk/resources/LLDB-Info.plist
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/resources/LLDB-Info.plist?rev=136606&r1=136605&r2=136606&view=diff
==============================================================================
--- lldb/trunk/resources/LLDB-Info.plist (original)
+++ lldb/trunk/resources/LLDB-Info.plist Mon Aug 1 00:05:43 2011
@@ -17,7 +17,7 @@
CFBundleSignature
????
CFBundleVersion
- 68
+ 70
CFBundleName
${EXECUTABLE_NAME}
Modified: lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj?rev=136606&r1=136605&r2=136606&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj Mon Aug 1 00:05:43 2011
@@ -473,7 +473,7 @@
i386,
);
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 141;
+ CURRENT_PROJECT_VERSION = 142;
"GCC_VERSION[sdk=iphoneos*][arch=*]" = 4.2;
"GCC_VERSION[sdk=macosx*][arch=*]" = "";
GCC_WARN_ABOUT_RETURN_TYPE = YES;
@@ -494,7 +494,7 @@
x86_64,
i386,
);
- CURRENT_PROJECT_VERSION = 141;
+ CURRENT_PROJECT_VERSION = 142;
DEAD_CODE_STRIPPING = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
@@ -515,7 +515,7 @@
x86_64,
i386,
);
- CURRENT_PROJECT_VERSION = 141;
+ CURRENT_PROJECT_VERSION = 142;
DEAD_CODE_STRIPPING = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
@@ -533,7 +533,7 @@
buildSettings = {
"CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist";
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 141;
+ CURRENT_PROJECT_VERSION = 142;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks;
"FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = (
@@ -573,7 +573,7 @@
"CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = lldb_codesign;
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 141;
+ CURRENT_PROJECT_VERSION = 142;
FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks;
"FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = (
"$(SDKROOT)/System/Library/PrivateFrameworks",
@@ -613,7 +613,7 @@
"CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = lldb_codesign;
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 141;
+ CURRENT_PROJECT_VERSION = 142;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks;
"FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = (
From gclayton at apple.com Mon Aug 1 00:06:47 2011
From: gclayton at apple.com (Greg Clayton)
Date: Mon, 01 Aug 2011 05:06:47 -0000
Subject: [Lldb-commits] [lldb] r136607 - /lldb/tags/lldb-70/
Message-ID: <20110801050647.ED3622A6C12C@llvm.org>
Author: gclayton
Date: Mon Aug 1 00:06:47 2011
New Revision: 136607
URL: http://llvm.org/viewvc/llvm-project?rev=136607&view=rev
Log:
lldb-70
Added:
lldb/tags/lldb-70/
- copied from r136606, lldb/trunk/
From scallanan at apple.com Mon Aug 1 11:38:40 2011
From: scallanan at apple.com (Sean Callanan)
Date: Mon, 01 Aug 2011 16:38:40 -0000
Subject: [Lldb-commits] [lldb] r136622 - in /lldb/trunk: llvm.zip
scripts/build-llvm.pl
Message-ID: <20110801163840.096392A6C12C@llvm.org>
Author: spyffe
Date: Mon Aug 1 11:38:39 2011
New Revision: 136622
URL: http://llvm.org/viewvc/llvm-project?rev=136622&view=rev
Log:
Updated LLVM to pick up a few new ARM targets.
Modified:
lldb/trunk/llvm.zip
lldb/trunk/scripts/build-llvm.pl
Modified: lldb/trunk/llvm.zip
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/llvm.zip?rev=136622&r1=136621&r2=136622&view=diff
==============================================================================
Binary files - no diff available.
Modified: lldb/trunk/scripts/build-llvm.pl
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/build-llvm.pl?rev=136622&r1=136621&r2=136622&view=diff
==============================================================================
--- lldb/trunk/scripts/build-llvm.pl (original)
+++ lldb/trunk/scripts/build-llvm.pl Mon Aug 1 11:38:39 2011
@@ -26,7 +26,7 @@
our $llvm_configuration = $ENV{LLVM_CONFIGURATION};
-our $llvm_revision = "136537";
+our $llvm_revision = "136552";
our $llvm_source_dir = "$ENV{SRCROOT}";
our @archs = split (/\s+/, $ENV{ARCHS});
From gclayton at apple.com Mon Aug 1 12:06:31 2011
From: gclayton at apple.com (Greg Clayton)
Date: Mon, 01 Aug 2011 17:06:31 -0000
Subject: [Lldb-commits] [lldb] r136625 - in
/lldb/trunk/source/Plugins/Process/Utility: RegisterContextMach_arm.cpp
RegisterContextMach_arm.h RegisterContextMach_i386.cpp
RegisterContextMach_i386.h RegisterContextMach_x86_64.cpp
RegisterContextMach_x86_64.h
Message-ID: <20110801170631.21B012A6C12C@llvm.org>
Author: gclayton
Date: Mon Aug 1 12:06:30 2011
New Revision: 136625
URL: http://llvm.org/viewvc/llvm-project?rev=136625&view=rev
Log:
Copy the native darwin register stuff out of the ProcessMacOSX
plug-in folder.
Added:
lldb/trunk/source/Plugins/Process/Utility/RegisterContextMach_arm.cpp
- copied, changed from r136624, lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_arm.cpp
lldb/trunk/source/Plugins/Process/Utility/RegisterContextMach_arm.h
- copied, changed from r136624, lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_arm.h
lldb/trunk/source/Plugins/Process/Utility/RegisterContextMach_i386.cpp
- copied unchanged from r136624, lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_i386.cpp
lldb/trunk/source/Plugins/Process/Utility/RegisterContextMach_i386.h
- copied, changed from r136624, lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_i386.h
lldb/trunk/source/Plugins/Process/Utility/RegisterContextMach_x86_64.cpp
- copied, changed from r136624, lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.cpp
lldb/trunk/source/Plugins/Process/Utility/RegisterContextMach_x86_64.h
- copied, changed from r136624, lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.h
Copied: lldb/trunk/source/Plugins/Process/Utility/RegisterContextMach_arm.cpp (from r136624, lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_arm.cpp)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextMach_arm.cpp?p2=lldb/trunk/source/Plugins/Process/Utility/RegisterContextMach_arm.cpp&p1=lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_arm.cpp&r1=136624&r2=136625&rev=136625&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_arm.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextMach_arm.cpp Mon Aug 1 12:06:30 2011
@@ -16,7 +16,6 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-//#include "ProcessMacOSXLog.h"
using namespace lldb;
using namespace lldb_private;
Copied: lldb/trunk/source/Plugins/Process/Utility/RegisterContextMach_arm.h (from r136624, lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_arm.h)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextMach_arm.h?p2=lldb/trunk/source/Plugins/Process/Utility/RegisterContextMach_arm.h&p1=lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_arm.h&r1=136624&r2=136625&rev=136625&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_arm.h (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextMach_arm.h Mon Aug 1 12:06:30 2011
@@ -15,7 +15,7 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "Plugins/Process/Utility/RegisterContextDarwin_arm.h"
+#include "RegisterContextDarwin_arm.h"
class RegisterContextMach_arm : public RegisterContextDarwin_arm
{
Copied: lldb/trunk/source/Plugins/Process/Utility/RegisterContextMach_i386.h (from r136624, lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_i386.h)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextMach_i386.h?p2=lldb/trunk/source/Plugins/Process/Utility/RegisterContextMach_i386.h&p1=lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_i386.h&r1=136624&r2=136625&rev=136625&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_i386.h (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextMach_i386.h Mon Aug 1 12:06:30 2011
@@ -14,7 +14,7 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "Plugins/Process/Utility/RegisterContextDarwin_i386.h"
+#include "RegisterContextDarwin_i386.h"
class RegisterContextMach_i386 : public RegisterContextDarwin_i386
{
Copied: lldb/trunk/source/Plugins/Process/Utility/RegisterContextMach_x86_64.cpp (from r136624, lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.cpp)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextMach_x86_64.cpp?p2=lldb/trunk/source/Plugins/Process/Utility/RegisterContextMach_x86_64.cpp&p1=lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.cpp&r1=136624&r2=136625&rev=136625&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextMach_x86_64.cpp Mon Aug 1 12:06:30 2011
@@ -21,7 +21,7 @@
RegisterContextMach_x86_64::RegisterContextMach_x86_64(Thread &thread, uint32_t concrete_frame_idx) :
-RegisterContextDarwin_x86_64 (thread, concrete_frame_idx)
+ RegisterContextDarwin_x86_64 (thread, concrete_frame_idx)
{
}
Copied: lldb/trunk/source/Plugins/Process/Utility/RegisterContextMach_x86_64.h (from r136624, lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.h)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextMach_x86_64.h?p2=lldb/trunk/source/Plugins/Process/Utility/RegisterContextMach_x86_64.h&p1=lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.h&r1=136624&r2=136625&rev=136625&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.h (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextMach_x86_64.h Mon Aug 1 12:06:30 2011
@@ -14,7 +14,7 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "Plugins/Process/Utility/RegisterContextDarwin_x86_64.h"
+#include "RegisterContextDarwin_x86_64.h"
class RegisterContextMach_x86_64 : public RegisterContextDarwin_x86_64
{
From gclayton at apple.com Mon Aug 1 12:08:02 2011
From: gclayton at apple.com (Greg Clayton)
Date: Mon, 01 Aug 2011 17:08:02 -0000
Subject: [Lldb-commits] [lldb] r136626 - in /lldb/trunk:
lldb.xcodeproj/project.pbxproj source/Plugins/Process/MacOSX-User/
source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp
source/lldb.cpp
Message-ID: <20110801170802.84FDC2A6C12C@llvm.org>
Author: gclayton
Date: Mon Aug 1 12:08:02 2011
New Revision: 136626
URL: http://llvm.org/viewvc/llvm-project?rev=136626&view=rev
Log:
Remove the deprecated MacOSX native plug-in.
Removed:
lldb/trunk/source/Plugins/Process/MacOSX-User/
Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp
lldb/trunk/source/lldb.cpp
Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=136626&r1=136625&r2=136626&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Mon Aug 1 12:08:02 2011
@@ -74,7 +74,6 @@
2671A0D013482601003A87BB /* ConnectionMachPort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2671A0CF13482601003A87BB /* ConnectionMachPort.cpp */; };
26744EF11338317700EF765A /* GDBRemoteCommunicationClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26744EED1338317700EF765A /* GDBRemoteCommunicationClient.cpp */; };
26744EF31338317700EF765A /* GDBRemoteCommunicationServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26744EEF1338317700EF765A /* GDBRemoteCommunicationServer.cpp */; };
- 2676045A13D49D2300AB1B6A /* ProcessControl-mig.defs in Sources */ = {isa = PBXBuildFile; fileRef = 260C89A110F57C5600BB2B04 /* ProcessControl-mig.defs */; settings = {ATTRIBUTES = (Client, Server, ); }; };
267C012B136880DF006E963E /* OptionGroupValueObjectDisplay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 267C012A136880DF006E963E /* OptionGroupValueObjectDisplay.cpp */; };
267C01371368C49C006E963E /* OptionGroupOutputFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BCFC531368B3E4006DC050 /* OptionGroupOutputFile.cpp */; };
2686536C1370ACB200D186A3 /* OptionGroupBoolean.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2686536B1370ACB200D186A3 /* OptionGroupBoolean.cpp */; };
@@ -220,19 +219,6 @@
2689009F13353E4200698AC0 /* ProcessGDBRemote.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2618EE5F1315B29C001D6D71 /* ProcessGDBRemote.cpp */; };
268900A013353E4200698AC0 /* ProcessGDBRemoteLog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2618EE611315B29C001D6D71 /* ProcessGDBRemoteLog.cpp */; };
268900A113353E4200698AC0 /* ThreadGDBRemote.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2618EE631315B29C001D6D71 /* ThreadGDBRemote.cpp */; };
- 268900A213353E5000698AC0 /* MachException.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C899210F57C5600BB2B04 /* MachException.cpp */; };
- 268900A313353E5000698AC0 /* MachTask.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C899410F57C5600BB2B04 /* MachTask.cpp */; };
- 268900A413353E5000698AC0 /* MachThreadContext_arm.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C899710F57C5600BB2B04 /* MachThreadContext_arm.cpp */; };
- 268900A513353E5000698AC0 /* MachThreadContext_i386.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C899910F57C5600BB2B04 /* MachThreadContext_i386.cpp */; };
- 268900A613353E5000698AC0 /* MachThreadContext_x86_64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C899B10F57C5600BB2B04 /* MachThreadContext_x86_64.cpp */; };
- 268900A713353E5000698AC0 /* MachVMMemory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C899D10F57C5600BB2B04 /* MachVMMemory.cpp */; };
- 268900A813353E5000698AC0 /* MachVMRegion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C899F10F57C5600BB2B04 /* MachVMRegion.cpp */; };
- 268900A913353E5000698AC0 /* ProcessMacOSX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C89A310F57C5600BB2B04 /* ProcessMacOSX.cpp */; };
- 268900AA13353E5000698AC0 /* ProcessMacOSXLog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C89A510F57C5600BB2B04 /* ProcessMacOSXLog.cpp */; };
- 268900AB13353E5000698AC0 /* RegisterContextMach_arm.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C89A910F57C5600BB2B04 /* RegisterContextMach_arm.cpp */; };
- 268900AC13353E5000698AC0 /* RegisterContextMach_i386.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C89AB10F57C5600BB2B04 /* RegisterContextMach_i386.cpp */; };
- 268900AD13353E5000698AC0 /* RegisterContextMach_x86_64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C89AD10F57C5600BB2B04 /* RegisterContextMach_x86_64.cpp */; };
- 268900AE13353E5000698AC0 /* ThreadMacOSX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C89AF10F57C5600BB2B04 /* ThreadMacOSX.cpp */; };
268900AF13353E5000698AC0 /* UnwindLLDB.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF68D32F1255A110002FF25B /* UnwindLLDB.cpp */; };
268900B013353E5000698AC0 /* RegisterContextLLDB.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF68D2541255416E002FF25B /* RegisterContextLLDB.cpp */; };
268900B413353E5000698AC0 /* RegisterContextMacOSXFrameBackchain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26E3EEF711A994E800FBADB6 /* RegisterContextMacOSXFrameBackchain.cpp */; };
@@ -539,37 +525,6 @@
260C898610F57C5600BB2B04 /* ObjectFileELF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObjectFileELF.h; sourceTree = ""; };
260C898810F57C5600BB2B04 /* ObjectFileMachO.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ObjectFileMachO.cpp; sourceTree = ""; };
260C898910F57C5600BB2B04 /* ObjectFileMachO.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObjectFileMachO.h; sourceTree = ""; };
- 260C898D10F57C5600BB2B04 /* cc-swig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = "cc-swig"; sourceTree = ""; };
- 260C898E10F57C5600BB2B04 /* config.pl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = config.pl; sourceTree = ""; };
- 260C898F10F57C5600BB2B04 /* test-ProcessDebug.pl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = "test-ProcessDebug.pl"; sourceTree = ""; };
- 260C899210F57C5600BB2B04 /* MachException.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MachException.cpp; sourceTree = ""; };
- 260C899310F57C5600BB2B04 /* MachException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MachException.h; sourceTree = ""; };
- 260C899410F57C5600BB2B04 /* MachTask.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MachTask.cpp; sourceTree = ""; };
- 260C899510F57C5600BB2B04 /* MachTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MachTask.h; sourceTree = ""; };
- 260C899610F57C5600BB2B04 /* MachThreadContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MachThreadContext.h; sourceTree = ""; };
- 260C899710F57C5600BB2B04 /* MachThreadContext_arm.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MachThreadContext_arm.cpp; sourceTree = ""; };
- 260C899810F57C5600BB2B04 /* MachThreadContext_arm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MachThreadContext_arm.h; sourceTree = ""; };
- 260C899910F57C5600BB2B04 /* MachThreadContext_i386.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MachThreadContext_i386.cpp; sourceTree = ""; };
- 260C899A10F57C5600BB2B04 /* MachThreadContext_i386.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MachThreadContext_i386.h; sourceTree = ""; };
- 260C899B10F57C5600BB2B04 /* MachThreadContext_x86_64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MachThreadContext_x86_64.cpp; sourceTree = ""; };
- 260C899C10F57C5600BB2B04 /* MachThreadContext_x86_64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MachThreadContext_x86_64.h; sourceTree = ""; };
- 260C899D10F57C5600BB2B04 /* MachVMMemory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MachVMMemory.cpp; sourceTree = ""; };
- 260C899E10F57C5600BB2B04 /* MachVMMemory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MachVMMemory.h; sourceTree = ""; };
- 260C899F10F57C5600BB2B04 /* MachVMRegion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MachVMRegion.cpp; sourceTree = ""; };
- 260C89A010F57C5600BB2B04 /* MachVMRegion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MachVMRegion.h; sourceTree = ""; };
- 260C89A110F57C5600BB2B04 /* ProcessControl-mig.defs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.mig; path = "ProcessControl-mig.defs"; sourceTree = ""; };
- 260C89A310F57C5600BB2B04 /* ProcessMacOSX.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProcessMacOSX.cpp; sourceTree = ""; };
- 260C89A410F57C5600BB2B04 /* ProcessMacOSX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProcessMacOSX.h; sourceTree = ""; };
- 260C89A510F57C5600BB2B04 /* ProcessMacOSXLog.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProcessMacOSXLog.cpp; sourceTree = ""; };
- 260C89A610F57C5600BB2B04 /* ProcessMacOSXLog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProcessMacOSXLog.h; sourceTree = ""; };
- 260C89A910F57C5600BB2B04 /* RegisterContextMach_arm.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RegisterContextMach_arm.cpp; sourceTree = ""; };
- 260C89AA10F57C5600BB2B04 /* RegisterContextMach_arm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegisterContextMach_arm.h; sourceTree = ""; };
- 260C89AB10F57C5600BB2B04 /* RegisterContextMach_i386.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RegisterContextMach_i386.cpp; sourceTree = ""; };
- 260C89AC10F57C5600BB2B04 /* RegisterContextMach_i386.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegisterContextMach_i386.h; sourceTree = ""; };
- 260C89AD10F57C5600BB2B04 /* RegisterContextMach_x86_64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RegisterContextMach_x86_64.cpp; sourceTree = ""; };
- 260C89AE10F57C5600BB2B04 /* RegisterContextMach_x86_64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegisterContextMach_x86_64.h; sourceTree = ""; };
- 260C89AF10F57C5600BB2B04 /* ThreadMacOSX.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ThreadMacOSX.cpp; sourceTree = ""; };
- 260C89B010F57C5600BB2B04 /* ThreadMacOSX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadMacOSX.h; sourceTree = ""; };
260C89B310F57C5600BB2B04 /* DWARFAbbreviationDeclaration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DWARFAbbreviationDeclaration.cpp; sourceTree = ""; };
260C89B410F57C5600BB2B04 /* DWARFAbbreviationDeclaration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWARFAbbreviationDeclaration.h; sourceTree = ""; };
260C89B610F57C5600BB2B04 /* DWARFAttribute.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWARFAttribute.h; sourceTree = ""; };
@@ -1525,74 +1480,11 @@
children = (
4CEE62F71145F1C70064CF93 /* GDB Remote */,
2642FBA713D003B400ED6808 /* MacOSX-Kernel */,
- 260C898B10F57C5600BB2B04 /* MacOSX-User */,
26B4666E11A2080F00CF6220 /* Utility */,
);
path = Process;
sourceTree = "";
};
- 260C898B10F57C5600BB2B04 /* MacOSX-User */ = {
- isa = PBXGroup;
- children = (
- 260C898C10F57C5600BB2B04 /* scripts */,
- 260C899010F57C5600BB2B04 /* source */,
- );
- path = "MacOSX-User";
- sourceTree = "";
- };
- 260C898C10F57C5600BB2B04 /* scripts */ = {
- isa = PBXGroup;
- children = (
- 260C898D10F57C5600BB2B04 /* cc-swig */,
- 260C898E10F57C5600BB2B04 /* config.pl */,
- 260C898F10F57C5600BB2B04 /* test-ProcessDebug.pl */,
- );
- path = scripts;
- sourceTree = "";
- };
- 260C899010F57C5600BB2B04 /* source */ = {
- isa = PBXGroup;
- children = (
- 260C899110F57C5600BB2B04 /* MacOSX */,
- 260C89A310F57C5600BB2B04 /* ProcessMacOSX.cpp */,
- 260C89A410F57C5600BB2B04 /* ProcessMacOSX.h */,
- 260C89A510F57C5600BB2B04 /* ProcessMacOSXLog.cpp */,
- 260C89A610F57C5600BB2B04 /* ProcessMacOSXLog.h */,
- 260C89A910F57C5600BB2B04 /* RegisterContextMach_arm.cpp */,
- 260C89AA10F57C5600BB2B04 /* RegisterContextMach_arm.h */,
- 260C89AB10F57C5600BB2B04 /* RegisterContextMach_i386.cpp */,
- 260C89AC10F57C5600BB2B04 /* RegisterContextMach_i386.h */,
- 260C89AD10F57C5600BB2B04 /* RegisterContextMach_x86_64.cpp */,
- 260C89AE10F57C5600BB2B04 /* RegisterContextMach_x86_64.h */,
- 260C89AF10F57C5600BB2B04 /* ThreadMacOSX.cpp */,
- 260C89B010F57C5600BB2B04 /* ThreadMacOSX.h */,
- );
- path = source;
- sourceTree = "";
- };
- 260C899110F57C5600BB2B04 /* MacOSX */ = {
- isa = PBXGroup;
- children = (
- 260C899210F57C5600BB2B04 /* MachException.cpp */,
- 260C899310F57C5600BB2B04 /* MachException.h */,
- 260C899410F57C5600BB2B04 /* MachTask.cpp */,
- 260C899510F57C5600BB2B04 /* MachTask.h */,
- 260C899610F57C5600BB2B04 /* MachThreadContext.h */,
- 260C899710F57C5600BB2B04 /* MachThreadContext_arm.cpp */,
- 260C899810F57C5600BB2B04 /* MachThreadContext_arm.h */,
- 260C899910F57C5600BB2B04 /* MachThreadContext_i386.cpp */,
- 260C899A10F57C5600BB2B04 /* MachThreadContext_i386.h */,
- 260C899B10F57C5600BB2B04 /* MachThreadContext_x86_64.cpp */,
- 260C899C10F57C5600BB2B04 /* MachThreadContext_x86_64.h */,
- 260C899D10F57C5600BB2B04 /* MachVMMemory.cpp */,
- 260C899E10F57C5600BB2B04 /* MachVMMemory.h */,
- 260C899F10F57C5600BB2B04 /* MachVMRegion.cpp */,
- 260C89A010F57C5600BB2B04 /* MachVMRegion.h */,
- 260C89A110F57C5600BB2B04 /* ProcessControl-mig.defs */,
- );
- path = MacOSX;
- sourceTree = "";
- };
260C89B110F57C5600BB2B04 /* SymbolFile */ = {
isa = PBXGroup;
children = (
@@ -3197,19 +3089,6 @@
2689009F13353E4200698AC0 /* ProcessGDBRemote.cpp in Sources */,
268900A013353E4200698AC0 /* ProcessGDBRemoteLog.cpp in Sources */,
268900A113353E4200698AC0 /* ThreadGDBRemote.cpp in Sources */,
- 268900A213353E5000698AC0 /* MachException.cpp in Sources */,
- 268900A313353E5000698AC0 /* MachTask.cpp in Sources */,
- 268900A413353E5000698AC0 /* MachThreadContext_arm.cpp in Sources */,
- 268900A513353E5000698AC0 /* MachThreadContext_i386.cpp in Sources */,
- 268900A613353E5000698AC0 /* MachThreadContext_x86_64.cpp in Sources */,
- 268900A713353E5000698AC0 /* MachVMMemory.cpp in Sources */,
- 268900A813353E5000698AC0 /* MachVMRegion.cpp in Sources */,
- 268900A913353E5000698AC0 /* ProcessMacOSX.cpp in Sources */,
- 268900AA13353E5000698AC0 /* ProcessMacOSXLog.cpp in Sources */,
- 268900AB13353E5000698AC0 /* RegisterContextMach_arm.cpp in Sources */,
- 268900AC13353E5000698AC0 /* RegisterContextMach_i386.cpp in Sources */,
- 268900AD13353E5000698AC0 /* RegisterContextMach_x86_64.cpp in Sources */,
- 268900AE13353E5000698AC0 /* ThreadMacOSX.cpp in Sources */,
268900AF13353E5000698AC0 /* UnwindLLDB.cpp in Sources */,
268900B013353E5000698AC0 /* RegisterContextLLDB.cpp in Sources */,
268900B413353E5000698AC0 /* RegisterContextMacOSXFrameBackchain.cpp in Sources */,
@@ -3365,7 +3244,6 @@
265205AA13D3E3F700132FE2 /* RegisterContextKDP_i386.cpp in Sources */,
265205AC13D3E3F700132FE2 /* RegisterContextKDP_x86_64.cpp in Sources */,
2628A4D513D4977900F5487A /* ThreadKDP.cpp in Sources */,
- 2676045A13D49D2300AB1B6A /* ProcessControl-mig.defs in Sources */,
26D7E45D13D5E30A007FD12B /* SocketAddress.cpp in Sources */,
B271B11413D6139300C3FEDB /* FormatClasses.cpp in Sources */,
94B6E76213D88365005F417F /* ValueObjectSyntheticFilter.cpp in Sources */,
Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp?rev=136626&r1=136625&r2=136626&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp Mon Aug 1 12:08:02 2011
@@ -27,7 +27,6 @@
// Project includes
#include "ARM_GCC_Registers.h"
#include "ARM_DWARF_Registers.h"
-#include "ProcessMacOSXLog.h"
using namespace lldb;
using namespace lldb_private;
@@ -980,7 +979,7 @@
// Zero is reserved for the BRP count, so don't increment it if it is zero
if (g_num_supported_hw_breakpoints > 0)
g_num_supported_hw_breakpoints++;
- ProcessMacOSXLog::LogIf(PD_LOG_THREAD, "DBGDIDR=0x%8.8x (number BRP pairs = %u)", register_DBGDIDR, g_num_supported_hw_breakpoints);
+// if (log) log->Printf ("DBGDIDR=0x%8.8x (number BRP pairs = %u)", register_DBGDIDR, g_num_supported_hw_breakpoints);
}
return g_num_supported_hw_breakpoints;
@@ -1025,13 +1024,13 @@
byte_addr_select | // Set the correct byte address select so we only trigger on the correct opcode
S_USER | // Which modes should this breakpoint stop in?
BCR_ENABLE; // Enable this hardware breakpoint
- ProcessMacOSXLog::LogIf(PD_LOG_BREAKPOINTS, "RegisterContextDarwin_arm::EnableHardwareBreakpoint( addr = %8.8p, size = %u ) - BVR%u/BCR%u = 0x%8.8x / 0x%8.8x (Thumb)",
- addr,
- size,
- i,
- i,
- dbg.bvr[i],
- dbg.bcr[i]);
+// if (log) log->Printf ("RegisterContextDarwin_arm::EnableHardwareBreakpoint( addr = %8.8p, size = %u ) - BVR%u/BCR%u = 0x%8.8x / 0x%8.8x (Thumb)",
+// addr,
+// size,
+// i,
+// i,
+// dbg.bvr[i],
+// dbg.bcr[i]);
}
else if (size == 4)
{
@@ -1040,25 +1039,25 @@
BAS_IMVA_ALL | // Stop on any of the four bytes following the IMVA
S_USER | // Which modes should this breakpoint stop in?
BCR_ENABLE; // Enable this hardware breakpoint
- ProcessMacOSXLog::LogIf(PD_LOG_BREAKPOINTS, "RegisterContextDarwin_arm::EnableHardwareBreakpoint( addr = %8.8p, size = %u ) - BVR%u/BCR%u = 0x%8.8x / 0x%8.8x (ARM)",
- addr,
- size,
- i,
- i,
- dbg.bvr[i],
- dbg.bcr[i]);
+// if (log) log->Printf ("RegisterContextDarwin_arm::EnableHardwareBreakpoint( addr = %8.8p, size = %u ) - BVR%u/BCR%u = 0x%8.8x / 0x%8.8x (ARM)",
+// addr,
+// size,
+// i,
+// i,
+// dbg.bvr[i],
+// dbg.bcr[i]);
}
kret = WriteDBG();
- ProcessMacOSXLog::LogIf(PD_LOG_BREAKPOINTS, "RegisterContextDarwin_arm::EnableHardwareBreakpoint() WriteDBG() => 0x%8.8x.", kret);
+// if (log) log->Printf ("RegisterContextDarwin_arm::EnableHardwareBreakpoint() WriteDBG() => 0x%8.8x.", kret);
if (kret == KERN_SUCCESS)
return i;
}
- else
- {
- ProcessMacOSXLog::LogIf(PD_LOG_BREAKPOINTS, "RegisterContextDarwin_arm::EnableHardwareBreakpoint(addr = %8.8p, size = %u) => all hardware breakpoint resources are being used.", addr, size);
- }
+// else
+// {
+// if (log) log->Printf ("RegisterContextDarwin_arm::EnableHardwareBreakpoint(addr = %8.8p, size = %u) => all hardware breakpoint resources are being used.", addr, size);
+// }
}
return LLDB_INVALID_INDEX32;
@@ -1075,12 +1074,12 @@
if (hw_index < num_hw_points)
{
dbg.bcr[hw_index] = 0;
- ProcessMacOSXLog::LogIf(PD_LOG_BREAKPOINTS, "RegisterContextDarwin_arm::SetHardwareBreakpoint( %u ) - BVR%u = 0x%8.8x BCR%u = 0x%8.8x",
- hw_index,
- hw_index,
- dbg.bvr[hw_index],
- hw_index,
- dbg.bcr[hw_index]);
+// if (log) log->Printf ("RegisterContextDarwin_arm::SetHardwareBreakpoint( %u ) - BVR%u = 0x%8.8x BCR%u = 0x%8.8x",
+// hw_index,
+// hw_index,
+// dbg.bvr[hw_index],
+// hw_index,
+// dbg.bcr[hw_index]);
kret = WriteDBG();
@@ -1106,7 +1105,7 @@
uint32_t register_DBGDIDR;
asm("mrc p14, 0, %0, c0, c0, 0" : "=r" (register_DBGDIDR));
g_num_supported_hw_watchpoints = bits(register_DBGDIDR, 31, 28) + 1;
- ProcessMacOSXLog::LogIf(PD_LOG_THREAD, "DBGDIDR=0x%8.8x (number WRP pairs = %u)", register_DBGDIDR, g_num_supported_hw_watchpoints);
+// if (log) log->Printf ("DBGDIDR=0x%8.8x (number WRP pairs = %u)", register_DBGDIDR, g_num_supported_hw_watchpoints);
}
return g_num_supported_hw_watchpoints;
#else
@@ -1119,7 +1118,7 @@
uint32_t
RegisterContextDarwin_arm::SetHardwareWatchpoint (lldb::addr_t addr, size_t size, bool read, bool write)
{
- ProcessMacOSXLog::LogIf(PD_LOG_WATCHPOINTS, "RegisterContextDarwin_arm::EnableHardwareWatchpoint(addr = %8.8p, size = %u, read = %u, write = %u)", addr, size, read, write);
+// if (log) log->Printf ("RegisterContextDarwin_arm::EnableHardwareWatchpoint(addr = %8.8p, size = %u, read = %u, write = %u)", addr, size, read, write);
const uint32_t num_hw_watchpoints = NumSupportedHardwareWatchpoints();
@@ -1140,10 +1139,10 @@
// until the next 4 byte boundary and we need to make sure we can properly
// encode this.
uint32_t addr_word_offset = addr % 4;
- ProcessMacOSXLog::LogIf(PD_LOG_WATCHPOINTS, "RegisterContextDarwin_arm::EnableHardwareWatchpoint() - addr_word_offset = 0x%8.8x", addr_word_offset);
+// if (log) log->Printf ("RegisterContextDarwin_arm::EnableHardwareWatchpoint() - addr_word_offset = 0x%8.8x", addr_word_offset);
uint32_t byte_mask = ((1u << size) - 1u) << addr_word_offset;
- ProcessMacOSXLog::LogIf(PD_LOG_WATCHPOINTS, "RegisterContextDarwin_arm::EnableHardwareWatchpoint() - byte_mask = 0x%8.8x", byte_mask);
+// if (log) log->Printf ("RegisterContextDarwin_arm::EnableHardwareWatchpoint() - byte_mask = 0x%8.8x", byte_mask);
if (byte_mask > 0xfu)
return LLDB_INVALID_INDEX32;
@@ -1175,14 +1174,14 @@
WCR_ENABLE; // Enable this watchpoint;
kret = WriteDBG();
- ProcessMacOSXLog::LogIf(PD_LOG_WATCHPOINTS, "RegisterContextDarwin_arm::EnableHardwareWatchpoint() WriteDBG() => 0x%8.8x.", kret);
+// if (log) log->Printf ("RegisterContextDarwin_arm::EnableHardwareWatchpoint() WriteDBG() => 0x%8.8x.", kret);
if (kret == KERN_SUCCESS)
return i;
}
else
{
- ProcessMacOSXLog::LogIf(PD_LOG_WATCHPOINTS, "RegisterContextDarwin_arm::EnableHardwareWatchpoint(): All hardware resources (%u) are in use.", num_hw_watchpoints);
+// if (log) log->Printf ("RegisterContextDarwin_arm::EnableHardwareWatchpoint(): All hardware resources (%u) are in use.", num_hw_watchpoints);
}
}
return LLDB_INVALID_INDEX32;
@@ -1199,12 +1198,12 @@
if (hw_index < num_hw_points)
{
dbg.wcr[hw_index] = 0;
- ProcessMacOSXLog::LogIf(PD_LOG_WATCHPOINTS, "RegisterContextDarwin_arm::ClearHardwareWatchpoint( %u ) - WVR%u = 0x%8.8x WCR%u = 0x%8.8x",
- hw_index,
- hw_index,
- dbg.wvr[hw_index],
- hw_index,
- dbg.wcr[hw_index]);
+// if (log) log->Printf ("RegisterContextDarwin_arm::ClearHardwareWatchpoint( %u ) - WVR%u = 0x%8.8x WCR%u = 0x%8.8x",
+// hw_index,
+// hw_index,
+// dbg.wvr[hw_index],
+// hw_index,
+// dbg.wcr[hw_index]);
kret = WriteDBG();
Modified: lldb/trunk/source/lldb.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/lldb.cpp?rev=136626&r1=136625&r2=136626&view=diff
==============================================================================
--- lldb/trunk/source/lldb.cpp (original)
+++ lldb/trunk/source/lldb.cpp Mon Aug 1 12:08:02 2011
@@ -44,7 +44,6 @@
#include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h"
#include "Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h"
#include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h"
-#include "Plugins/Process/MacOSX-User/source/ProcessMacOSX.h"
#include "Plugins/Process/MacOSX-Kernel/ProcessKDP.h"
#include "Plugins/Process/gdb-remote/ProcessGDBRemote.h"
#include "Plugins/Platform/MacOSX/PlatformMacOSX.h"
@@ -105,7 +104,6 @@
ObjectFileMachO::Initialize();
ProcessKDP::Initialize();
ProcessGDBRemote::Initialize();
- //ProcessMacOSX::Initialize();
SymbolVendorMacOSX::Initialize();
PlatformMacOSX::Initialize();
PlatformRemoteiOS::Initialize();
@@ -171,7 +169,6 @@
ObjectFileMachO::Terminate();
ProcessKDP::Terminate();
ProcessGDBRemote::Terminate();
- //ProcessMacOSX::Terminate();
SymbolVendorMacOSX::Terminate();
PlatformMacOSX::Terminate();
PlatformRemoteiOS::Terminate();
From scallanan at apple.com Mon Aug 1 12:41:38 2011
From: scallanan at apple.com (Sean Callanan)
Date: Mon, 01 Aug 2011 17:41:38 -0000
Subject: [Lldb-commits] [lldb] r136629 -
/lldb/trunk/source/Expression/IRForTarget.cpp
Message-ID: <20110801174138.4CFEF2A6C12C@llvm.org>
Author: spyffe
Date: Mon Aug 1 12:41:38 2011
New Revision: 136629
URL: http://llvm.org/viewvc/llvm-project?rev=136629&view=rev
Log:
Fixed a bug where named constants were being
treated as externals, causing problems when we
tried to look their locations up in the debug
info. For example:
expr char c[] = "foo"; c[0]
would terminate when trying to find c in the
debug information, despite the fact that c was
defined inside the expression.
Modified:
lldb/trunk/source/Expression/IRForTarget.cpp
Modified: lldb/trunk/source/Expression/IRForTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRForTarget.cpp?rev=136629&r1=136628&r2=136629&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRForTarget.cpp (original)
+++ lldb/trunk/source/Expression/IRForTarget.cpp Mon Aug 1 12:41:38 2011
@@ -1236,7 +1236,7 @@
if (log)
log->Printf("MaybeHandleVariable (%s)", PrintValue(llvm_value_ptr).c_str());
-
+
if (ConstantExpr *constant_expr = dyn_cast(llvm_value_ptr))
{
switch (constant_expr->getOpcode())
@@ -1324,7 +1324,12 @@
llvm_value_ptr,
value_size,
value_alignment))
- return false;
+ {
+ if (!global_variable->hasExternalLinkage())
+ return true;
+ else
+ return false;
+ }
}
else if (dyn_cast(llvm_value_ptr))
{
@@ -1403,6 +1408,9 @@
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
Function *fun = llvm_call_inst->getCalledFunction();
+
+ // If the call is to something other than a plain llvm::Function, resolve which
+ // Function is meant or give up.
if (fun == NULL)
{
@@ -1440,6 +1448,9 @@
}
}
+ // Determine the name of the called function, which is needed to find the address.
+ // Intrinsics are special-cased.
+
lldb_private::ConstString str;
if (fun->isIntrinsic())
@@ -1472,6 +1483,8 @@
str.SetCStringWithLength (fun->getName().data(), fun->getName().size());
}
+ // Find the address of the function, and the type if possible.
+
clang::NamedDecl *fun_decl = DeclForGlobal (fun);
lldb::addr_t fun_addr = LLDB_INVALID_ADDRESS;
Value **fun_value_ptr = NULL;
@@ -1511,6 +1524,8 @@
if (log)
log->Printf("Found \"%s\" at 0x%llx", str.GetCString(), fun_addr);
+ // Construct the typed pointer to the function.
+
Value *fun_addr_ptr = NULL;
if (!fun_value_ptr || !*fun_value_ptr)
From scallanan at apple.com Mon Aug 1 13:18:34 2011
From: scallanan at apple.com (Sean Callanan)
Date: Mon, 01 Aug 2011 18:18:34 -0000
Subject: [Lldb-commits] [lldb] r136631 - in /lldb/trunk:
include/lldb/Expression/ClangExpressionDeclMap.h
source/Expression/ClangExpressionDeclMap.cpp
source/Expression/ClangUserExpression.cpp
source/Expression/ClangUtilityFunction.cpp
Message-ID: <20110801181834.14DAF2A6C12C@llvm.org>
Author: spyffe
Date: Mon Aug 1 13:18:33 2011
New Revision: 136631
URL: http://llvm.org/viewvc/llvm-project?rev=136631&view=rev
Log:
Added checking to make sure that the target has a
scratch AST context before attempting to parse.
Modified:
lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h
lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
lldb/trunk/source/Expression/ClangUserExpression.cpp
lldb/trunk/source/Expression/ClangUtilityFunction.cpp
Modified: lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h?rev=136631&r1=136630&r2=136631&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h (original)
+++ lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h Mon Aug 1 13:18:33 2011
@@ -82,8 +82,11 @@
/// @param[in] exe_ctx
/// The execution context to use when finding types for variables.
/// Also used to find a "scratch" AST context to store result types.
+ ///
+ /// @return
+ /// True if parsing is possible; false if it is unsafe to continue.
//------------------------------------------------------------------
- void
+ bool
WillParse (ExecutionContext &exe_ctx);
//------------------------------------------------------------------
Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=136631&r1=136630&r2=136631&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Mon Aug 1 13:18:33 2011
@@ -64,12 +64,12 @@
DisableStructVars();
}
-void
+bool
ClangExpressionDeclMap::WillParse(ExecutionContext &exe_ctx)
{
EnableParserVars();
m_parser_vars->m_exe_ctx = &exe_ctx;
-
+
if (exe_ctx.frame)
m_parser_vars->m_sym_ctx = exe_ctx.frame->GetSymbolContext(lldb::eSymbolContextEverything);
else if (exe_ctx.thread)
@@ -78,6 +78,11 @@
m_parser_vars->m_sym_ctx = SymbolContext(exe_ctx.target->GetSP(), ModuleSP());
if (exe_ctx.target)
m_parser_vars->m_persistent_vars = &exe_ctx.target->GetPersistentVariables();
+
+ if (exe_ctx.target && !exe_ctx.target->GetScratchClangASTContext())
+ return false;
+
+ return true;
}
void
@@ -133,6 +138,7 @@
const llvm::APInt& value)
{
assert (m_parser_vars.get());
+
ExecutionContext *exe_ctx = m_parser_vars->m_exe_ctx;
ASTContext *context(exe_ctx->target->GetScratchClangASTContext()->getASTContext());
Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUserExpression.cpp?rev=136631&r1=136630&r2=136631&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangUserExpression.cpp (original)
+++ lldb/trunk/source/Expression/ClangUserExpression.cpp Mon Aug 1 13:18:33 2011
@@ -241,7 +241,11 @@
m_expr_decl_map.reset(new ClangExpressionDeclMap(keep_result_in_memory));
- m_expr_decl_map->WillParse(exe_ctx);
+ if (!m_expr_decl_map->WillParse(exe_ctx))
+ {
+ error_stream.PutCString ("error: current process state is unsuitable for expression parsing\n");
+ return false;
+ }
ClangExpressionParser parser(exe_ctx.process, *this);
Modified: lldb/trunk/source/Expression/ClangUtilityFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUtilityFunction.cpp?rev=136631&r1=136630&r2=136631&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangUtilityFunction.cpp (original)
+++ lldb/trunk/source/Expression/ClangUtilityFunction.cpp Mon Aug 1 13:18:33 2011
@@ -103,7 +103,11 @@
m_data_allocator.reset(new ProcessDataAllocator(*exe_ctx.process));
- m_expr_decl_map->WillParse(exe_ctx);
+ if (!m_expr_decl_map->WillParse(exe_ctx))
+ {
+ error_stream.PutCString ("error: current process state is unsuitable for expression parsing\n");
+ return false;
+ }
ClangExpressionParser parser(exe_ctx.GetBestExecutionContextScope(), *this);
From johnny.chen at apple.com Mon Aug 1 13:26:32 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Mon, 01 Aug 2011 18:26:32 -0000
Subject: [Lldb-commits] [lldb] r136633 -
/lldb/trunk/test/expression_command/radar_9673664/TestExprHelpExamples.py
Message-ID: <20110801182632.76A052A6C12C@llvm.org>
Author: johnny
Date: Mon Aug 1 13:26:32 2011
New Revision: 136633
URL: http://llvm.org/viewvc/llvm-project?rev=136633&view=rev
Log:
Remove the @expectedFailure decorator since the bug has been fixed.
rdar://problem/9673664
Modified:
lldb/trunk/test/expression_command/radar_9673664/TestExprHelpExamples.py
Modified: lldb/trunk/test/expression_command/radar_9673664/TestExprHelpExamples.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/expression_command/radar_9673664/TestExprHelpExamples.py?rev=136633&r1=136632&r2=136633&view=diff
==============================================================================
--- lldb/trunk/test/expression_command/radar_9673664/TestExprHelpExamples.py (original)
+++ lldb/trunk/test/expression_command/radar_9673664/TestExprHelpExamples.py Mon Aug 1 13:26:32 2011
@@ -19,7 +19,6 @@
self.line = line_number(self.main_source, '// Set breakpoint here.')
# rdar://problem/9673664
- @unittest2.expectedFailure
def test_expr_commands(self):
"""The following expression commands should just work."""
self.buildDefault()
@@ -35,9 +34,10 @@
# rdar://problem/9673664 lldb expression evaluation problem
- self.runCmd('expr char c[] = "foo"; c[0]')
- # Fill in an example output here.
- # And change self.runCmd() -> self.expect()...
+ self.expect('expr char c[] = "foo"; c[0]',
+ substrs = ["'f'"])
+ # runCmd: expr char c[] = "foo"; c[0]
+ # output: (char) $0 = 'f'
if __name__ == '__main__':
From johnny.chen at apple.com Mon Aug 1 13:46:13 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Mon, 01 Aug 2011 18:46:13 -0000
Subject: [Lldb-commits] [lldb] r136636 - /lldb/trunk/test/lldbtest.py
Message-ID: <20110801184613.5CEE12A6C12C@llvm.org>
Author: johnny
Date: Mon Aug 1 13:46:13 2011
New Revision: 136636
URL: http://llvm.org/viewvc/llvm-project?rev=136636&view=rev
Log:
Start refactoring lldbtest.TestBase so that it inherits from a newly created lldbtest.Base class,
while its API clients remain unchanged. The new lldbtest.Base class is to capture common behaviors
when working with the test driver to accomplish things. The clients of lldbtest.Base can be
lldb command line and api tests as well as other generic tests like a benchmark test.
Modified:
lldb/trunk/test/lldbtest.py
Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=136636&r1=136635&r2=136636&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Mon Aug 1 13:46:13 2011
@@ -231,42 +231,6 @@
a_pointer = ctypes.c_void_p(0xffff)
return 8 * ctypes.sizeof(a_pointer)
-from functools import wraps
-def python_api_test(func):
- """Decorate the item as a Python API only test."""
- if isinstance(func, type) and issubclass(func, unittest2.TestCase):
- raise Exception("@python_api_test can only be used to decorate a test method")
- @wraps(func)
- def wrapper(self, *args, **kwargs):
- try:
- if lldb.dont_do_python_api_test:
- self.skipTest("python api tests")
- except AttributeError:
- pass
- return func(self, *args, **kwargs)
-
- # Mark this function as such to separate them from lldb command line tests.
- wrapper.__python_api_test__ = True
- return wrapper
-
-from functools import wraps
-def benchmarks_test(func):
- """Decorate the item as a benchmarks test."""
- if isinstance(func, type) and issubclass(func, unittest2.TestCase):
- raise Exception("@benchmarks_test can only be used to decorate a test method")
- @wraps(func)
- def wrapper(self, *args, **kwargs):
- try:
- if not lldb.just_do_benchmarks_test:
- self.skipTest("benchmarks tests")
- except AttributeError:
- pass
- return func(self, *args, **kwargs)
-
- # Mark this function as such to separate them from the regular tests.
- wrapper.__benchmarks_test__ = True
- return wrapper
-
class recording(StringIO.StringIO):
"""
A nice little context manager for recording the debugger interactions into
@@ -363,80 +327,56 @@
def builder_module():
return __import__("builder_" + sys.platform)
-class TestBase(unittest2.TestCase):
- """
- This abstract base class is meant to be subclassed. It provides default
- implementations for setUpClass(), tearDownClass(), setUp(), and tearDown(),
- among other things.
-
- Important things for test class writers:
+#
+# Decorators for categorizing test cases.
+#
- - Overwrite the mydir class attribute, otherwise your test class won't
- run. It specifies the relative directory to the top level 'test' so
- the test harness can change to the correct working directory before
- running your test.
-
- - The setUp method sets up things to facilitate subsequent interactions
- with the debugger as part of the test. These include:
- - populate the test method name
- - create/get a debugger set with synchronous mode (self.dbg)
- - get the command interpreter from with the debugger (self.ci)
- - create a result object for use with the command interpreter
- (self.res)
- - plus other stuffs
+from functools import wraps
+def python_api_test(func):
+ """Decorate the item as a Python API only test."""
+ if isinstance(func, type) and issubclass(func, unittest2.TestCase):
+ raise Exception("@python_api_test can only be used to decorate a test method")
+ @wraps(func)
+ def wrapper(self, *args, **kwargs):
+ try:
+ if lldb.dont_do_python_api_test:
+ self.skipTest("python api tests")
+ except AttributeError:
+ pass
+ return func(self, *args, **kwargs)
- - The tearDown method tries to perform some necessary cleanup on behalf
- of the test to return the debugger to a good state for the next test.
- These include:
- - execute any tearDown hooks registered by the test method with
- TestBase.addTearDownHook(); examples can be found in
- settings/TestSettings.py
- - kill the inferior process associated with each target, if any,
- and, then delete the target from the debugger's target list
- - perform build cleanup before running the next test method in the
- same test class; examples of registering for this service can be
- found in types/TestIntegerTypes.py with the call:
- - self.setTearDownCleanup(dictionary=d)
+ # Mark this function as such to separate them from lldb command line tests.
+ wrapper.__python_api_test__ = True
+ return wrapper
- - Similarly setUpClass and tearDownClass perform classwise setup and
- teardown fixtures. The tearDownClass method invokes a default build
- cleanup for the entire test class; also, subclasses can implement the
- classmethod classCleanup(cls) to perform special class cleanup action.
+from functools import wraps
+def benchmarks_test(func):
+ """Decorate the item as a benchmarks test."""
+ if isinstance(func, type) and issubclass(func, unittest2.TestCase):
+ raise Exception("@benchmarks_test can only be used to decorate a test method")
+ @wraps(func)
+ def wrapper(self, *args, **kwargs):
+ try:
+ if not lldb.just_do_benchmarks_test:
+ self.skipTest("benchmarks tests")
+ except AttributeError:
+ pass
+ return func(self, *args, **kwargs)
- - The instance methods runCmd and expect are used heavily by existing
- test cases to send a command to the command interpreter and to perform
- string/pattern matching on the output of such command execution. The
- expect method also provides a mode to peform string/pattern matching
- without running a command.
+ # Mark this function as such to separate them from the regular tests.
+ wrapper.__benchmarks_test__ = True
+ return wrapper
- - The build methods buildDefault, buildDsym, and buildDwarf are used to
- build the binaries used during a particular test scenario. A plugin
- should be provided for the sys.platform running the test suite. The
- Mac OS X implementation is located in plugins/darwin.py.
+class Base(unittest2.TestCase):
+ """
+ Abstract base for performing lldb (see TestBase) or other generic tests (see
+ BenchBase for one example). lldbtest.Base works with the test driver to
+ accomplish things.
+
"""
-
- @classmethod
- def skipLongRunningTest(cls):
- """
- By default, we skip long running test case.
- This can be overridden by passing '-l' to the test driver (dotest.py).
- """
- if "LLDB_SKIP_LONG_RUNNING_TEST" in os.environ and "NO" == os.environ["LLDB_SKIP_LONG_RUNNING_TEST"]:
- return False
- else:
- return True
-
# The concrete subclass should override this attribute.
mydir = None
- # Maximum allowed attempts when launching the inferior process.
- # Can be overridden by the LLDB_MAX_LAUNCH_COUNT environment variable.
- maxLaunchCount = 3;
-
- # Time to wait before the next launching attempt in second(s).
- # Can be overridden by the LLDB_TIME_WAIT_NEXT_LAUNCH environment variable.
- timeWaitNextLaunch = 1.0;
-
# Keep track of the old current working directory.
oldcwd = None
@@ -488,6 +428,110 @@
print >> sys.stderr, "Restore dir to:", cls.oldcwd
os.chdir(cls.oldcwd)
+ @classmethod
+ def skipLongRunningTest(cls):
+ """
+ By default, we skip long running test case.
+ This can be overridden by passing '-l' to the test driver (dotest.py).
+ """
+ if "LLDB_SKIP_LONG_RUNNING_TEST" in os.environ and "NO" == os.environ["LLDB_SKIP_LONG_RUNNING_TEST"]:
+ return False
+ else:
+ return True
+
+ def setUp(self):
+ """Works with the test driver to conditionally skip tests."""
+ #import traceback
+ #traceback.print_stack()
+
+ # Python API only test is decorated with @python_api_test,
+ # which also sets the "__python_api_test__" attribute of the
+ # function object to True.
+ try:
+ if lldb.just_do_python_api_test:
+ testMethod = getattr(self, self._testMethodName)
+ if getattr(testMethod, "__python_api_test__", False):
+ pass
+ else:
+ self.skipTest("non python api test")
+ except AttributeError:
+ pass
+
+ # Benchmarks test is decorated with @benchmarks_test,
+ # which also sets the "__benchmarks_test__" attribute of the
+ # function object to True.
+ try:
+ if lldb.just_do_benchmarks_test:
+ testMethod = getattr(self, self._testMethodName)
+ if getattr(testMethod, "__benchmarks_test__", False):
+ pass
+ else:
+ self.skipTest("non benchmarks test")
+ except AttributeError:
+ pass
+
+
+
+class TestBase(Base):
+ """
+ This abstract base class is meant to be subclassed. It provides default
+ implementations for setUpClass(), tearDownClass(), setUp(), and tearDown(),
+ among other things.
+
+ Important things for test class writers:
+
+ - Overwrite the mydir class attribute, otherwise your test class won't
+ run. It specifies the relative directory to the top level 'test' so
+ the test harness can change to the correct working directory before
+ running your test.
+
+ - The setUp method sets up things to facilitate subsequent interactions
+ with the debugger as part of the test. These include:
+ - populate the test method name
+ - create/get a debugger set with synchronous mode (self.dbg)
+ - get the command interpreter from with the debugger (self.ci)
+ - create a result object for use with the command interpreter
+ (self.res)
+ - plus other stuffs
+
+ - The tearDown method tries to perform some necessary cleanup on behalf
+ of the test to return the debugger to a good state for the next test.
+ These include:
+ - execute any tearDown hooks registered by the test method with
+ TestBase.addTearDownHook(); examples can be found in
+ settings/TestSettings.py
+ - kill the inferior process associated with each target, if any,
+ and, then delete the target from the debugger's target list
+ - perform build cleanup before running the next test method in the
+ same test class; examples of registering for this service can be
+ found in types/TestIntegerTypes.py with the call:
+ - self.setTearDownCleanup(dictionary=d)
+
+ - Similarly setUpClass and tearDownClass perform classwise setup and
+ teardown fixtures. The tearDownClass method invokes a default build
+ cleanup for the entire test class; also, subclasses can implement the
+ classmethod classCleanup(cls) to perform special class cleanup action.
+
+ - The instance methods runCmd and expect are used heavily by existing
+ test cases to send a command to the command interpreter and to perform
+ string/pattern matching on the output of such command execution. The
+ expect method also provides a mode to peform string/pattern matching
+ without running a command.
+
+ - The build methods buildDefault, buildDsym, and buildDwarf are used to
+ build the binaries used during a particular test scenario. A plugin
+ should be provided for the sys.platform running the test suite. The
+ Mac OS X implementation is located in plugins/darwin.py.
+ """
+
+ # Maximum allowed attempts when launching the inferior process.
+ # Can be overridden by the LLDB_MAX_LAUNCH_COUNT environment variable.
+ maxLaunchCount = 3;
+
+ # Time to wait before the next launching attempt in second(s).
+ # Can be overridden by the LLDB_TIME_WAIT_NEXT_LAUNCH environment variable.
+ timeWaitNextLaunch = 1.0;
+
def doDelay(self):
"""See option -w of dotest.py."""
if ("LLDB_WAIT_BETWEEN_TEST_CASES" in os.environ and
@@ -501,6 +545,9 @@
#import traceback
#traceback.print_stack()
+ # Works with the test driver to conditionally skip tests via decorators.
+ Base.setUp(self)
+
# Assign the test method name to self.testMethodName.
#
# For an example of the use of this attribute, look at test/types dir.
@@ -523,32 +570,6 @@
except AttributeError:
pass
- # Python API only test is decorated with @python_api_test,
- # which also sets the "__python_api_test__" attribute of the
- # function object to True.
- try:
- if lldb.just_do_python_api_test:
- testMethod = getattr(self, self._testMethodName)
- if getattr(testMethod, "__python_api_test__", False):
- pass
- else:
- self.skipTest("non python api test")
- except AttributeError:
- pass
-
- # Benchmarks test is decorated with @benchmarks_test,
- # which also sets the "__benchmarks_test__" attribute of the
- # function object to True.
- try:
- if lldb.just_do_benchmarks_test:
- testMethod = getattr(self, self._testMethodName)
- if getattr(testMethod, "__benchmarks_test__", False):
- pass
- else:
- self.skipTest("non benchmarks test")
- except AttributeError:
- pass
-
# Insert some delay between successive test cases if specified.
self.doDelay()
From johnny.chen at apple.com Mon Aug 1 14:50:58 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Mon, 01 Aug 2011 19:50:58 -0000
Subject: [Lldb-commits] [lldb] r136641 - /lldb/trunk/test/lldbtest.py
Message-ID: <20110801195058.8F6652A6C12C@llvm.org>
Author: johnny
Date: Mon Aug 1 14:50:58 2011
New Revision: 136641
URL: http://llvm.org/viewvc/llvm-project?rev=136641&view=rev
Log:
More refactorings to migrate logic from TestBase to its parent class.
Modified:
lldb/trunk/test/lldbtest.py
Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=136641&r1=136640&r2=136641&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Mon Aug 1 14:50:58 2011
@@ -380,6 +380,10 @@
# Keep track of the old current working directory.
oldcwd = None
+ def TraceOn(self):
+ """Returns True if we are in trace mode (tracing detailed test execution)."""
+ return traceAlways
+
@classmethod
def setUpClass(cls):
"""
@@ -440,7 +444,10 @@
return True
def setUp(self):
- """Works with the test driver to conditionally skip tests."""
+ """Fixture for unittest test case setup.
+
+ It works with the test driver to conditionally skip tests and does other
+ initializations."""
#import traceback
#traceback.print_stack()
@@ -470,6 +477,255 @@
except AttributeError:
pass
+ # These are for customized teardown cleanup.
+ self.dict = None
+ self.doTearDownCleanup = False
+ # And in rare cases where there are multiple teardown cleanups.
+ self.dicts = []
+ self.doTearDownCleanups = False
+
+ # Create a string buffer to record the session info, to be dumped into a
+ # test case specific file if test failure is encountered.
+ self.session = StringIO.StringIO()
+
+ # Optimistically set __errored__, __failed__, __expected__ to False
+ # initially. If the test errored/failed, the session info
+ # (self.session) is then dumped into a session specific file for
+ # diagnosis.
+ self.__errored__ = False
+ self.__failed__ = False
+ self.__expected__ = False
+ # We are also interested in unexpected success.
+ self.__unexpected__ = False
+
+ # See addTearDownHook(self, hook) which allows the client to add a hook
+ # function to be run during tearDown() time.
+ self.hooks = []
+
+ # See HideStdout(self).
+ self.sys_stdout_hidden = False
+
+ def HideStdout(self):
+ """Hide output to stdout from the user.
+
+ During test execution, there might be cases where we don't want to show the
+ standard output to the user. For example,
+
+ self.runCmd(r'''sc print "\n\n\tHello!\n"''')
+
+ tests whether command abbreviation for 'script' works or not. There is no
+ need to show the 'Hello' output to the user as long as the 'script' command
+ succeeds and we are not in TraceOn() mode (see the '-t' option).
+
+ In this case, the test method calls self.HideStdout(self) to redirect the
+ sys.stdout to a null device, and restores the sys.stdout upon teardown.
+
+ Note that you should only call this method at most once during a test case
+ execution. Any subsequent call has no effect at all."""
+ if self.sys_stdout_hidden:
+ return
+
+ self.sys_stdout_hidden = True
+ old_stdout = sys.stdout
+ sys.stdout = open(os.devnull, 'w')
+ def restore_stdout():
+ sys.stdout = old_stdout
+ self.addTearDownHook(restore_stdout)
+
+ # =======================================================================
+ # Methods for customized teardown cleanups as well as execution of hooks.
+ # =======================================================================
+
+ def setTearDownCleanup(self, dictionary=None):
+ """Register a cleanup action at tearDown() time with a dictinary"""
+ self.dict = dictionary
+ self.doTearDownCleanup = True
+
+ def addTearDownCleanup(self, dictionary):
+ """Add a cleanup action at tearDown() time with a dictinary"""
+ self.dicts.append(dictionary)
+ self.doTearDownCleanups = True
+
+ def addTearDownHook(self, hook):
+ """
+ Add a function to be run during tearDown() time.
+
+ Hooks are executed in a first come first serve manner.
+ """
+ if callable(hook):
+ with recording(self, traceAlways) as sbuf:
+ print >> sbuf, "Adding tearDown hook:", getsource_if_available(hook)
+ self.hooks.append(hook)
+
+ def tearDown(self):
+ """Fixture for unittest test case teardown."""
+ #import traceback
+ #traceback.print_stack()
+
+ # Check and run any hook functions.
+ for hook in reversed(self.hooks):
+ with recording(self, traceAlways) as sbuf:
+ print >> sbuf, "Executing tearDown hook:", getsource_if_available(hook)
+ hook()
+
+ del self.hooks
+
+ # Perform registered teardown cleanup.
+ if doCleanup and self.doTearDownCleanup:
+ module = builder_module()
+ if not module.cleanup(self, dictionary=self.dict):
+ raise Exception("Don't know how to do cleanup with dictionary: " + self.dict)
+
+ # In rare cases where there are multiple teardown cleanups added.
+ if doCleanup and self.doTearDownCleanups:
+ module = builder_module()
+ if self.dicts:
+ for dict in reversed(self.dicts):
+ if not module.cleanup(self, dictionary=dict):
+ raise Exception("Don't know how to do cleanup with dictionary: " + dict)
+
+ # Decide whether to dump the session info.
+ self.dumpSessionInfo()
+
+ # =========================================================
+ # Various callbacks to allow introspection of test progress
+ # =========================================================
+
+ def markError(self):
+ """Callback invoked when an error (unexpected exception) errored."""
+ self.__errored__ = True
+ with recording(self, False) as sbuf:
+ # False because there's no need to write "ERROR" to the stderr twice.
+ # Once by the Python unittest framework, and a second time by us.
+ print >> sbuf, "ERROR"
+
+ def markFailure(self):
+ """Callback invoked when a failure (test assertion failure) occurred."""
+ self.__failed__ = True
+ with recording(self, False) as sbuf:
+ # False because there's no need to write "FAIL" to the stderr twice.
+ # Once by the Python unittest framework, and a second time by us.
+ print >> sbuf, "FAIL"
+
+ def markExpectedFailure(self):
+ """Callback invoked when an expected failure/error occurred."""
+ self.__expected__ = True
+ with recording(self, False) as sbuf:
+ # False because there's no need to write "expected failure" to the
+ # stderr twice.
+ # Once by the Python unittest framework, and a second time by us.
+ print >> sbuf, "expected failure"
+
+ def markUnexpectedSuccess(self):
+ """Callback invoked when an unexpected success occurred."""
+ self.__unexpected__ = True
+ with recording(self, False) as sbuf:
+ # False because there's no need to write "unexpected success" to the
+ # stderr twice.
+ # Once by the Python unittest framework, and a second time by us.
+ print >> sbuf, "unexpected success"
+
+ def dumpSessionInfo(self):
+ """
+ Dump the debugger interactions leading to a test error/failure. This
+ allows for more convenient postmortem analysis.
+
+ See also LLDBTestResult (dotest.py) which is a singlton class derived
+ from TextTestResult and overwrites addError, addFailure, and
+ addExpectedFailure methods to allow us to to mark the test instance as
+ such.
+ """
+
+ # We are here because self.tearDown() detected that this test instance
+ # either errored or failed. The lldb.test_result singleton contains
+ # two lists (erros and failures) which get populated by the unittest
+ # framework. Look over there for stack trace information.
+ #
+ # The lists contain 2-tuples of TestCase instances and strings holding
+ # formatted tracebacks.
+ #
+ # See http://docs.python.org/library/unittest.html#unittest.TestResult.
+ if self.__errored__:
+ pairs = lldb.test_result.errors
+ prefix = 'Error'
+ elif self.__failed__:
+ pairs = lldb.test_result.failures
+ prefix = 'Failure'
+ elif self.__expected__:
+ pairs = lldb.test_result.expectedFailures
+ prefix = 'ExpectedFailure'
+ elif self.__unexpected__:
+ prefix = "UnexpectedSuccess"
+ else:
+ # Simply return, there's no session info to dump!
+ return
+
+ if not self.__unexpected__:
+ for test, traceback in pairs:
+ if test is self:
+ print >> self.session, traceback
+
+ dname = os.path.join(os.environ["LLDB_TEST"],
+ os.environ["LLDB_SESSION_DIRNAME"])
+ if not os.path.isdir(dname):
+ os.mkdir(dname)
+ fname = os.path.join(dname, "%s-%s.log" % (prefix, self.id()))
+ with open(fname, "w") as f:
+ import datetime
+ print >> f, "Session info generated @", datetime.datetime.now().ctime()
+ print >> f, self.session.getvalue()
+ print >> f, "To rerun this test, issue the following command from the 'test' directory:\n"
+ print >> f, "./dotest.py %s -v -t -f %s.%s" % (self.getRunOptions(),
+ self.__class__.__name__,
+ self._testMethodName)
+
+ # ====================================================
+ # Config. methods supported through a plugin interface
+ # (enables reading of the current test configuration)
+ # ====================================================
+
+ def getArchitecture(self):
+ """Returns the architecture in effect the test suite is running with."""
+ module = builder_module()
+ return module.getArchitecture()
+
+ def getCompiler(self):
+ """Returns the compiler in effect the test suite is running with."""
+ module = builder_module()
+ return module.getCompiler()
+
+ def getRunOptions(self):
+ """Command line option for -A and -C to run this test again, called from
+ self.dumpSessionInfo()."""
+ arch = self.getArchitecture()
+ comp = self.getCompiler()
+ if not arch and not comp:
+ return ""
+ else:
+ return "%s %s" % ("-A "+arch if arch else "",
+ "-C "+comp if comp else "")
+
+ # ==================================================
+ # Build methods supported through a plugin interface
+ # ==================================================
+
+ def buildDefault(self, architecture=None, compiler=None, dictionary=None):
+ """Platform specific way to build the default binaries."""
+ module = builder_module()
+ if not module.buildDefault(self, architecture, compiler, dictionary):
+ raise Exception("Don't know how to build default binary")
+
+ def buildDsym(self, architecture=None, compiler=None, dictionary=None):
+ """Platform specific way to build binaries with dsym info."""
+ module = builder_module()
+ if not module.buildDsym(self, architecture, compiler, dictionary):
+ raise Exception("Don't know how to build binary with dsym")
+
+ def buildDwarf(self, architecture=None, compiler=None, dictionary=None):
+ """Platform specific way to build binaries with dwarf maps."""
+ module = builder_module()
+ if not module.buildDwarf(self, architecture, compiler, dictionary):
+ raise Exception("Don't know how to build binary with dwarf")
class TestBase(Base):
@@ -608,152 +864,11 @@
# And the result object.
self.res = lldb.SBCommandReturnObject()
- # These are for customized teardown cleanup.
- self.dict = None
- self.doTearDownCleanup = False
- # And in rare cases where there are multiple teardown cleanups.
- self.dicts = []
- self.doTearDownCleanups = False
-
- # Create a string buffer to record the session info, to be dumped into a
- # test case specific file if test failure is encountered.
- self.session = StringIO.StringIO()
-
- # Optimistically set __errored__, __failed__, __expected__ to False
- # initially. If the test errored/failed, the session info
- # (self.session) is then dumped into a session specific file for
- # diagnosis.
- self.__errored__ = False
- self.__failed__ = False
- self.__expected__ = False
- # We are also interested in unexpected success.
- self.__unexpected__ = False
-
- # See addTearDownHook(self, hook) which allows the client to add a hook
- # function to be run during tearDown() time.
- self.hooks = []
-
- # See HideStdout(self).
- self.sys_stdout_hidden = False
-
- def markError(self):
- """Callback invoked when an error (unexpected exception) errored."""
- self.__errored__ = True
- with recording(self, False) as sbuf:
- # False because there's no need to write "ERROR" to the stderr twice.
- # Once by the Python unittest framework, and a second time by us.
- print >> sbuf, "ERROR"
-
- def markFailure(self):
- """Callback invoked when a failure (test assertion failure) occurred."""
- self.__failed__ = True
- with recording(self, False) as sbuf:
- # False because there's no need to write "FAIL" to the stderr twice.
- # Once by the Python unittest framework, and a second time by us.
- print >> sbuf, "FAIL"
-
- def markExpectedFailure(self):
- """Callback invoked when an expected failure/error occurred."""
- self.__expected__ = True
- with recording(self, False) as sbuf:
- # False because there's no need to write "expected failure" to the
- # stderr twice.
- # Once by the Python unittest framework, and a second time by us.
- print >> sbuf, "expected failure"
-
- def markUnexpectedSuccess(self):
- """Callback invoked when an unexpected success occurred."""
- self.__unexpected__ = True
- with recording(self, False) as sbuf:
- # False because there's no need to write "unexpected success" to the
- # stderr twice.
- # Once by the Python unittest framework, and a second time by us.
- print >> sbuf, "unexpected success"
-
- def dumpSessionInfo(self):
- """
- Dump the debugger interactions leading to a test error/failure. This
- allows for more convenient postmortem analysis.
-
- See also LLDBTestResult (dotest.py) which is a singlton class derived
- from TextTestResult and overwrites addError, addFailure, and
- addExpectedFailure methods to allow us to to mark the test instance as
- such.
- """
-
- # We are here because self.tearDown() detected that this test instance
- # either errored or failed. The lldb.test_result singleton contains
- # two lists (erros and failures) which get populated by the unittest
- # framework. Look over there for stack trace information.
- #
- # The lists contain 2-tuples of TestCase instances and strings holding
- # formatted tracebacks.
- #
- # See http://docs.python.org/library/unittest.html#unittest.TestResult.
- if self.__errored__:
- pairs = lldb.test_result.errors
- prefix = 'Error'
- elif self.__failed__:
- pairs = lldb.test_result.failures
- prefix = 'Failure'
- elif self.__expected__:
- pairs = lldb.test_result.expectedFailures
- prefix = 'ExpectedFailure'
- elif self.__unexpected__:
- prefix = "UnexpectedSuccess"
- else:
- # Simply return, there's no session info to dump!
- return
-
- if not self.__unexpected__:
- for test, traceback in pairs:
- if test is self:
- print >> self.session, traceback
-
- dname = os.path.join(os.environ["LLDB_TEST"],
- os.environ["LLDB_SESSION_DIRNAME"])
- if not os.path.isdir(dname):
- os.mkdir(dname)
- fname = os.path.join(dname, "%s-%s.log" % (prefix, self.id()))
- with open(fname, "w") as f:
- import datetime
- print >> f, "Session info generated @", datetime.datetime.now().ctime()
- print >> f, self.session.getvalue()
- print >> f, "To rerun this test, issue the following command from the 'test' directory:\n"
- print >> f, "./dotest.py %s -v -t -f %s.%s" % (self.getRunOptions(),
- self.__class__.__name__,
- self._testMethodName)
-
- def setTearDownCleanup(self, dictionary=None):
- """Register a cleanup action at tearDown() time with a dictinary"""
- self.dict = dictionary
- self.doTearDownCleanup = True
-
- def addTearDownCleanup(self, dictionary):
- """Add a cleanup action at tearDown() time with a dictinary"""
- self.dicts.append(dictionary)
- self.doTearDownCleanups = True
-
- def addTearDownHook(self, hook):
- """
- Add a function to be run during tearDown() time.
-
- Hooks are executed in a first come first serve manner.
- """
- if callable(hook):
- with recording(self, traceAlways) as sbuf:
- print >> sbuf, "Adding tearDown hook:", getsource_if_available(hook)
- self.hooks.append(hook)
-
def tearDown(self):
#import traceback
#traceback.print_stack()
- # Check and run any hook functions.
- for hook in reversed(self.hooks):
- with recording(self, traceAlways) as sbuf:
- print >> sbuf, "Executing tearDown hook:", getsource_if_available(hook)
- hook()
+ Base.tearDown(self)
# This is for the case of directly spawning 'lldb' and interacting with it
# using pexpect.
@@ -786,24 +901,6 @@
self.dbg.DeleteTarget(target)
del self.dbg
- del self.hooks
-
- # Perform registered teardown cleanup.
- if doCleanup and self.doTearDownCleanup:
- module = builder_module()
- if not module.cleanup(self, dictionary=self.dict):
- raise Exception("Don't know how to do cleanup with dictionary: " + self.dict)
-
- # In rare cases where there are multiple teardown cleanups added.
- if doCleanup and self.doTearDownCleanups:
- module = builder_module()
- if self.dicts:
- for dict in reversed(self.dicts):
- if not module.cleanup(self, dictionary=dict):
- raise Exception("Don't know how to do cleanup with dictionary: " + dict)
-
- # Decide whether to dump the session info.
- self.dumpSessionInfo()
def runCmd(self, cmd, msg=None, check=True, trace=False):
"""
@@ -940,54 +1037,6 @@
print >> sbuf, str(method) + ":", result
return result
- # ====================================================
- # Config. methods supported through a plugin interface
- # (enables reading of the current test configuration)
- # ====================================================
-
- def getArchitecture(self):
- """Returns the architecture in effect the test suite is running with."""
- module = builder_module()
- return module.getArchitecture()
-
- def getCompiler(self):
- """Returns the compiler in effect the test suite is running with."""
- module = builder_module()
- return module.getCompiler()
-
- def getRunOptions(self):
- """Command line option for -A and -C to run this test again, called from
- self.dumpSessionInfo()."""
- arch = self.getArchitecture()
- comp = self.getCompiler()
- if not arch and not comp:
- return ""
- else:
- return "%s %s" % ("-A "+arch if arch else "",
- "-C "+comp if comp else "")
-
- # ==================================================
- # Build methods supported through a plugin interface
- # ==================================================
-
- def buildDefault(self, architecture=None, compiler=None, dictionary=None):
- """Platform specific way to build the default binaries."""
- module = builder_module()
- if not module.buildDefault(self, architecture, compiler, dictionary):
- raise Exception("Don't know how to build default binary")
-
- def buildDsym(self, architecture=None, compiler=None, dictionary=None):
- """Platform specific way to build binaries with dsym info."""
- module = builder_module()
- if not module.buildDsym(self, architecture, compiler, dictionary):
- raise Exception("Don't know how to build binary with dsym")
-
- def buildDwarf(self, architecture=None, compiler=None, dictionary=None):
- """Platform specific way to build binaries with dwarf maps."""
- module = builder_module()
- if not module.buildDwarf(self, architecture, compiler, dictionary):
- raise Exception("Don't know how to build binary with dwarf")
-
# =================================================
# Misc. helper methods for debugging test execution
# =================================================
@@ -1016,34 +1065,3 @@
return
print child
-
- def TraceOn(self):
- """Returns True if we are in trace mode (i.e., tracing lldb command execution)."""
- return traceAlways
-
- def HideStdout(self):
- """Hide output to stdout from the user.
-
- During test execution, there might be cases where we don't want to show the
- standard output to the user. For example,
-
- self.runCmd(r'''sc print "\n\n\tHello!\n"''')
-
- tests whether command abbreviation for 'script' works or not. There is no
- need to show the 'Hello' output to the user as long as the 'script' command
- succeeds and we are not in TraceOn() mode (see the '-t' option).
-
- In this case, the test method calls self.HideStdout(self) to redirect the
- sys.stdout to a null device, and restores the sys.stdout upon teardown.
-
- Note that you should only call this method at most once during a test case
- execution. Any subsequent call has no effect at all."""
- if self.sys_stdout_hidden:
- return
-
- self.sys_stdout_hidden = True
- old_stdout = sys.stdout
- sys.stdout = open(os.devnull, 'w')
- def restore_stdout():
- sys.stdout = old_stdout
- self.addTearDownHook(restore_stdout)
From scallanan at apple.com Mon Aug 1 15:53:53 2011
From: scallanan at apple.com (Sean Callanan)
Date: Mon, 01 Aug 2011 20:53:53 -0000
Subject: [Lldb-commits] [lldb] r136648 -
/lldb/trunk/source/Expression/IRForTarget.cpp
Message-ID: <20110801205353.94C712A6C12C@llvm.org>
Author: spyffe
Date: Mon Aug 1 15:53:53 2011
New Revision: 136648
URL: http://llvm.org/viewvc/llvm-project?rev=136648&view=rev
Log:
Fixed a problem in the expression parser that
caused functions that were cast as part of the
call to have that cast ignored once their
addresses were resolved.
Notably, in the case of objc_msgSend(), if
the function was cast from something returning
i8* to something returning i8, the expression
parser was discarding the cast as part of its
resolution. This caused crashes later on.
Modified:
lldb/trunk/source/Expression/IRForTarget.cpp
Modified: lldb/trunk/source/Expression/IRForTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRForTarget.cpp?rev=136648&r1=136647&r2=136648&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRForTarget.cpp (original)
+++ lldb/trunk/source/Expression/IRForTarget.cpp Mon Aug 1 15:53:53 2011
@@ -1408,6 +1408,8 @@
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
Function *fun = llvm_call_inst->getCalledFunction();
+
+ bool is_bitcast = false;
// If the call is to something other than a plain llvm::Function, resolve which
// Function is meant or give up.
@@ -1430,6 +1432,8 @@
return false;
}
+
+ is_bitcast = true;
}
else if (const_expr && const_expr->getOpcode() == Instruction::IntToPtr)
{
@@ -1544,7 +1548,30 @@
if (fun_value_ptr)
fun_addr_ptr = *fun_value_ptr;
- llvm_call_inst->setCalledFunction(fun_addr_ptr);
+ if (is_bitcast)
+ {
+ Value *val = llvm_call_inst->getCalledValue();
+
+ ConstantExpr *const_expr = dyn_cast(val);
+
+ Constant *fun_addr_ptr_cst = dyn_cast(fun_addr_ptr);
+
+ if (!fun_addr_ptr_cst)
+ {
+ if (m_error_stream)
+ m_error_stream->Printf("Error [IRForTarget]: Non-constant source function '%s' has a constant BitCast\n", str.GetCString());
+
+ return false;
+ }
+
+ Constant *new_bit_cast = ConstantExpr::getBitCast(fun_addr_ptr_cst, const_expr->getType());
+
+ llvm_call_inst->setCalledFunction(new_bit_cast);
+ }
+ else
+ {
+ llvm_call_inst->setCalledFunction(fun_addr_ptr);
+ }
ConstantArray *func_name = (ConstantArray*)ConstantArray::get(m_module->getContext(), str.GetCString());
From johnny.chen at apple.com Mon Aug 1 16:13:26 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Mon, 01 Aug 2011 21:13:26 -0000
Subject: [Lldb-commits] [lldb] r136649 - in /lldb/trunk/test:
benchmarks/example/TestRepeatedExprs.py lldbbench.py lldbtest.py
Message-ID: <20110801211326.5D73D2A6C12C@llvm.org>
Author: johnny
Date: Mon Aug 1 16:13:26 2011
New Revision: 136649
URL: http://llvm.org/viewvc/llvm-project?rev=136649&view=rev
Log:
Add an abstract base class called BenchBase to be inherited by benchmark tests.
Modify the example TestRepeatedExprs.py to use BenchBase, instead.
Added:
lldb/trunk/test/lldbbench.py
Modified:
lldb/trunk/test/benchmarks/example/TestRepeatedExprs.py
lldb/trunk/test/lldbtest.py
Modified: lldb/trunk/test/benchmarks/example/TestRepeatedExprs.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/benchmarks/example/TestRepeatedExprs.py?rev=136649&r1=136648&r2=136649&view=diff
==============================================================================
--- lldb/trunk/test/benchmarks/example/TestRepeatedExprs.py (original)
+++ lldb/trunk/test/benchmarks/example/TestRepeatedExprs.py Mon Aug 1 16:13:26 2011
@@ -4,9 +4,9 @@
import unittest2
import lldb
import pexpect
-from lldbtest import *
+from lldbbench import *
-class RepeatedExprssCase(TestBase):
+class RepeatedExprsCase(BenchBase):
mydir = os.path.join("benchmarks", "example")
Added: lldb/trunk/test/lldbbench.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbbench.py?rev=136649&view=auto
==============================================================================
--- lldb/trunk/test/lldbbench.py (added)
+++ lldb/trunk/test/lldbbench.py Mon Aug 1 16:13:26 2011
@@ -0,0 +1,8 @@
+import lldbtest
+from lldbtest import benchmarks_test
+
+class BenchBase(lldbtest.Base):
+ """
+ Abstract base class for benchmark tests.
+ """
+
Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=136649&r1=136648&r2=136649&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Mon Aug 1 16:13:26 2011
@@ -451,6 +451,14 @@
#import traceback
#traceback.print_stack()
+ # Assign the test method name to self.testMethodName.
+ #
+ # For an example of the use of this attribute, look at test/types dir.
+ # There are a bunch of test cases under test/types and we don't want the
+ # module cacheing subsystem to be confused with executable name "a.out"
+ # used for all the test cases.
+ self.testMethodName = self._testMethodName
+
# Python API only test is decorated with @python_api_test,
# which also sets the "__python_api_test__" attribute of the
# function object to True.
@@ -477,6 +485,16 @@
except AttributeError:
pass
+ # This is for the case of directly spawning 'lldb'/'gdb' and interacting
+ # with it using pexpect.
+ self.child = None
+ self.child_prompt = "(lldb) "
+ # If the child is interacting with the embedded script interpreter,
+ # there are two exits required during tear down, first to quit the
+ # embedded script interpreter and second to quit the lldb command
+ # interpreter.
+ self.child_in_script_interpreter = False
+
# These are for customized teardown cleanup.
self.dict = None
self.doTearDownCleanup = False
@@ -562,6 +580,21 @@
#import traceback
#traceback.print_stack()
+ # This is for the case of directly spawning 'lldb' and interacting with it
+ # using pexpect.
+ import pexpect
+ if self.child and self.child.isalive():
+ with recording(self, traceAlways) as sbuf:
+ print >> sbuf, "tearing down the child process...."
+ if self.child_in_script_interpreter:
+ self.child.sendline('quit()')
+ self.child.expect_exact(self.child_prompt)
+ self.child.sendline('quit')
+ try:
+ self.child.expect(pexpect.EOF)
+ except:
+ pass
+
# Check and run any hook functions.
for hook in reversed(self.hooks):
with recording(self, traceAlways) as sbuf:
@@ -804,14 +837,6 @@
# Works with the test driver to conditionally skip tests via decorators.
Base.setUp(self)
- # Assign the test method name to self.testMethodName.
- #
- # For an example of the use of this attribute, look at test/types dir.
- # There are a bunch of test cases under test/types and we don't want the
- # module cacheing subsystem to be confused with executable name "a.out"
- # used for all the test cases.
- self.testMethodName = self._testMethodName
-
if "LLDB_EXEC" in os.environ:
self.lldbExec = os.environ["LLDB_EXEC"]
@@ -847,15 +872,6 @@
# We want our debugger to be synchronous.
self.dbg.SetAsync(False)
- # This is for the case of directly spawning 'lldb' and interacting with
- # it using pexpect.
- self.child = None
- # If the child is interacting with the embedded script interpreter,
- # there are two exits required during tear down, first to quit the
- # embedded script interpreter and second to quit the lldb command
- # interpreter.
- self.child_in_script_interpreter = False
-
# Retrieve the associated command interpreter instance.
self.ci = self.dbg.GetCommandInterpreter()
if not self.ci:
@@ -870,21 +886,6 @@
Base.tearDown(self)
- # This is for the case of directly spawning 'lldb' and interacting with it
- # using pexpect.
- import pexpect
- if self.child and self.child.isalive():
- with recording(self, traceAlways) as sbuf:
- print >> sbuf, "tearing down the child process...."
- if self.child_in_script_interpreter:
- self.child.sendline('quit()')
- self.child.expect_exact('(lldb) ')
- self.child.sendline('quit')
- try:
- self.child.expect(pexpect.EOF)
- except:
- pass
-
# Delete the target(s) from the debugger as a general cleanup step.
# This includes terminating the process for each target, if any.
# We'd like to reuse the debugger for our next test without incurring
From johnny.chen at apple.com Mon Aug 1 16:30:30 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Mon, 01 Aug 2011 21:30:30 -0000
Subject: [Lldb-commits] [lldb] r136650 -
/lldb/trunk/test/lang/cpp/namespace/TestNamespace.py
Message-ID: <20110801213031.096FA2A6C12C@llvm.org>
Author: johnny
Date: Mon Aug 1 16:30:30 2011
New Revision: 136650
URL: http://llvm.org/viewvc/llvm-project?rev=136650&view=rev
Log:
Remove the @expectedFailure decorator as rdar://problem/8668674 is fixed.
Modified:
lldb/trunk/test/lang/cpp/namespace/TestNamespace.py
Modified: lldb/trunk/test/lang/cpp/namespace/TestNamespace.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/namespace/TestNamespace.py?rev=136650&r1=136649&r2=136650&view=diff
==============================================================================
--- lldb/trunk/test/lang/cpp/namespace/TestNamespace.py (original)
+++ lldb/trunk/test/lang/cpp/namespace/TestNamespace.py Mon Aug 1 16:30:30 2011
@@ -12,7 +12,6 @@
mydir = os.path.join("lang", "cpp", "namespace")
# rdar://problem/8668674
- @unittest2.expectedFailure
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
def test_with_dsym_and_run_command(self):
"""Test that anonymous and named namespace variables display correctly."""
@@ -20,7 +19,6 @@
self.namespace_variable_commands()
# rdar://problem/8668674
- @unittest2.expectedFailure
def test_with_dwarf_and_run_command(self):
"""Test that anonymous and named namespace variables display correctly."""
self.buildDwarf()
@@ -102,9 +100,9 @@
# rdar://problem/8668674
# expression command with fully qualified namespace for a variable does not work
- self.expect("expression -- '::i'", VARIABLES_DISPLAYED_CORRECTLY,
+ self.expect("expression -- ::i", VARIABLES_DISPLAYED_CORRECTLY,
patterns = [' = 3$'])
- self.expect("expression -- 'A::B::j'", VARIABLES_DISPLAYED_CORRECTLY,
+ self.expect("expression -- A::B::j", VARIABLES_DISPLAYED_CORRECTLY,
patterns = [' = 4$'])
From johnny.chen at apple.com Mon Aug 1 16:36:02 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Mon, 01 Aug 2011 21:36:02 -0000
Subject: [Lldb-commits] [lldb] r136651 -
/lldb/trunk/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py
Message-ID: <20110801213602.E03762A6C12C@llvm.org>
Author: johnny
Date: Mon Aug 1 16:36:02 2011
New Revision: 136651
URL: http://llvm.org/viewvc/llvm-project?rev=136651&view=rev
Log:
Remove unittest.skip() as 'rdar://problem/9691614 Expression parser crashes' is fixed.
Modified:
lldb/trunk/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py
Modified: lldb/trunk/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py?rev=136651&r1=136650&r2=136651&view=diff
==============================================================================
--- lldb/trunk/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py (original)
+++ lldb/trunk/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py Mon Aug 1 16:36:02 2011
@@ -35,7 +35,6 @@
self.main_source = "main.m"
self.line = line_number(self.main_source, '// Set breakpoint here.')
- @unittest2.skip("rdar://problem/9691614 Expression parser crashes")
def objc_method_ret_BOOL(self, exe_name):
"""Test that objective-c method returning BOOL works correctly."""
exe = os.path.join(os.getcwd(), exe_name)
From johnny.chen at apple.com Mon Aug 1 19:43:09 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Tue, 02 Aug 2011 00:43:09 -0000
Subject: [Lldb-commits] [lldb] r136664 - in /lldb/trunk/test:
benchmarks/example/Makefile benchmarks/example/TestRepeatedExprs.py
benchmarks/example/main.c benchmarks/example/main.cpp lldbbench.py
Message-ID: <20110802004309.CFD9D2A6C12C@llvm.org>
Author: johnny
Date: Mon Aug 1 19:43:09 2011
New Revision: 136664
URL: http://llvm.org/viewvc/llvm-project?rev=136664&view=rev
Log:
Add a Stopwatch utility class to lldbench.py module and initialize an instance of
Stopwatch (self.swatch) within the BenchBase's setUp() instance method to be available
to all the child classes.
Use self.swatch to measure elapsed time in TestRepeatedExprs.py, which needs to be
modified later on to actually measure repeated expression evaluations within the
context of lldb as well as gdb.
Added:
lldb/trunk/test/benchmarks/example/main.cpp
- copied, changed from r136649, lldb/trunk/test/benchmarks/example/main.c
Removed:
lldb/trunk/test/benchmarks/example/main.c
Modified:
lldb/trunk/test/benchmarks/example/Makefile
lldb/trunk/test/benchmarks/example/TestRepeatedExprs.py
lldb/trunk/test/lldbbench.py
Modified: lldb/trunk/test/benchmarks/example/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/benchmarks/example/Makefile?rev=136664&r1=136663&r2=136664&view=diff
==============================================================================
--- lldb/trunk/test/benchmarks/example/Makefile (original)
+++ lldb/trunk/test/benchmarks/example/Makefile Mon Aug 1 19:43:09 2011
@@ -1,5 +1,5 @@
LEVEL = ../../make
-C_SOURCES := main.c
+CXX_SOURCES := main.cpp
include $(LEVEL)/Makefile.rules
Modified: lldb/trunk/test/benchmarks/example/TestRepeatedExprs.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/benchmarks/example/TestRepeatedExprs.py?rev=136664&r1=136663&r2=136664&view=diff
==============================================================================
--- lldb/trunk/test/benchmarks/example/TestRepeatedExprs.py (original)
+++ lldb/trunk/test/benchmarks/example/TestRepeatedExprs.py Mon Aug 1 19:43:09 2011
@@ -23,8 +23,11 @@
self.run_gdb_repeated_exprs()
def run_lldb_repeated_exprs(self):
- print "running "+self.testMethodName
- print "benchmarks result for "+self.testMethodName
+ for i in range(1000):
+ with self.swatch:
+ print "running "+self.testMethodName
+ print "benchmarks result for "+self.testMethodName
+ print "stopwatch:", str(self.swatch)
def run_gdb_repeated_exprs(self):
print "running "+self.testMethodName
Removed: lldb/trunk/test/benchmarks/example/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/benchmarks/example/main.c?rev=136663&view=auto
==============================================================================
--- lldb/trunk/test/benchmarks/example/main.c (original)
+++ lldb/trunk/test/benchmarks/example/main.c (removed)
@@ -1,6 +0,0 @@
-#include
-
-int main(int argc, char const *argv[]) {
- printf("Hello world.\n");
- return 0;
-}
Copied: lldb/trunk/test/benchmarks/example/main.cpp (from r136649, lldb/trunk/test/benchmarks/example/main.c)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/benchmarks/example/main.cpp?p2=lldb/trunk/test/benchmarks/example/main.cpp&p1=lldb/trunk/test/benchmarks/example/main.c&r1=136649&r2=136664&rev=136664&view=diff
==============================================================================
--- lldb/trunk/test/benchmarks/example/main.c (original)
+++ lldb/trunk/test/benchmarks/example/main.cpp Mon Aug 1 19:43:09 2011
@@ -1,6 +1,43 @@
#include
+class Point {
+public:
+ int x;
+ int y;
+ Point(int a, int b):
+ x(a),
+ y(b)
+ {}
+};
+
+class Data {
+public:
+ int id;
+ Point point;
+ Data(int i):
+ id(i),
+ point(0, 0)
+ {}
+};
+
int main(int argc, char const *argv[]) {
- printf("Hello world.\n");
+ Data *data[1000];
+ Data **ptr = data;
+ for (int i = 0; i < 1000; ++i) {
+ ptr[i] = new Data(i);
+ ptr[i]->point.x = i;
+ ptr[i]->point.y = i+1;
+ }
+
+ printf("Finished populating data.\n");
+ for (int i = 0; i < 1000; ++i) {
+ bool dump = argc > 1; // Set breakpoint here.
+ // Evaluate a couple of expressions (2*1000 = 2000 exprs):
+ // expr ptr[i]->point.x
+ // expr ptr[i]->point.y
+ if (dump) {
+ printf("data[%d] = %d (%d, %d)\n", i, ptr[i]->id, ptr[i]->point.x, ptr[i]->point.y);
+ }
+ }
return 0;
}
Modified: lldb/trunk/test/lldbbench.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbbench.py?rev=136664&r1=136663&r2=136664&view=diff
==============================================================================
--- lldb/trunk/test/lldbbench.py (original)
+++ lldb/trunk/test/lldbbench.py Mon Aug 1 19:43:09 2011
@@ -1,8 +1,100 @@
-import lldbtest
+import time
from lldbtest import benchmarks_test
+from lldbtest import Base
-class BenchBase(lldbtest.Base):
+class Stopwatch(object):
+ """Stopwatch provides a simple utility to start/stop your stopwatch multiple
+ times. Each start/stop is equal to a lap, with its elapsed time accumulated
+ while measurment is in progress.
+
+ When you're ready to start from scratch for another round of measurements,
+ be sure to call the reset() method.
+
+ For example,
+
+ sw = Stopwatch()
+ for i in range(1000):
+ with sw:
+ # Do some length operations...
+ ...
+ # Get the average time.
+ avg_time = sw.avg()
+
+ # Reset the stopwatch as we are about to perform other kind of operations.
+ sw.reset()
+ ...
+ """
+
+ #############################################################
+ #
+ # Context manager interfaces to support the 'with' statement.
+ #
+ #############################################################
+
+ def __enter__(self):
+ """
+ Context management protocol on entry to the body of the with statement.
+ """
+ return self.start()
+
+ def __exit__(self, type, value, tb):
+ """
+ Context management protocol on exit from the body of the with statement.
+ """
+ self.stop()
+
+ def reset(self):
+ self.__laps__ = 0
+ self.__total_elapsed__ = 0.0
+ self.__start__ = None
+ self.__stop__ = None
+ self.__elapsed__ = 0.0
+
+ def __init__(self):
+ self.reset()
+
+ def start(self):
+ if self.__start__ is None:
+ self.__start__ = time.time()
+ else:
+ raise Exception("start() already called, did you forget to stop() first?")
+ # Return self to facilitate the context manager __enter__ protocol.
+ return self
+
+ def stop(self):
+ if self.__start__ is not None:
+ self.__stop__ = time.time()
+ elapsed = self.__stop__ - self.__start__
+ self.__total_elapsed__ += elapsed
+ self.__laps__ += 1
+ self.__start__ = None # Reset __start__ to be None again.
+ else:
+ raise Exception("stop() called without first start()?")
+
+ def laps(self):
+ """Gets the number of laps. One lap is equal to a start/stop action."""
+ return self.__laps__
+
+ def avg(self):
+ """Equal to total elapsed time divided by the number of laps."""
+ return self.__total_elapsed__ / self.__laps__
+
+ def __str__(self):
+ return "Avg: %f (Laps: %d, Total Elapsed Time: %d)" % (self.avg(),
+ self.__laps__,
+ self.__total_elapsed__)
+
+class BenchBase(Base):
"""
Abstract base class for benchmark tests.
"""
+ def setUp(self):
+ """Fixture for unittest test case setup."""
+ Base.setUp(self)
+ self.swatch = Stopwatch()
+
+ def tearDown(self):
+ """Fixture for unittest test case teardown."""
+ Base.tearDown(self)
+ del self.swatch
From johnny.chen at apple.com Mon Aug 1 19:50:55 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Tue, 02 Aug 2011 00:50:55 -0000
Subject: [Lldb-commits] [lldb] r136666 - in /lldb/trunk/test:
benchmarks/example/TestRepeatedExprs.py lldbbench.py
Message-ID: <20110802005055.574C02A6C12C@llvm.org>
Author: johnny
Date: Mon Aug 1 19:50:55 2011
New Revision: 136666
URL: http://llvm.org/viewvc/llvm-project?rev=136666&view=rev
Log:
Simple renaming: self.swatch -> self.stopwatch.
Modified:
lldb/trunk/test/benchmarks/example/TestRepeatedExprs.py
lldb/trunk/test/lldbbench.py
Modified: lldb/trunk/test/benchmarks/example/TestRepeatedExprs.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/benchmarks/example/TestRepeatedExprs.py?rev=136666&r1=136665&r2=136666&view=diff
==============================================================================
--- lldb/trunk/test/benchmarks/example/TestRepeatedExprs.py (original)
+++ lldb/trunk/test/benchmarks/example/TestRepeatedExprs.py Mon Aug 1 19:50:55 2011
@@ -24,10 +24,10 @@
def run_lldb_repeated_exprs(self):
for i in range(1000):
- with self.swatch:
+ with self.stopwatch:
print "running "+self.testMethodName
print "benchmarks result for "+self.testMethodName
- print "stopwatch:", str(self.swatch)
+ print "stopwatch:", str(self.stopwatch)
def run_gdb_repeated_exprs(self):
print "running "+self.testMethodName
Modified: lldb/trunk/test/lldbbench.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbbench.py?rev=136666&r1=136665&r2=136666&view=diff
==============================================================================
--- lldb/trunk/test/lldbbench.py (original)
+++ lldb/trunk/test/lldbbench.py Mon Aug 1 19:50:55 2011
@@ -91,10 +91,10 @@
def setUp(self):
"""Fixture for unittest test case setup."""
Base.setUp(self)
- self.swatch = Stopwatch()
+ self.stopwatch = Stopwatch()
def tearDown(self):
"""Fixture for unittest test case teardown."""
Base.tearDown(self)
- del self.swatch
+ del self.stopwatch
From granata.enrico at gmail.com Tue Aug 2 12:27:39 2011
From: granata.enrico at gmail.com (Enrico Granata)
Date: Tue, 02 Aug 2011 17:27:39 -0000
Subject: [Lldb-commits] [lldb] r136695 - in /lldb/trunk: include/lldb/
include/lldb/Core/ include/lldb/Symbol/ include/lldb/Target/
source/Commands/ source/Core/
source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/ source/Symbol/
test/functionalities/data-formatter/data-formatter-categories/
test/functionalities/data-formatter/data-formatter-objc/
Message-ID: <20110802172740.1BBB12A6C12C@llvm.org>
Author: enrico
Date: Tue Aug 2 12:27:39 2011
New Revision: 136695
URL: http://llvm.org/viewvc/llvm-project?rev=136695&view=rev
Log:
Fixed a bug where a variable could not be formatted in a summary if its datatype already had a custom format
Fixed a bug where Objective-C variables coming out of the expression parser could crash the Python synthetic providers:
- expression parser output has a "frozen data" component, which is a byte-exact copy of the value (in host memory),
if trying to read into memory based on the host address, LLDB would crash. we are now passing the correct (target)
pointer to the Python code
Objective-C "id" variables are now formatted according to their dynamic type, if the -d option to frame variable is used:
- Code based on the Objective-C 2.0 runtime is used to obtain this information without running code on the target
Modified:
lldb/trunk/include/lldb/Core/Debugger.h
lldb/trunk/include/lldb/Core/FormatManager.h
lldb/trunk/include/lldb/Core/ValueObject.h
lldb/trunk/include/lldb/Symbol/ClangASTType.h
lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h
lldb/trunk/include/lldb/lldb-enumerations.h
lldb/trunk/source/Commands/CommandObjectExpression.cpp
lldb/trunk/source/Core/Debugger.cpp
lldb/trunk/source/Core/FormatClasses.cpp
lldb/trunk/source/Core/ValueObject.cpp
lldb/trunk/source/Core/ValueObjectChild.cpp
lldb/trunk/source/Core/ValueObjectDynamicValue.cpp
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
lldb/trunk/source/Symbol/ClangASTType.cpp
lldb/trunk/test/functionalities/data-formatter/data-formatter-categories/TestDataFormatterCategories.py
lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/main.m
Modified: lldb/trunk/include/lldb/Core/Debugger.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Debugger.h?rev=136695&r1=136694&r2=136695&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Debugger.h (original)
+++ lldb/trunk/include/lldb/Core/Debugger.h Tue Aug 2 12:27:39 2011
@@ -486,7 +486,7 @@
{
public:
static bool
- Get(ValueObject& vobj, ValueFormat::SharedPointer &entry);
+ Get(ValueObject& vobj, lldb::DynamicValueType use_dynamic, ValueFormat::SharedPointer &entry);
static void
Add(const ConstString &type, const ValueFormat::SharedPointer &entry);
@@ -509,9 +509,11 @@
static bool
GetSummaryFormat(ValueObject& vobj,
+ lldb::DynamicValueType use_dynamic,
lldb::SummaryFormatSP& entry);
static bool
GetSyntheticFilter(ValueObject& vobj,
+ lldb::DynamicValueType use_dynamic,
lldb::SyntheticChildrenSP& entry);
class NamedSummaryFormats
Modified: lldb/trunk/include/lldb/Core/FormatManager.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/FormatManager.h?rev=136695&r1=136694&r2=136695&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/FormatManager.h (original)
+++ lldb/trunk/include/lldb/Core/FormatManager.h Tue Aug 2 12:27:39 2011
@@ -55,7 +55,9 @@
#include "lldb/Core/ValueObject.h"
#include "lldb/Interpreter/ScriptInterpreterPython.h"
#include "lldb/Target/ExecutionContext.h"
+#include "lldb/Target/ObjCLanguageRuntime.h"
#include "lldb/Target/Platform.h"
+#include "lldb/Target/Process.h"
#include "lldb/Target/StackFrame.h"
#include "lldb/Target/TargetList.h"
@@ -189,6 +191,8 @@
typedef FormatMap BackEndType;
BackEndType m_format_map;
+
+ std::string m_name;
public:
typedef typename BackEndType::MapType MapType;
@@ -201,8 +205,10 @@
friend class FormatCategory;
- FormatNavigator(IFormatChangeListener* lst = NULL) :
- m_format_map(lst)
+ FormatNavigator(std::string name,
+ IFormatChangeListener* lst = NULL) :
+ m_format_map(lst),
+ m_name(name)
{
}
@@ -223,11 +229,12 @@
bool
Get(ValueObject& vobj,
MapValueType& entry,
+ lldb::DynamicValueType use_dynamic,
uint32_t* why = NULL)
{
uint32_t value = lldb::eFormatterChoiceCriterionDirectChoice;
clang::QualType type = clang::QualType::getFromOpaquePtr(vobj.GetClangType());
- bool ret = Get(vobj, type, entry, value);
+ bool ret = Get(vobj, type, entry, use_dynamic, value);
if (ret)
entry = MapValueType(entry);
else
@@ -267,9 +274,64 @@
return m_format_map.Get(type, entry);
}
+ bool Get_ObjC(ValueObject& vobj,
+ ObjCLanguageRuntime::ObjCISA isa,
+ MapValueType& entry,
+ uint32_t& reason)
+ {
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
+ if (log)
+ log->Printf("going to an Objective-C dynamic scanning");
+ Process* process = vobj.GetUpdatePoint().GetProcessSP().get();
+ ObjCLanguageRuntime* runtime = process->GetObjCLanguageRuntime();
+ if (runtime == NULL)
+ {
+ if (log)
+ log->Printf("no valid ObjC runtime, bailing out");
+ return false;
+ }
+ if (runtime->IsValidISA(isa) == false)
+ {
+ if (log)
+ log->Printf("invalid ISA, bailing out");
+ return false;
+ }
+ ConstString name = runtime->GetActualTypeName(isa);
+ if (log)
+ log->Printf("looking for formatter for %s", name.GetCString());
+ if (Get(name.GetCString(), entry))
+ {
+ if (log)
+ log->Printf("direct match found, returning");
+ return true;
+ }
+ if (log)
+ log->Printf("no direct match");
+ ObjCLanguageRuntime::ObjCISA parent = runtime->GetParentClass(isa);
+ if (runtime->IsValidISA(parent) == false)
+ {
+ if (log)
+ log->Printf("invalid parent ISA, bailing out");
+ return false;
+ }
+ if (parent == isa)
+ {
+ if (log)
+ log->Printf("parent-child loop, bailing out");
+ return false;
+ }
+ if (Get_ObjC(vobj, parent, entry, reason))
+ {
+ reason |= lldb::eFormatterChoiceCriterionNavigatedBaseClasses;
+ return true;
+ }
+ return false;
+ }
+
bool Get(ValueObject& vobj,
clang::QualType type,
MapValueType& entry,
+ lldb::DynamicValueType use_dynamic,
uint32_t& reason)
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
@@ -299,7 +361,10 @@
log->Printf("appended bitfield info, final result is %s", name.GetCString());
}
if (log)
- log->Printf("trying to get format for VO name %s of type %s",vobj.GetName().AsCString(),name.AsCString());
+ log->Printf("trying to get %s for VO name %s of type %s",
+ m_name.c_str(),
+ vobj.GetName().AsCString(),
+ name.AsCString());
if (Get(name.GetCString(), entry))
{
if (log)
@@ -313,17 +378,48 @@
{
if (log)
log->Printf("stripping reference");
- if (Get(vobj,type.getNonReferenceType(),entry, reason) && !entry->m_skip_references)
+ if (Get(vobj,type.getNonReferenceType(),entry, use_dynamic, reason) && !entry->m_skip_references)
{
reason |= lldb::eFormatterChoiceCriterionStrippedPointerReference;
return true;
}
}
+ if (use_dynamic != lldb::eNoDynamicValues &&
+ typePtr == vobj.GetClangAST()->ObjCBuiltinIdTy.getTypePtr())
+ {
+ if (log)
+ log->Printf("this is an ObjC 'id', let's do dynamic search");
+ Process* process = vobj.GetUpdatePoint().GetProcessSP().get();
+ ObjCLanguageRuntime* runtime = process->GetObjCLanguageRuntime();
+ if (runtime == NULL)
+ {
+ if (log)
+ log->Printf("no valid ObjC runtime, skipping dynamic");
+ }
+ else
+ {
+ if (Get_ObjC(vobj, runtime->GetISA(vobj), entry, reason))
+ {
+ reason |= lldb::eFormatterChoiceCriterionDynamicObjCHierarchy;
+ return true;
+ }
+ }
+ }
+ else if (use_dynamic != lldb::eNoDynamicValues && log)
+ {
+ log->Printf("typename: %s, typePtr = %p, id = %p",
+ name.AsCString(), typePtr, vobj.GetClangAST()->ObjCBuiltinIdTy.getTypePtr());
+ }
+ else if (log)
+ {
+ log->Printf("no dynamic");
+ }
if (typePtr->isPointerType())
{
if (log)
log->Printf("stripping pointer");
- if (Get(vobj, typePtr->getPointeeType(), entry, reason) && !entry->m_skip_pointers)
+ clang::QualType pointee = typePtr->getPointeeType();
+ if (Get(vobj, pointee, entry, use_dynamic, reason) && !entry->m_skip_pointers)
{
reason |= lldb::eFormatterChoiceCriterionStrippedPointerReference;
return true;
@@ -331,6 +427,27 @@
}
if (typePtr->isObjCObjectPointerType())
{
+ if (use_dynamic != lldb::eNoDynamicValues &&
+ name.GetCString() == ConstString("id").GetCString())
+ {
+ if (log)
+ log->Printf("this is an ObjC 'id', let's do dynamic search");
+ Process* process = vobj.GetUpdatePoint().GetProcessSP().get();
+ ObjCLanguageRuntime* runtime = process->GetObjCLanguageRuntime();
+ if (runtime == NULL)
+ {
+ if (log)
+ log->Printf("no valid ObjC runtime, skipping dynamic");
+ }
+ else
+ {
+ if (Get_ObjC(vobj, runtime->GetISA(vobj), entry, reason))
+ {
+ reason |= lldb::eFormatterChoiceCriterionDynamicObjCHierarchy;
+ return true;
+ }
+ }
+ }
if (log)
log->Printf("stripping ObjC pointer");
/*
@@ -343,7 +460,7 @@
ValueObject* target = vobj.Dereference(error).get();
if (error.Fail() || !target)
return false;
- if (Get(*target, typePtr->getPointeeType(), entry, reason) && !entry->m_skip_pointers)
+ if (Get(*target, typePtr->getPointeeType(), entry, use_dynamic, reason) && !entry->m_skip_pointers)
{
reason |= lldb::eFormatterChoiceCriterionStrippedPointerReference;
return true;
@@ -368,7 +485,7 @@
if (log)
log->Printf("got a parent class for this ObjC class");
clang::QualType ivar_qual_type(ast->getObjCInterfaceType(superclass_interface_decl));
- if (Get(vobj, ivar_qual_type, entry, reason) && entry->m_cascades)
+ if (Get(vobj, ivar_qual_type, entry, use_dynamic, reason) && entry->m_cascades)
{
reason |= lldb::eFormatterChoiceCriterionNavigatedBaseClasses;
return true;
@@ -397,7 +514,7 @@
end = record->bases_end();
for (pos = record->bases_begin(); pos != end; pos++)
{
- if ((Get(vobj, pos->getType(), entry, reason)) && entry->m_cascades)
+ if ((Get(vobj, pos->getType(), entry, use_dynamic, reason)) && entry->m_cascades)
{
reason |= lldb::eFormatterChoiceCriterionNavigatedBaseClasses;
return true;
@@ -411,7 +528,7 @@
end = record->vbases_end();
for (pos = record->vbases_begin(); pos != end; pos++)
{
- if ((Get(vobj, pos->getType(), entry, reason)) && entry->m_cascades)
+ if ((Get(vobj, pos->getType(), entry, use_dynamic, reason)) && entry->m_cascades)
{
reason |= lldb::eFormatterChoiceCriterionNavigatedBaseClasses;
return true;
@@ -427,7 +544,7 @@
{
if (log)
log->Printf("stripping typedef");
- if ((Get(vobj, type_tdef->getDecl()->getUnderlyingType(), entry, reason)) && entry->m_cascades)
+ if ((Get(vobj, type_tdef->getDecl()->getUnderlyingType(), entry, use_dynamic, reason)) && entry->m_cascades)
{
reason |= lldb::eFormatterChoiceCriterionNavigatedTypedefs;
return true;
@@ -495,9 +612,9 @@
FormatCategory(IFormatChangeListener* clist,
std::string name) :
- m_summary_nav(new SummaryNavigator(clist)),
- m_regex_summary_nav(new RegexSummaryNavigator(clist)),
- m_filter_nav(new FilterNavigator(clist)),
+ m_summary_nav(new SummaryNavigator("summary",clist)),
+ m_regex_summary_nav(new RegexSummaryNavigator("regex-summary",clist)),
+ m_filter_nav(new FilterNavigator("filter",clist)),
m_enabled(false),
m_change_listener(clist),
m_mutex(Mutex::eMutexTypeRecursive),
@@ -531,13 +648,14 @@
bool
Get(ValueObject& vobj,
lldb::SummaryFormatSP& entry,
+ lldb::DynamicValueType use_dynamic,
uint32_t* reason = NULL)
{
if (!IsEnabled())
return false;
- if (Summary()->Get(vobj, entry, reason))
+ if (Summary()->Get(vobj, entry, use_dynamic, reason))
return true;
- bool regex = RegexSummary()->Get(vobj, entry, reason);
+ bool regex = RegexSummary()->Get(vobj, entry, use_dynamic, reason);
if (regex && reason)
*reason |= lldb::eFormatterChoiceCriterionRegularExpressionSummary;
return regex;
@@ -546,11 +664,12 @@
bool
Get(ValueObject& vobj,
lldb::SyntheticChildrenSP& entry,
+ lldb::DynamicValueType use_dynamic,
uint32_t* reason = NULL)
{
if (!IsEnabled())
return false;
- return (Filter()->Get(vobj, entry, reason));
+ return (Filter()->Get(vobj, entry, use_dynamic, reason));
}
// just a shortcut for Summary()->Clear; RegexSummary()->Clear()
@@ -760,43 +879,44 @@
bool
Get(ValueObject& vobj,
- lldb::SummaryFormatSP& entry)
+ lldb::SummaryFormatSP& entry,
+ lldb::DynamicValueType use_dynamic)
{
Mutex::Locker(m_map_mutex);
- uint32_t reason_why;
- bool first = true;
-
+ uint32_t reason_why;
ActiveCategoriesIterator begin, end = m_active_categories.end();
for (begin = m_active_categories.begin(); begin != end; begin++)
{
FormatCategory::SharedPointer category = *begin;
lldb::SummaryFormatSP current_format;
- if (!category->Get(vobj, current_format, &reason_why))
+ if (!category->Get(vobj, current_format, use_dynamic, &reason_why))
continue;
- if (reason_why == lldb::eFormatterChoiceCriterionDirectChoice)
- {
- entry = current_format;
- return true;
- }
- else if (first)
- {
- entry = current_format;
- first = false;
- }
+ /*if (reason_why == lldb::eFormatterChoiceCriterionDirectChoice)
+ {
+ entry = current_format;
+ return true;
+ }
+ else if (first)
+ {
+ entry = current_format;
+ first = false;
+ }*/
+ entry = current_format;
+ return true;
}
- return !first;
+ return false;
}
bool
Get(ValueObject& vobj,
- lldb::SyntheticChildrenSP& entry)
+ lldb::SyntheticChildrenSP& entry,
+ lldb::DynamicValueType use_dynamic)
{
Mutex::Locker(m_map_mutex);
uint32_t reason_why;
- bool first = true;
ActiveCategoriesIterator begin, end = m_active_categories.end();
@@ -804,9 +924,9 @@
{
FormatCategory::SharedPointer category = *begin;
lldb::SyntheticChildrenSP current_format;
- if (!category->Get(vobj, current_format, &reason_why))
+ if (!category->Get(vobj, current_format, use_dynamic, &reason_why))
continue;
- if (reason_why == lldb::eFormatterChoiceCriterionDirectChoice)
+ /*if (reason_why == lldb::eFormatterChoiceCriterionDirectChoice)
{
entry = current_format;
return true;
@@ -815,9 +935,11 @@
{
entry = current_format;
first = false;
- }
+ }*/
+ entry = current_format;
+ return true;
}
- return !first;
+ return false;
}
};
@@ -847,7 +969,7 @@
typedef bool (*CategoryCallback)(void*, const char*, const FormatCategory::SharedPointer&);
FormatManager() :
- m_value_nav(this),
+ m_value_nav("format",this),
m_named_summaries_map(this),
m_last_revision(0),
m_categories_map(this)
@@ -941,15 +1063,17 @@
bool
Get(ValueObject& vobj,
- lldb::SummaryFormatSP& entry)
+ lldb::SummaryFormatSP& entry,
+ lldb::DynamicValueType use_dynamic)
{
- return m_categories_map.Get(vobj, entry);
+ return m_categories_map.Get(vobj, entry, use_dynamic);
}
bool
Get(ValueObject& vobj,
- lldb::SyntheticChildrenSP& entry)
+ lldb::SyntheticChildrenSP& entry,
+ lldb::DynamicValueType use_dynamic)
{
- return m_categories_map.Get(vobj, entry);
+ return m_categories_map.Get(vobj, entry, use_dynamic);
}
static bool
Modified: lldb/trunk/include/lldb/Core/ValueObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObject.h?rev=136695&r1=136694&r2=136695&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ValueObject.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObject.h Tue Aug 2 12:27:39 2011
@@ -443,6 +443,9 @@
virtual const char *
GetValueAsCString ();
+
+ virtual unsigned long long
+ GetValueAsUnsigned();
virtual bool
SetValueFromCString (const char *value_str);
@@ -513,8 +516,11 @@
bool
UpdateValueIfNeeded (bool update_format = true);
+ bool
+ UpdateValueIfNeeded (lldb::DynamicValueType use_dynamic, bool update_format = true);
+
void
- UpdateFormatsIfNeeded();
+ UpdateFormatsIfNeeded(lldb::DynamicValueType use_dynamic = lldb::eNoDynamicValues);
DataExtractor &
GetDataExtractor ();
@@ -640,6 +646,18 @@
}
void
+ SetIsExpressionResult(bool expr)
+ {
+ m_is_expression_result = expr;
+ }
+
+ bool
+ GetIsExpressionResult()
+ {
+ return m_is_expression_result;
+ }
+
+ void
SetFormat (lldb::Format format)
{
if (format != m_format)
@@ -677,7 +695,7 @@
lldb::SummaryFormatSP
GetSummaryFormat()
{
- UpdateFormatsIfNeeded();
+ UpdateFormatsIfNeeded(m_last_format_mgr_dynamic);
if (HasCustomSummaryFormat())
return m_forced_summary_format;
return m_last_summary_format;
@@ -744,6 +762,7 @@
lldb::Format m_format;
uint32_t m_last_format_mgr_revision;
+ lldb::DynamicValueType m_last_format_mgr_dynamic;
lldb::SummaryFormatSP m_last_summary_format;
lldb::SummaryFormatSP m_forced_summary_format;
lldb::ValueFormatSP m_last_value_format;
@@ -759,7 +778,8 @@
m_is_array_item_for_pointer:1,
m_is_bitfield_for_scalar:1,
m_is_expression_path_child:1,
- m_is_child_at_offset:1;
+ m_is_child_at_offset:1,
+ m_is_expression_result:1;
// used to prevent endless looping into GetpPrintableRepresentation()
uint32_t m_dump_printable_counter;
Modified: lldb/trunk/include/lldb/Symbol/ClangASTType.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTType.h?rev=136695&r1=136694&r2=136695&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangASTType.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTType.h Tue Aug 2 12:27:39 2011
@@ -98,7 +98,8 @@
GetMinimumLanguage ();
static lldb::LanguageType
- GetMinimumLanguage (lldb::clang_type_t clang_type);
+ GetMinimumLanguage (clang::ASTContext *ctx,
+ lldb::clang_type_t clang_type);
void
DumpValue (ExecutionContext *exe_ctx,
Modified: lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h?rev=136695&r1=136694&r2=136695&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h (original)
+++ lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h Tue Aug 2 12:27:39 2011
@@ -72,6 +72,20 @@
{
return eObjC_VersionUnknown;
}
+
+ typedef lldb::addr_t ObjCISA;
+
+ virtual bool
+ IsValidISA(ObjCISA isa) = 0;
+
+ virtual ObjCISA
+ GetISA(ValueObject& valobj) = 0;
+
+ virtual ConstString
+ GetActualTypeName(ObjCISA isa) = 0;
+
+ virtual ObjCISA
+ GetParentClass(ObjCISA isa) = 0;
// Finds the byte offset of the child_type ivar in parent_type. If it can't find the
// offset, returns LLDB_INVALID_IVAR_OFFSET.
Modified: lldb/trunk/include/lldb/lldb-enumerations.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-enumerations.h?rev=136695&r1=136694&r2=136695&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-enumerations.h (original)
+++ lldb/trunk/include/lldb/lldb-enumerations.h Tue Aug 2 12:27:39 2011
@@ -505,7 +505,8 @@
eFormatterChoiceCriterionStrippedPointerReference = 0x00000001,
eFormatterChoiceCriterionNavigatedTypedefs = 0x00000002,
eFormatterChoiceCriterionNavigatedBaseClasses = 0x00000004,
- eFormatterChoiceCriterionRegularExpressionSummary = 0x00000008
+ eFormatterChoiceCriterionRegularExpressionSummary = 0x00000008,
+ eFormatterChoiceCriterionDynamicObjCHierarchy = 0x00000010
} FormatterChoiceCriterion;
//----------------------------------------------------------------------
Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.cpp?rev=136695&r1=136694&r2=136695&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectExpression.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectExpression.cpp Tue Aug 2 12:27:39 2011
@@ -321,6 +321,9 @@
{
if (result_valobj_sp->GetError().Success())
{
+
+ result_valobj_sp.get()->SetIsExpressionResult(true);
+
if (m_options.format != eFormatDefault)
result_valobj_sp->SetFormat (m_options.format);
Modified: lldb/trunk/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=136695&r1=136694&r2=136695&view=diff
==============================================================================
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Tue Aug 2 12:27:39 2011
@@ -1010,22 +1010,35 @@
if (!vobj)
break;
+ if (log)
+ log->Printf("initial string: %s",var_name_begin);
+
// check for *var and *svar
if (*var_name_begin == '*')
{
do_deref_pointer = true;
var_name_begin++;
}
+
+ if (log)
+ log->Printf("initial string: %s",var_name_begin);
+
if (*var_name_begin == 's')
{
vobj = vobj->GetSyntheticValue(lldb::eUseSyntheticFilter).get();
var_name_begin++;
}
+ if (log)
+ log->Printf("initial string: %s",var_name_begin);
+
// should be a 'v' by now
if (*var_name_begin != 'v')
break;
+ if (log)
+ log->Printf("initial string: %s",var_name_begin);
+
ValueObject::ExpressionPathAftermath what_next = (do_deref_pointer ?
ValueObject::eDereference : ValueObject::eNothing);
ValueObject::GetValueForExpressionPathOptions options;
@@ -1765,9 +1778,9 @@
}
bool
-Debugger::Formatting::ValueFormats::Get(ValueObject& vobj, ValueFormat::SharedPointer &entry)
+Debugger::Formatting::ValueFormats::Get(ValueObject& vobj, lldb::DynamicValueType use_dynamic, ValueFormat::SharedPointer &entry)
{
- return GetFormatManager().Value().Get(vobj,entry);
+ return GetFormatManager().Value().Get(vobj,entry, use_dynamic);
}
void
@@ -1808,15 +1821,17 @@
bool
Debugger::Formatting::GetSummaryFormat(ValueObject& vobj,
+ lldb::DynamicValueType use_dynamic,
lldb::SummaryFormatSP& entry)
{
- return GetFormatManager().Get(vobj, entry);
+ return GetFormatManager().Get(vobj, entry, use_dynamic);
}
bool
Debugger::Formatting::GetSyntheticFilter(ValueObject& vobj,
+ lldb::DynamicValueType use_dynamic,
lldb::SyntheticChildrenSP& entry)
{
- return GetFormatManager().Get(vobj, entry);
+ return GetFormatManager().Get(vobj, entry, use_dynamic);
}
bool
Modified: lldb/trunk/source/Core/FormatClasses.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/FormatClasses.cpp?rev=136695&r1=136694&r2=136695&view=diff
==============================================================================
--- lldb/trunk/source/Core/FormatClasses.cpp (original)
+++ lldb/trunk/source/Core/FormatClasses.cpp Tue Aug 2 12:27:39 2011
@@ -21,6 +21,7 @@
#include "lldb/Core/Debugger.h"
#include "lldb/Core/FormatClasses.h"
#include "lldb/Core/StreamString.h"
+#include "lldb/Core/ValueObjectConstResult.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Symbol/ClangASTType.h"
#include "lldb/Target/StackFrame.h"
@@ -121,8 +122,29 @@
std::string
ScriptSummaryFormat::FormatObject(lldb::ValueObjectSP object)
{
+ lldb::ValueObjectSP target_object;
+ if (object->GetIsExpressionResult() &&
+ ClangASTContext::IsPointerType(object->GetClangType()) &&
+ object->GetValue().GetValueType() == Value::eValueTypeHostAddress)
+ {
+ // when using the expression parser, an additional layer of "frozen data"
+ // can be created, which is basically a byte-exact copy of the data returned
+ // by the expression, but in host memory. because Python code might need to read
+ // into the object memory in non-obvious ways, we need to hand it the target version
+ // of the expression output
+ lldb::addr_t tgt_address = object->GetValueAsUnsigned();
+ target_object = ValueObjectConstResult::Create (object->GetExecutionContextScope(),
+ object->GetClangAST(),
+ object->GetClangType(),
+ object->GetName(),
+ tgt_address,
+ eAddressTypeLoad,
+ object->GetUpdatePoint().GetProcessSP()->GetAddressByteSize());
+ }
+ else
+ target_object = object;
return std::string(ScriptInterpreterPython::CallPythonScriptFunction(m_function_name.c_str(),
- object).c_str());
+ target_object).c_str());
}
std::string
@@ -171,7 +193,26 @@
return;
}
- m_interpreter = be->GetUpdatePoint().GetTargetSP()->GetDebugger().GetCommandInterpreter().GetScriptInterpreter();
+ if (be->GetIsExpressionResult() &&
+ ClangASTContext::IsPointerType(be->GetClangType()) &&
+ be->GetValue().GetValueType() == Value::eValueTypeHostAddress)
+ {
+ // when using the expression parser, an additional layer of "frozen data"
+ // can be created, which is basically a byte-exact copy of the data returned
+ // by the expression, but in host memory. because Python code might need to read
+ // into the object memory in non-obvious ways, we need to hand it the target version
+ // of the expression output
+ lldb::addr_t tgt_address = be->GetValueAsUnsigned();
+ m_backend = ValueObjectConstResult::Create (be->GetExecutionContextScope(),
+ be->GetClangAST(),
+ be->GetClangType(),
+ be->GetName(),
+ tgt_address,
+ eAddressTypeLoad,
+ be->GetUpdatePoint().GetProcessSP()->GetAddressByteSize());
+ }
+
+ m_interpreter = m_backend->GetUpdatePoint().GetTargetSP()->GetDebugger().GetCommandInterpreter().GetScriptInterpreter();
if (m_interpreter == NULL)
m_wrapper = NULL;
Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=136695&r1=136694&r2=136695&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Tue Aug 2 12:27:39 2011
@@ -39,6 +39,7 @@
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/LanguageRuntime.h"
+#include "lldb/Target/ObjCLanguageRuntime.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/RegisterContext.h"
#include "lldb/Target/Target.h"
@@ -76,6 +77,7 @@
m_deref_valobj(NULL),
m_format (eFormatDefault),
m_last_format_mgr_revision(0),
+ m_last_format_mgr_dynamic(lldb::eNoDynamicValues),
m_last_summary_format(),
m_forced_summary_format(),
m_last_value_format(),
@@ -91,6 +93,7 @@
m_is_bitfield_for_scalar(false),
m_is_expression_path_child(false),
m_is_child_at_offset(false),
+ m_is_expression_result(false),
m_dump_printable_counter(0)
{
m_manager->ManageObject(this);
@@ -120,6 +123,7 @@
m_deref_valobj(NULL),
m_format (eFormatDefault),
m_last_format_mgr_revision(0),
+ m_last_format_mgr_dynamic(lldb::eNoDynamicValues),
m_last_summary_format(),
m_forced_summary_format(),
m_last_value_format(),
@@ -135,6 +139,7 @@
m_is_bitfield_for_scalar(false),
m_is_expression_path_child(false),
m_is_child_at_offset(false),
+ m_is_expression_result(false),
m_dump_printable_counter(0)
{
m_manager = new ValueObjectManager();
@@ -151,9 +156,15 @@
bool
ValueObject::UpdateValueIfNeeded (bool update_format)
{
+ return UpdateValueIfNeeded(m_last_format_mgr_dynamic, update_format);
+}
+
+bool
+ValueObject::UpdateValueIfNeeded (lldb::DynamicValueType use_dynamic, bool update_format)
+{
if (update_format)
- UpdateFormatsIfNeeded();
+ UpdateFormatsIfNeeded(use_dynamic);
// If this is a constant value, then our success is predicated on whether
// we have an error or not
@@ -204,7 +215,7 @@
}
void
-ValueObject::UpdateFormatsIfNeeded()
+ValueObject::UpdateFormatsIfNeeded(lldb::DynamicValueType use_dynamic)
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
if (log)
@@ -217,7 +228,8 @@
ClearCustomSummaryFormat();
m_summary_str.clear();
}
- if (m_last_format_mgr_revision != Debugger::Formatting::ValueFormats::GetCurrentRevision())
+ if ( (m_last_format_mgr_revision != Debugger::Formatting::ValueFormats::GetCurrentRevision()) ||
+ m_last_format_mgr_dynamic != use_dynamic)
{
if (m_last_summary_format.get())
m_last_summary_format.reset((StringSummaryFormat*)NULL);
@@ -228,11 +240,12 @@
m_synthetic_value = NULL;
- Debugger::Formatting::ValueFormats::Get(*this, m_last_value_format);
- Debugger::Formatting::GetSummaryFormat(*this, m_last_summary_format);
- Debugger::Formatting::GetSyntheticFilter(*this, m_last_synthetic_filter);
+ Debugger::Formatting::ValueFormats::Get(*this, use_dynamic, m_last_value_format);
+ Debugger::Formatting::GetSummaryFormat(*this, use_dynamic, m_last_summary_format);
+ Debugger::Formatting::GetSyntheticFilter(*this, use_dynamic, m_last_synthetic_filter);
m_last_format_mgr_revision = Debugger::Formatting::ValueFormats::GetCurrentRevision();
+ m_last_format_mgr_dynamic = use_dynamic;
ClearUserVisibleData();
}
@@ -241,14 +254,14 @@
DataExtractor &
ValueObject::GetDataExtractor ()
{
- UpdateValueIfNeeded();
+ UpdateValueIfNeeded(false);
return m_data;
}
const Error &
ValueObject::GetError()
{
- UpdateValueIfNeeded();
+ UpdateValueIfNeeded(false);
return m_error;
}
@@ -261,7 +274,7 @@
const char *
ValueObject::GetLocationAsCString ()
{
- if (UpdateValueIfNeeded())
+ if (UpdateValueIfNeeded(false))
{
if (m_location_str.empty())
{
@@ -358,7 +371,7 @@
ValueObjectSP child_sp;
// We may need to update our value if we are dynamic
if (IsPossibleDynamicType ())
- UpdateValueIfNeeded();
+ UpdateValueIfNeeded(false);
if (idx < GetNumChildren())
{
// Check if we have already made the child value object?
@@ -395,7 +408,7 @@
// We may need to update our value if we are dynamic
if (IsPossibleDynamicType ())
- UpdateValueIfNeeded();
+ UpdateValueIfNeeded(false);
std::vector child_indexes;
clang::ASTContext *clang_ast = GetClangAST();
@@ -519,7 +532,7 @@
const char *
ValueObject::GetSummaryAsCString ()
{
- if (UpdateValueIfNeeded ())
+ if (UpdateValueIfNeeded (m_last_format_mgr_dynamic, true))
{
if (m_summary_str.empty())
{
@@ -775,7 +788,7 @@
ValueObject::GetObjectDescription ()
{
- if (!UpdateValueIfNeeded ())
+ if (!UpdateValueIfNeeded (m_last_format_mgr_dynamic, true))
return NULL;
if (!m_object_desc_str.empty())
@@ -826,7 +839,7 @@
// If our byte size is zero this is an aggregate type that has children
if (ClangASTContext::IsAggregateType (GetClangType()) == false)
{
- if (UpdateValueIfNeeded())
+ if (UpdateValueIfNeeded(true))
{
if (m_value_str.empty())
{
@@ -841,7 +854,7 @@
clang_type_t clang_type = GetClangType ();
if (clang_type)
{
- if (m_last_value_format)
+ if (m_format == lldb::eFormatDefault && m_last_value_format)
{
m_value_str = m_last_value_format->FormatObject(GetSP());
}
@@ -905,6 +918,24 @@
return m_value_str.c_str();
}
+// if > 8bytes, 0 is returned. this method should mostly be used
+// to read address values out of pointers
+unsigned long long
+ValueObject::GetValueAsUnsigned()
+{
+ // If our byte size is zero this is an aggregate type that has children
+ if (ClangASTContext::IsAggregateType (GetClangType()) == false)
+ {
+ if (UpdateValueIfNeeded(true))
+ {
+ uint32_t offset = 0;
+ return m_data.GetMaxU64(&offset,
+ m_data.GetByteSize());
+ }
+ }
+ return 0;
+}
+
// this call should only return pointers to data that needs no special memory management
// (either because they are hardcoded strings, or because they are backed by some other
// object); returning any new()-ed or malloc()-ed data here, will lead to leaks!
@@ -1092,7 +1123,7 @@
addr_t
ValueObject::GetAddressOf (AddressType &address_type, bool scalar_is_load_address)
{
- if (!UpdateValueIfNeeded())
+ if (!UpdateValueIfNeeded(false))
return LLDB_INVALID_ADDRESS;
switch (m_value.GetValueType())
@@ -1124,7 +1155,7 @@
lldb::addr_t address = LLDB_INVALID_ADDRESS;
address_type = eAddressTypeInvalid;
- if (!UpdateValueIfNeeded())
+ if (!UpdateValueIfNeeded(false))
return address;
switch (m_value.GetValueType())
@@ -1161,7 +1192,7 @@
{
// Make sure our value is up to date first so that our location and location
// type is valid.
- if (!UpdateValueIfNeeded())
+ if (!UpdateValueIfNeeded(false))
return false;
uint32_t count = 0;
@@ -1256,7 +1287,8 @@
lldb::LanguageType
ValueObject::GetObjectRuntimeLanguage ()
{
- return ClangASTType::GetMinimumLanguage (GetClangType());
+ return ClangASTType::GetMinimumLanguage (GetClangAST(),
+ GetClangType());
}
void
@@ -1521,7 +1553,7 @@
if (use_synthetic == lldb::eNoSyntheticFilter)
return;
- UpdateFormatsIfNeeded();
+ UpdateFormatsIfNeeded(m_last_format_mgr_dynamic);
if (m_last_synthetic_filter.get() == NULL)
return;
@@ -1601,7 +1633,7 @@
if (use_synthetic == lldb::eNoSyntheticFilter)
return GetSP();
- UpdateFormatsIfNeeded();
+ UpdateFormatsIfNeeded(m_last_format_mgr_dynamic);
if (m_last_synthetic_filter.get() == NULL)
return GetSP();
@@ -2537,7 +2569,7 @@
{
if (valobj)
{
- bool update_success = valobj->UpdateValueIfNeeded ();
+ bool update_success = valobj->UpdateValueIfNeeded (use_dynamic, true);
if (update_success && use_dynamic != lldb::eNoDynamicValues)
{
@@ -2566,7 +2598,33 @@
// Always show the type for the top level items.
if (show_types || (curr_depth == 0 && !flat_output))
- s.Printf("(%s) ", valobj->GetTypeName().AsCString(""));
+ {
+ s.Printf("(%s", valobj->GetTypeName().AsCString(""));
+ if (use_dynamic != lldb::eNoDynamicValues &&
+ strcmp(valobj->GetTypeName().AsCString("NULL"), "id") == 0)
+ {
+ Process* process = valobj->GetUpdatePoint().GetProcessSP().get();
+ if (process == NULL)
+ s.Printf(") ");
+ else
+ {
+ ObjCLanguageRuntime *runtime = process->GetObjCLanguageRuntime();
+ if (runtime == NULL)
+ s.Printf(") ");
+ else
+ {
+ ObjCLanguageRuntime::ObjCISA isa = runtime->GetISA(*valobj);
+ if (!runtime->IsValidISA(isa))
+ s.Printf(") ");
+ else
+ s.Printf(", dynamic type: %s) ",
+ runtime->GetActualTypeName(isa).GetCString());
+ }
+ }
+ }
+ else
+ s.Printf(") ");
+ }
if (flat_output)
@@ -2758,7 +2816,7 @@
{
ValueObjectSP valobj_sp;
- if (UpdateValueIfNeeded() && m_error.Success())
+ if (UpdateValueIfNeeded(false) && m_error.Success())
{
ExecutionContextScope *exe_scope = GetExecutionContextScope();
if (exe_scope)
@@ -2957,7 +3015,6 @@
return valobj_sp;
}
-
ValueObject::EvaluationPoint::EvaluationPoint () :
m_thread_id (LLDB_INVALID_UID),
m_stop_id (0)
Modified: lldb/trunk/source/Core/ValueObjectChild.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectChild.cpp?rev=136695&r1=136694&r2=136695&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectChild.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectChild.cpp Tue Aug 2 12:27:39 2011
@@ -97,7 +97,7 @@
ValueObject* parent = m_parent;
if (parent)
{
- if (parent->UpdateValueIfNeeded())
+ if (parent->UpdateValueIfNeeded(false))
{
m_value.SetContext(Value::eContextTypeClangType, m_clang_type);
Modified: lldb/trunk/source/Core/ValueObjectDynamicValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectDynamicValue.cpp?rev=136695&r1=136694&r2=136695&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectDynamicValue.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectDynamicValue.cpp Tue Aug 2 12:27:39 2011
@@ -60,7 +60,7 @@
ConstString
ValueObjectDynamicValue::GetTypeName()
{
- const bool success = UpdateValueIfNeeded();
+ const bool success = UpdateValueIfNeeded(false);
if (success && m_type_sp)
return ClangASTType::GetConstTypeName (GetClangType());
else
@@ -70,7 +70,7 @@
uint32_t
ValueObjectDynamicValue::CalculateNumChildren()
{
- const bool success = UpdateValueIfNeeded();
+ const bool success = UpdateValueIfNeeded(false);
if (success && m_type_sp)
return ClangASTContext::GetNumChildren (GetClangAST (), GetClangType(), true);
else
@@ -90,7 +90,7 @@
size_t
ValueObjectDynamicValue::GetByteSize()
{
- const bool success = UpdateValueIfNeeded();
+ const bool success = UpdateValueIfNeeded(false);
if (success && m_type_sp)
return m_value.GetValueByteSize(GetClangAST(), NULL);
else
@@ -109,7 +109,7 @@
SetValueIsValid (false);
m_error.Clear();
- if (!m_parent->UpdateValueIfNeeded())
+ if (!m_parent->UpdateValueIfNeeded(false))
{
// The dynamic value failed to get an error, pass the error along
if (m_error.Success() && m_parent->GetError().Fail())
Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h?rev=136695&r1=136694&r2=136695&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h Tue Aug 2 12:27:39 2011
@@ -63,6 +63,30 @@
virtual lldb::ThreadPlanSP
GetStepThroughTrampolinePlan (Thread &thread, bool stop_others);
+ virtual bool
+ IsValidISA(ObjCISA isa)
+ {
+ return false;
+ }
+
+ virtual ObjCISA
+ GetISA(ValueObject& valobj)
+ {
+ return 0;
+ }
+
+ virtual ConstString
+ GetActualTypeName(ObjCISA isa)
+ {
+ return ConstString(NULL);
+ }
+
+ virtual ObjCISA
+ GetParentClass(ObjCISA isa)
+ {
+ return 0;
+ }
+
//------------------------------------------------------------------
// Static Functions
//------------------------------------------------------------------
Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h?rev=136695&r1=136694&r2=136695&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h Tue Aug 2 12:27:39 2011
@@ -72,6 +72,31 @@
{
return eAppleObjC_V1;
}
+
+ virtual bool
+ IsValidISA(ObjCISA isa)
+ {
+ return false;
+ }
+
+ virtual ObjCISA
+ GetISA(ValueObject& valobj)
+ {
+ return 0;
+ }
+
+ virtual ConstString
+ GetActualTypeName(ObjCISA isa)
+ {
+ return ConstString(NULL);
+ }
+
+ virtual ObjCISA
+ GetParentClass(ObjCISA isa)
+ {
+ return 0;
+ }
+
protected:
private:
Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp?rev=136695&r1=136694&r2=136695&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Tue Aug 2 12:27:39 2011
@@ -563,4 +563,90 @@
return ivar_offset;
}
+lldb_private::ObjCLanguageRuntime::ObjCISA
+AppleObjCRuntimeV2::GetISA(ValueObject& valobj)
+{
+ if (ClangASTType::GetMinimumLanguage(valobj.GetClangAST(),valobj.GetClangType()) != lldb::eLanguageTypeObjC)
+ return 0;
+
+ uint32_t offset = 0;
+ uint64_t isa_pointer = valobj.GetDataExtractor().GetPointer(&offset);
+
+ uint8_t pointer_size = valobj.GetUpdatePoint().GetProcessSP()->GetAddressByteSize();
+
+ Error error;
+ lldb_private::ObjCLanguageRuntime::ObjCISA isa =
+ valobj.GetUpdatePoint().GetProcessSP()->ReadUnsignedIntegerFromMemory(isa_pointer,
+ pointer_size,
+ 0,
+ error);
+ return isa;
+}
+
+ConstString
+AppleObjCRuntimeV2::GetActualTypeName(lldb_private::ObjCLanguageRuntime::ObjCISA isa)
+{
+ if (!IsValidISA(isa))
+ return ConstString(NULL);
+
+ uint8_t pointer_size = m_process->GetAddressByteSize();
+ Error error;
+ lldb::addr_t rw_pointer = isa + (4 * pointer_size);
+ //printf("rw_pointer: %llx\n", rw_pointer);
+
+ uint64_t data_pointer = m_process->ReadUnsignedIntegerFromMemory(rw_pointer,
+ pointer_size,
+ 0,
+ error);
+ if (error.Fail())
+ return ConstString("unknown");
+
+ data_pointer += 8;
+ //printf("data_pointer: %llx\n", data_pointer);
+ uint64_t ro_pointer = m_process->ReadUnsignedIntegerFromMemory(data_pointer,
+ pointer_size,
+ 0,
+ error);
+ if (error.Fail())
+ return ConstString("unknown");
+
+ ro_pointer += 12;
+ if (pointer_size == 8)
+ ro_pointer += 4;
+ ro_pointer += pointer_size;
+ //printf("ro_pointer: %llx\n", ro_pointer);
+ uint64_t name_pointer = m_process->ReadUnsignedIntegerFromMemory(ro_pointer,
+ pointer_size,
+ 0,
+ error);
+ if (error.Fail())
+ return ConstString("unknown");
+
+ //printf("name_pointer: %llx\n", name_pointer);
+ char* cstr = new char[512];
+ if (m_process->ReadCStringFromMemory(name_pointer, cstr, 512) > 0)
+ return ConstString(cstr);
+ else
+ return ConstString("unknown");
+}
+
+lldb_private::ObjCLanguageRuntime::ObjCISA
+AppleObjCRuntimeV2::GetParentClass(lldb_private::ObjCLanguageRuntime::ObjCISA isa)
+{
+ if (!IsValidISA(isa))
+ return 0;
+
+ uint8_t pointer_size = m_process->GetAddressByteSize();
+ Error error;
+ lldb::addr_t parent_pointer = isa + pointer_size;
+ //printf("rw_pointer: %llx\n", rw_pointer);
+
+ uint64_t parent_isa = m_process->ReadUnsignedIntegerFromMemory(parent_pointer,
+ pointer_size,
+ 0,
+ error);
+ if (error.Fail())
+ return 0;
+ return parent_isa;
+}
Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h?rev=136695&r1=136694&r2=136695&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h Tue Aug 2 12:27:39 2011
@@ -76,7 +76,21 @@
virtual size_t
GetByteOffsetForIvar (ClangASTType &parent_qual_type, const char *ivar_name);
-
+
+ virtual bool
+ IsValidISA(ObjCISA isa)
+ {
+ return (isa != 0);
+ }
+
+ virtual ObjCISA
+ GetISA(ValueObject& valobj);
+
+ virtual ConstString
+ GetActualTypeName(ObjCISA isa);
+
+ virtual ObjCISA
+ GetParentClass(ObjCISA isa);
protected:
Modified: lldb/trunk/source/Symbol/ClangASTType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTType.cpp?rev=136695&r1=136694&r2=136695&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTType.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTType.cpp Tue Aug 2 12:27:39 2011
@@ -159,11 +159,13 @@
lldb::LanguageType
ClangASTType::GetMinimumLanguage ()
{
- return ClangASTType::GetMinimumLanguage (m_type);
+ return ClangASTType::GetMinimumLanguage (m_ast,
+ m_type);
}
lldb::LanguageType
-ClangASTType::GetMinimumLanguage (lldb::clang_type_t clang_type)
+ClangASTType::GetMinimumLanguage (clang::ASTContext *ctx,
+ lldb::clang_type_t clang_type)
{
if (clang_type == NULL)
return lldb::eLanguageTypeC;
@@ -182,6 +184,8 @@
return lldb::eLanguageTypeObjC;
if (pointee_type->isObjCClassType())
return lldb::eLanguageTypeObjC;
+ if (pointee_type.getTypePtr() == ctx->ObjCBuiltinIdTy.getTypePtr())
+ return lldb::eLanguageTypeObjC;
}
else
{
@@ -238,7 +242,8 @@
}
break;
case clang::Type::Typedef:
- return GetMinimumLanguage(llvm::cast(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr());
+ return GetMinimumLanguage(ctx,
+ llvm::cast(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr());
}
}
return lldb::eLanguageTypeC;
Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-categories/TestDataFormatterCategories.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-categories/TestDataFormatterCategories.py?rev=136695&r1=136694&r2=136695&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-categories/TestDataFormatterCategories.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-categories/TestDataFormatterCategories.py Tue Aug 2 12:27:39 2011
@@ -286,7 +286,7 @@
substrs = ['ACircle',
'ARectangle',
'ACircle',
- 'ARectangleStar'])
+ 'ARectangle'])
# Check that abruptly deleting an enabled category does not crash us
self.runCmd("type category delete RectangleCategory")
Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py?rev=136695&r1=136694&r2=136695&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py Tue Aug 2 12:27:39 2011
@@ -164,7 +164,7 @@
'inline = ',
'explicit = ',
'content = ',
- 'a very much boring task to write a string this way!!\\xe4\\x8c\\xb3'])
+ 'a very much boring task to write a string this way!!\\xcf\\x83'])
self.expect('frame variable str10 -P 1 -Y',
substrs = ['mutable =',
@@ -215,7 +215,7 @@
self.expect('frame variable str8',
substrs = ['hasVeryLongExtensionThisTime'])
self.expect('frame variable str9',
- substrs = ['a very much boring task to write a string this way!!\\xe4\\x8c\\xb3'])
+ substrs = ['a very much boring task to write a string this way!!\\xcf\\x83'])
self.expect('frame variable str10',
substrs = ['This is a Unicode string \\xcf\\x83 number 4 right here'])
self.expect('frame variable str11',
@@ -224,6 +224,25 @@
substrs = ['a.out'])
self.expect('frame variable str12',
substrs = ['Process Name: a.out Process Id:'])
+ self.expect('frame variable dyn_test', matching=False,
+ substrs = ['Process Name: a.out Process Id:'])
+ self.expect('frame variable dyn_test -d run-target',
+ substrs = ['(id, dynamic type:',
+ 'Process Name: a.out Process Id:'])
+
+
+ # check that we can format stuff out of the expression parser
+ self.expect('expression ((id)@"Hello")', matching=False,
+ substrs = ['Hello'])
+
+ self.expect('expression -d true -- ((id)@"Hello")',
+ substrs = ['Hello'])
+
+ self.expect('expr -d true -- label1',
+ substrs = ['Process Name'])
+
+ self.expect('expr -d true -- @"Hello"',
+ substrs = ['Hello'])
if __name__ == '__main__':
import atexit
Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/main.m
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/main.m?rev=136695&r1=136694&r2=136695&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/main.m (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/main.m Tue Aug 2 12:27:39 2011
@@ -117,6 +117,8 @@
NSString *processID = [NSString stringWithFormat:@"%d", [[NSProcessInfo processInfo] processIdentifier]];
NSString *str12 = [NSString stringWithFormat:@"%@ %@ %@ %@", label1, processName, label2, processID];
+ id dyn_test = str12;
+
// Set break point at this line.
[pool drain];
return 0;
From gclayton at apple.com Tue Aug 2 12:45:20 2011
From: gclayton at apple.com (Greg Clayton)
Date: Tue, 02 Aug 2011 17:45:20 -0000
Subject: [Lldb-commits] [lldb] r136698 - /lldb/tags/lldb-70/
Message-ID: <20110802174520.748B22A6C12C@llvm.org>
Author: gclayton
Date: Tue Aug 2 12:45:20 2011
New Revision: 136698
URL: http://llvm.org/viewvc/llvm-project?rev=136698&view=rev
Log:
Removing this tag, and will soon update with new lldb-70.
Removed:
lldb/tags/lldb-70/
From gclayton at apple.com Tue Aug 2 12:45:57 2011
From: gclayton at apple.com (Greg Clayton)
Date: Tue, 02 Aug 2011 17:45:57 -0000
Subject: [Lldb-commits] [lldb] r136699 - /lldb/tags/lldb-70/
Message-ID: <20110802174557.8C0282A6C12C@llvm.org>
Author: gclayton
Date: Tue Aug 2 12:45:57 2011
New Revision: 136699
URL: http://llvm.org/viewvc/llvm-project?rev=136699&view=rev
Log:
lldb-70 (after deletion of old lldb-70 tag).
Added:
lldb/tags/lldb-70/
- copied from r136698, lldb/trunk/
From gclayton at apple.com Tue Aug 2 13:59:56 2011
From: gclayton at apple.com (Greg Clayton)
Date: Tue, 02 Aug 2011 18:59:56 -0000
Subject: [Lldb-commits] [lldb] r136712 -
/lldb/tags/lldb-70/scripts/build-llvm.pl
Message-ID: <20110802185956.491232A6C12C@llvm.org>
Author: gclayton
Date: Tue Aug 2 13:59:56 2011
New Revision: 136712
URL: http://llvm.org/viewvc/llvm-project?rev=136712&view=rev
Log:
Remove libEnhancedDisassembly.dylib
Modified:
lldb/tags/lldb-70/scripts/build-llvm.pl
Modified: lldb/tags/lldb-70/scripts/build-llvm.pl
URL: http://llvm.org/viewvc/llvm-project/lldb/tags/lldb-70/scripts/build-llvm.pl?rev=136712&r1=136711&r2=136712&view=diff
==============================================================================
--- lldb/tags/lldb-70/scripts/build-llvm.pl (original)
+++ lldb/tags/lldb-70/scripts/build-llvm.pl Tue Aug 2 13:59:56 2011
@@ -16,10 +16,6 @@
our $llvm_srcroot = $ENV{SCRIPT_INPUT_FILE_0};
our $llvm_dstroot = $ENV{SCRIPT_INPUT_FILE_1};
-our $libedis_outfile = $ENV{SCRIPT_OUTPUT_FILE_0};
-our ($libedis_basename, $libedis_dirname) = fileparse ($libedis_outfile);
-our @libedis_slices; # Skinny mach-o slices for libEnhancedDisassembly.dylib
-
our $llvm_clang_outfile = $ENV{SCRIPT_OUTPUT_FILE_1};
our ($llvm_clang_basename, $llvm_clang_dirname) = fileparse ($llvm_clang_outfile);
our @llvm_clang_slices; # paths to the single architecture static libraries (archives)
@@ -98,12 +94,6 @@
my $llvm_dstroot_archive = "$llvm_dstroot/$llvm_clang_basename";
push @llvm_clang_slices, $llvm_dstroot_archive;
create_dstroot_file ($llvm_clang_basename, $llvm_clang_dirname, \@llvm_clang_slices, $llvm_clang_basename);
- my $llvm_dstroot_edis = "$llvm_dstroot/$llvm_configuration/lib/libEnhancedDisassembly.dylib";
- if (-f $llvm_dstroot_edis)
- {
- push @libedis_slices, $llvm_dstroot_edis;
- create_dstroot_file ($libedis_basename, $libedis_dirname, \@libedis_slices, $libedis_basename);
- }
exit 0;
}
@@ -123,18 +113,11 @@
}
do_command ("cd '$ENV{SRCROOT}' && unzip -q llvm.zip && touch '$llvm_zip_md5_file'", "expanding llvm.zip", 1);
}
-
- # We use the stuff in "lldb/llvm" for non B&I builds
- if (!-e $libedis_outfile)
- {
- print "Copying '$ENV{SRCROOT}/llvm/$libedis_basename' to '$libedis_outfile'...\n";
- do_command ("cp '$ENV{SRCROOT}/llvm/$libedis_basename' '$libedis_outfile'", "copying libedis", 1);
- }
exit 0;
}
# If our output file already exists then we need not generate it again.
-if (-e $llvm_clang_outfile and -e $libedis_outfile)
+if (-e $llvm_clang_outfile)
{
exit 0;
}
@@ -251,25 +234,11 @@
}
-f "$llvm_dstroot_arch_archive" and push @llvm_clang_slices, "$llvm_dstroot_arch_archive";
- -f "$llvm_dstroot_arch/$llvm_configuration/lib/libEnhancedDisassembly.dylib" and push @libedis_slices, "$llvm_dstroot_arch/$llvm_configuration/lib/libEnhancedDisassembly.dylib";
++$arch_idx;
}
# Combine all skinny slices of the LLVM/Clang combined archive
create_dstroot_file ($llvm_clang_basename, $llvm_clang_dirname, \@llvm_clang_slices, $llvm_clang_basename);
-
- if (scalar(@libedis_slices))
- {
- # Combine all skinny slices of the libedis in SYMROOT
- create_dstroot_file ($libedis_basename, $libedis_dirname, \@libedis_slices, $libedis_basename);
-
- # Make dSYM for libedis in SYMROOT
- do_command ("cd '$libedis_dirname' && dsymutil $libedis_basename", "making libedis dSYM", 1);
-
- # strip debug symbols from libedis and copy into DSTROOT
- -d "$ENV{DSTROOT}/Developer/usr/lib" or do_command ("mkdir -p '$ENV{DSTROOT}/Developer/usr/lib'", "Making directory '$ENV{DSTROOT}/Developer/usr/lib'", 1);
- do_command ("cd '$libedis_dirname' && strip -Sx -o '$ENV{DSTROOT}/Developer/usr/lib/$libedis_basename' '$libedis_outfile'", "Stripping libedis and copying to DSTROOT", 1);
- }
}
sub create_dstroot_file
From gclayton at apple.com Tue Aug 2 14:00:17 2011
From: gclayton at apple.com (Greg Clayton)
Date: Tue, 02 Aug 2011 19:00:17 -0000
Subject: [Lldb-commits] [lldb] r136713 - /lldb/trunk/scripts/build-llvm.pl
Message-ID: <20110802190018.02D0F2A6C12C@llvm.org>
Author: gclayton
Date: Tue Aug 2 14:00:17 2011
New Revision: 136713
URL: http://llvm.org/viewvc/llvm-project?rev=136713&view=rev
Log:
Remove libEnhancedDisassembly.dylib
Modified:
lldb/trunk/scripts/build-llvm.pl
Modified: lldb/trunk/scripts/build-llvm.pl
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/build-llvm.pl?rev=136713&r1=136712&r2=136713&view=diff
==============================================================================
--- lldb/trunk/scripts/build-llvm.pl (original)
+++ lldb/trunk/scripts/build-llvm.pl Tue Aug 2 14:00:17 2011
@@ -16,10 +16,6 @@
our $llvm_srcroot = $ENV{SCRIPT_INPUT_FILE_0};
our $llvm_dstroot = $ENV{SCRIPT_INPUT_FILE_1};
-our $libedis_outfile = $ENV{SCRIPT_OUTPUT_FILE_0};
-our ($libedis_basename, $libedis_dirname) = fileparse ($libedis_outfile);
-our @libedis_slices; # Skinny mach-o slices for libEnhancedDisassembly.dylib
-
our $llvm_clang_outfile = $ENV{SCRIPT_OUTPUT_FILE_1};
our ($llvm_clang_basename, $llvm_clang_dirname) = fileparse ($llvm_clang_outfile);
our @llvm_clang_slices; # paths to the single architecture static libraries (archives)
@@ -98,12 +94,6 @@
my $llvm_dstroot_archive = "$llvm_dstroot/$llvm_clang_basename";
push @llvm_clang_slices, $llvm_dstroot_archive;
create_dstroot_file ($llvm_clang_basename, $llvm_clang_dirname, \@llvm_clang_slices, $llvm_clang_basename);
- my $llvm_dstroot_edis = "$llvm_dstroot/$llvm_configuration/lib/libEnhancedDisassembly.dylib";
- if (-f $llvm_dstroot_edis)
- {
- push @libedis_slices, $llvm_dstroot_edis;
- create_dstroot_file ($libedis_basename, $libedis_dirname, \@libedis_slices, $libedis_basename);
- }
exit 0;
}
@@ -123,18 +113,11 @@
}
do_command ("cd '$ENV{SRCROOT}' && unzip -q llvm.zip && touch '$llvm_zip_md5_file'", "expanding llvm.zip", 1);
}
-
- # We use the stuff in "lldb/llvm" for non B&I builds
- if (!-e $libedis_outfile)
- {
- print "Copying '$ENV{SRCROOT}/llvm/$libedis_basename' to '$libedis_outfile'...\n";
- do_command ("cp '$ENV{SRCROOT}/llvm/$libedis_basename' '$libedis_outfile'", "copying libedis", 1);
- }
exit 0;
}
# If our output file already exists then we need not generate it again.
-if (-e $llvm_clang_outfile and -e $libedis_outfile)
+if (-e $llvm_clang_outfile)
{
exit 0;
}
@@ -251,25 +234,11 @@
}
-f "$llvm_dstroot_arch_archive" and push @llvm_clang_slices, "$llvm_dstroot_arch_archive";
- -f "$llvm_dstroot_arch/$llvm_configuration/lib/libEnhancedDisassembly.dylib" and push @libedis_slices, "$llvm_dstroot_arch/$llvm_configuration/lib/libEnhancedDisassembly.dylib";
++$arch_idx;
}
# Combine all skinny slices of the LLVM/Clang combined archive
create_dstroot_file ($llvm_clang_basename, $llvm_clang_dirname, \@llvm_clang_slices, $llvm_clang_basename);
-
- if (scalar(@libedis_slices))
- {
- # Combine all skinny slices of the libedis in SYMROOT
- create_dstroot_file ($libedis_basename, $libedis_dirname, \@libedis_slices, $libedis_basename);
-
- # Make dSYM for libedis in SYMROOT
- do_command ("cd '$libedis_dirname' && dsymutil $libedis_basename", "making libedis dSYM", 1);
-
- # strip debug symbols from libedis and copy into DSTROOT
- -d "$ENV{DSTROOT}/Developer/usr/lib" or do_command ("mkdir -p '$ENV{DSTROOT}/Developer/usr/lib'", "Making directory '$ENV{DSTROOT}/Developer/usr/lib'", 1);
- do_command ("cd '$libedis_dirname' && strip -Sx -o '$ENV{DSTROOT}/Developer/usr/lib/$libedis_basename' '$libedis_outfile'", "Stripping libedis and copying to DSTROOT", 1);
- }
}
sub create_dstroot_file
From johnny.chen at apple.com Tue Aug 2 15:52:42 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Tue, 02 Aug 2011 20:52:42 -0000
Subject: [Lldb-commits] [lldb] r136720 - in /lldb/trunk: ./
include/lldb/Host/ include/lldb/Host/freebsd/ lib/ source/ source/Host/
source/Host/common/ source/Host/freebsd/ source/Plugins/
source/Plugins/Platform/ source/Plugins/Platform/FreeBSD/ tools/driver/
Message-ID: <20110802205242.E1DD42A6C12C@llvm.org>
Author: johnny
Date: Tue Aug 2 15:52:42 2011
New Revision: 136720
URL: http://llvm.org/viewvc/llvm-project?rev=136720&view=rev
Log:
Patch by David Forsythe to build lldb on FreeBSD!
I did not take the patch for ClangExpressionParser.cpp since there was a
recent change by Peter for the same line. Feel free to disagree. :-)
Reference:
----------------------------------------------------------------------
r136580 | pcc | 2011-07-30 15:42:24 -0700 (Sat, 30 Jul 2011) | 3 lines
Add reloc arg to standard JIT createJIT()
Fixes non-__APPLE__ build. Patch by Matt Johnson!
----------------------------------------------------------------------
Also, I ignore the part of the patch to remove the RegisterContextDarwin*.h/.cpp.
Added:
lldb/trunk/source/Host/freebsd/
lldb/trunk/source/Host/freebsd/Host.cpp
lldb/trunk/source/Host/freebsd/Makefile
lldb/trunk/source/Plugins/Platform/FreeBSD/
lldb/trunk/source/Plugins/Platform/FreeBSD/Makefile
lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
Modified:
lldb/trunk/Makefile
lldb/trunk/include/lldb/Host/SocketAddress.h
lldb/trunk/include/lldb/Host/freebsd/Config.h
lldb/trunk/lib/Makefile
lldb/trunk/source/Host/Makefile
lldb/trunk/source/Host/common/Host.cpp
lldb/trunk/source/Plugins/Makefile
lldb/trunk/source/Plugins/Platform/Makefile
lldb/trunk/source/lldb.cpp
lldb/trunk/tools/driver/IOChannel.h
lldb/trunk/tools/driver/Makefile
Modified: lldb/trunk/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/Makefile?rev=136720&r1=136719&r2=136720&view=diff
==============================================================================
--- lldb/trunk/Makefile (original)
+++ lldb/trunk/Makefile Tue Aug 2 15:52:42 2011
@@ -30,7 +30,6 @@
# Set Python include directory
PYTHON_INC_DIR = $(shell python-config --includes)
-
# Set common LLDB build flags.
CPP.Flags += -I$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/include
CPP.Flags += -I$(PROJ_OBJ_DIR)/$(LLDB_LEVEL)/include
Modified: lldb/trunk/include/lldb/Host/SocketAddress.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/SocketAddress.h?rev=136720&r1=136719&r2=136720&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/SocketAddress.h (original)
+++ lldb/trunk/include/lldb/Host/SocketAddress.h Tue Aug 2 15:52:42 2011
@@ -16,6 +16,10 @@
#include
#include
+#if defined(__FreeBSD__)
+#include
+#endif
+
// C++ Includes
// Other libraries and framework includes
// Project includes
Modified: lldb/trunk/include/lldb/Host/freebsd/Config.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/freebsd/Config.h?rev=136720&r1=136719&r2=136720&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/freebsd/Config.h (original)
+++ lldb/trunk/include/lldb/Host/freebsd/Config.h Tue Aug 2 15:52:42 2011
@@ -27,4 +27,4 @@
//#define LLDB_CONFIG_FCNTL_GETPATH_SUPPORTED 1
-#endif // #ifndef liblldb_Platform_Config_h_
\ No newline at end of file
+#endif // #ifndef liblldb_Platform_Config_h_
Modified: lldb/trunk/lib/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lib/Makefile?rev=136720&r1=136719&r2=136720&view=diff
==============================================================================
--- lldb/trunk/lib/Makefile (original)
+++ lldb/trunk/lib/Makefile Tue Aug 2 15:52:42 2011
@@ -73,7 +73,8 @@
lldbPluginObjectContainerUniversalMachO.a \
lldbPluginObjectFileMachO.a \
lldbPluginSymbolVendorMacOSX.a \
- lldbPluginPlatformMacOSX.a
+ lldbPluginPlatformMacOSX.a \
+ lldbPluginProcessDarwin
endif
ifeq ($(HOST_OS),Linux)
@@ -83,6 +84,11 @@
lldbHostLinux.a
endif
+ifeq ($(HOST_OS),FreeBSD)
+ USEDLIBS += lldbHostFreeBSD.a \
+ lldbPluginPlatformFreeBSD.a
+endif
+
include $(LEVEL)/Makefile.common
ifeq ($(HOST_OS),Darwin)
@@ -108,7 +114,7 @@
endif
endif
-ifeq ($(HOST_OS), Linux)
+ifeq ($(HOST_OS),Linux)
# Include everything from the .a's into the shared library.
ProjLibsOptions := -Wl,--whole-archive $(ProjLibsOptions) \
-Wl,--no-whole-archive
@@ -117,3 +123,13 @@
# Link in python
LD.Flags += $(PYTHON_BUILD_FLAGS) -lrt
endif
+
+ifeq ($(HOST_OS),FreeBSD)
+ # Include everything from the .a's into the shared library.
+ ProjLibsOptions := -Wl,--whole-archive $(ProjLibsOptions) \
+ -Wl,--no-whole-archive
+ # Don't allow unresolved symbols.
+ LLVMLibsOptions += -Wl,--no-undefined
+ # Link in python
+ LD.Flags += $(PYTHON_BUILD_FLAGS) -lrt -L/usr/local/lib -lexecinfo
+endif
Modified: lldb/trunk/source/Host/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/Makefile?rev=136720&r1=136719&r2=136720&view=diff
==============================================================================
--- lldb/trunk/source/Host/Makefile (original)
+++ lldb/trunk/source/Host/Makefile Tue Aug 2 15:52:42 2011
@@ -21,4 +21,8 @@
DIRS += linux
endif
+ifeq ($(HOST_OS),FreeBSD)
+DIRS += freebsd
+endif
+
include $(LLDB_LEVEL)/Makefile
Modified: lldb/trunk/source/Host/common/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=136720&r1=136719&r2=136720&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Host.cpp (original)
+++ lldb/trunk/source/Host/common/Host.cpp Tue Aug 2 15:52:42 2011
@@ -43,6 +43,12 @@
#include
+#elif defined (__FreeBSD__)
+
+#include
+#include
+#include
+
#endif
using namespace lldb;
@@ -357,6 +363,8 @@
g_vendor.SetCString("apple");
#elif defined (__linux__)
g_vendor.SetCString("gnu");
+#elif defined (__FreeBSD__)
+ g_vendor.SetCString("freebsd");
#endif
}
return g_vendor;
@@ -372,6 +380,8 @@
g_os_string.SetCString("darwin");
#elif defined (__linux__)
g_os_string.SetCString("linux");
+#elif defined (__FreeBSD__)
+ g_os_string.SetCString("freebsd");
#endif
}
return g_os_string;
@@ -410,6 +420,8 @@
{
#if defined (__APPLE__)
return ::mach_thread_self();
+#elif defined(__FreeBSD__)
+ return lldb::tid_t(pthread_getthreadid_np());
#else
return lldb::tid_t(pthread_self());
#endif
@@ -470,19 +482,17 @@
{
}
-#if !defined (__APPLE__) // see macosx/Host.mm
+#if !defined (__APPLE__) && !defined (__FreeBSD__) // see macosx/Host.mm
void
Host::ThreadCreated (const char *thread_name)
{
}
-void
Host::Backtrace (Stream &strm, uint32_t max_frames)
{
// TODO: Is there a way to backtrace the current process on linux? Other systems?
}
-
size_t
Host::GetEnvironment (StringList &env)
{
@@ -1120,9 +1130,7 @@
return NULL;
}
-
-#if !defined (__APPLE__) // see macosx/Host.mm
-
+#if !defined (__APPLE__) && !defined (__FreeBSD__) // see macosx/Host.mm
bool
Host::GetOSBuildString (std::string &s)
{
@@ -1136,21 +1144,27 @@
s.clear();
return false;
}
+#endif
+#if !defined(__APPLE__)
uint32_t
Host::FindProcesses (const ProcessInstanceInfoMatch &match_info, ProcessInstanceInfoList &process_infos)
{
process_infos.Clear();
return process_infos.GetSize();
}
+#endif
+#if !defined (__APPLE__) && !defined (__FreeBSD__)
bool
Host::GetProcessInfo (lldb::pid_t pid, ProcessInstanceInfo &process_info)
{
process_info.Clear();
return false;
}
+#endif
+#if !defined (__APPLE__)
bool
Host::OpenFileInExternalEditor (const FileSpec &file_spec, uint32_t line_no)
{
Added: lldb/trunk/source/Host/freebsd/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/freebsd/Host.cpp?rev=136720&view=auto
==============================================================================
--- lldb/trunk/source/Host/freebsd/Host.cpp (added)
+++ lldb/trunk/source/Host/freebsd/Host.cpp Tue Aug 2 15:52:42 2011
@@ -0,0 +1,277 @@
+//===-- source/Host/freebsd/Host.cpp ------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// C Includes
+#include
+#include
+#include
+#include
+#include
+#include
+
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/Core/Error.h"
+#include "lldb/Host/Endian.h"
+#include "lldb/Host/Host.h"
+#include "lldb/Core/DataExtractor.h"
+#include "lldb/Core/StreamFile.h"
+#include "lldb/Core/StreamString.h"
+#include "lldb/Target/Process.h"
+
+#include "llvm/Support/Host.h"
+
+extern "C" {
+ char **environ;
+}
+
+using namespace lldb;
+using namespace lldb_private;
+
+class FreeBSDThread
+{
+public:
+ FreeBSDThread(const char *thread_name)
+ {
+ Host::SetThreadName (LLDB_INVALID_PROCESS_ID, LLDB_INVALID_THREAD_ID, thread_name);
+ }
+ static void PThreadDestructor (void *v)
+ {
+ delete (FreeBSDThread*)v;
+ }
+};
+
+static pthread_once_t g_thread_create_once = PTHREAD_ONCE_INIT;
+static pthread_key_t g_thread_create_key = 0;
+
+static void
+InitThreadCreated()
+{
+ ::pthread_key_create (&g_thread_create_key, FreeBSDThread::PThreadDestructor);
+}
+
+void
+Host::ThreadCreated (const char *thread_name)
+{
+ ::pthread_once (&g_thread_create_once, InitThreadCreated);
+ if (g_thread_create_key)
+ {
+ ::pthread_setspecific (g_thread_create_key, new FreeBSDThread(thread_name));
+ }
+}
+
+void
+Host::Backtrace (Stream &strm, uint32_t max_frames)
+{
+ char backtrace_path[] = "/tmp/lldb-backtrace-tmp-XXXXXX";
+ int backtrace_fd = ::mkstemp (backtrace_path);
+ if (backtrace_fd != -1)
+ {
+ std::vector frame_buffer (max_frames, NULL);
+ int count = ::backtrace (&frame_buffer[0], frame_buffer.size());
+ ::backtrace_symbols_fd (&frame_buffer[0], count, backtrace_fd);
+
+ const off_t buffer_size = ::lseek(backtrace_fd, 0, SEEK_CUR);
+
+ if (::lseek(backtrace_fd, 0, SEEK_SET) == 0)
+ {
+ char *buffer = (char *)::malloc (buffer_size);
+ if (buffer)
+ {
+ ssize_t bytes_read = ::read (backtrace_fd, buffer, buffer_size);
+ if (bytes_read > 0)
+ strm.Write(buffer, bytes_read);
+ ::free (buffer);
+ }
+ }
+ ::close (backtrace_fd);
+ ::unlink (backtrace_path);
+ }
+}
+
+size_t
+Host::GetEnvironment (StringList &env)
+{
+ char *v;
+ char **var = environ;
+ for (var = environ; var != NULL; ++var) {
+ v = strchr(*var, (int)'-');
+ if (v == NULL)
+ continue;
+ env.AppendString(v);
+ }
+ return env.GetSize();
+}
+
+bool
+Host::GetOSVersion(uint32_t &major,
+ uint32_t &minor,
+ uint32_t &update)
+{
+ struct utsname un;
+ int status;
+
+ if (uname(&un) < 0)
+ return false;
+
+ status = sscanf(un.release, "%u.%u-%u", &major, &minor, &update);
+ return status == 3;
+}
+
+Error
+Host::LaunchProcess (ProcessLaunchInfo &launch_info)
+{
+ Error error;
+ assert(!"Not implemented yet!!!");
+ return error;
+}
+
+bool
+Host::GetOSBuildString (std::string &s)
+{
+ int mib[2] = { CTL_KERN, KERN_OSREV };
+ char cstr[PATH_MAX];
+ size_t cstr_len = sizeof(cstr);
+ if (::sysctl (mib, 2, cstr, &cstr_len, NULL, 0) == 0)
+ {
+ s.assign (cstr, cstr_len);
+ return true;
+ }
+ s.clear();
+ return false;
+}
+
+bool
+Host::GetOSKernelDescription (std::string &s)
+{
+ int mib[2] = { CTL_KERN, KERN_VERSION };
+ char cstr[PATH_MAX];
+ size_t cstr_len = sizeof(cstr);
+ if (::sysctl (mib, 2, cstr, &cstr_len, NULL, 0) == 0)
+ {
+ s.assign (cstr, cstr_len);
+ return true;
+ }
+ s.clear();
+ return false;
+}
+
+static bool
+GetFreeBSDProcessArgs (const ProcessInstanceInfoMatch *match_info_ptr,
+ ProcessInstanceInfo &process_info)
+{
+ if (process_info.ProcessIDIsValid()) {
+ int mib[3] = { CTL_KERN, KERN_PROC_ARGS, process_info.GetProcessID() };
+
+ char arg_data[8192];
+ size_t arg_data_size = sizeof(arg_data);
+ if (::sysctl (mib, 3, arg_data, &arg_data_size , NULL, 0) == 0)
+ {
+ DataExtractor data (arg_data, arg_data_size, lldb::endian::InlHostByteOrder(), sizeof(void *));
+ uint32_t offset = 0;
+ uint32_t start_offset;
+ uint32_t argc = data.GetU32 (&offset);
+ const char *cstr;
+
+ cstr = data.GetCStr (&offset);
+ if (cstr)
+ {
+ process_info.GetExecutableFile().SetFile(cstr, false);
+
+ if (match_info_ptr == NULL ||
+ NameMatches (process_info.GetExecutableFile().GetFilename().GetCString(),
+ match_info_ptr->GetNameMatchType(),
+ match_info_ptr->GetProcessInfo().GetName()))
+ {
+ // Skip NULLs
+ while (1)
+ {
+ const uint8_t *p = data.PeekData(offset, 1);
+ if ((p == NULL) || (*p != '\0'))
+ break;
+ ++offset;
+ }
+ // Now extract all arguments
+ Args &proc_args = process_info.GetArguments();
+ for (int i=0; i 0)
+ {
+ process_info.SetParentProcessID (proc_kinfo.ki_ppid);
+ process_info.SetUserID (proc_kinfo.ki_ruid);
+ process_info.SetGroupID (proc_kinfo.ki_rgid);
+ process_info.SetEffectiveUserID (proc_kinfo.ki_uid);
+ if (proc_kinfo.ki_ngroups > 0)
+ process_info.SetEffectiveGroupID (proc_kinfo.ki_groups[0]);
+ else
+ process_info.SetEffectiveGroupID (UINT32_MAX);
+ return true;
+ }
+ }
+ }
+ process_info.SetParentProcessID (LLDB_INVALID_PROCESS_ID);
+ process_info.SetUserID (UINT32_MAX);
+ process_info.SetGroupID (UINT32_MAX);
+ process_info.SetEffectiveUserID (UINT32_MAX);
+ process_info.SetEffectiveGroupID (UINT32_MAX);
+ return false;
+}
+
+bool
+Host::GetProcessInfo (lldb::pid_t pid, ProcessInstanceInfo &process_info)
+{
+ process_info.SetProcessID(pid);
+ if (GetFreeBSDProcessArgs(NULL, process_info)) {
+ // should use libprocstat instead of going right into sysctl?
+ GetFreeBSDProcessCPUType(process_info);
+ GetFreeBSDProcessUserAndGroup(process_info);
+ return true;
+ }
+ process_info.Clear();
+ return false;
+}
Added: lldb/trunk/source/Host/freebsd/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/freebsd/Makefile?rev=136720&view=auto
==============================================================================
--- lldb/trunk/source/Host/freebsd/Makefile (added)
+++ lldb/trunk/source/Host/freebsd/Makefile Tue Aug 2 15:52:42 2011
@@ -0,0 +1,16 @@
+##===- source/Host/freebsd/Makefile --------------------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ../../..
+LIBRARYNAME := lldbHostFreeBSD
+BUILD_ARCHIVE = 1
+
+CPPFLAGS += -I/usr/local/include
+
+include $(LLDB_LEVEL)/Makefile
Modified: lldb/trunk/source/Plugins/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Makefile?rev=136720&r1=136719&r2=136720&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Makefile (original)
+++ lldb/trunk/source/Plugins/Makefile Tue Aug 2 15:52:42 2011
@@ -21,7 +21,7 @@
LanguageRuntime/ObjC/AppleObjCRuntime
ifeq ($(HOST_OS),Darwin)
-DIRS += DynamicLoader/MacOSX-DYLD ObjectContainer/Universal-Mach-O \
+DIRS += Process/Darwin DynamicLoader/MacOSX-DYLD ObjectContainer/Universal-Mach-O \
ObjectFile/Mach-O SymbolVendor/MacOSX
#DIRS += Process/MacOSX-User
endif
Added: lldb/trunk/source/Plugins/Platform/FreeBSD/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/FreeBSD/Makefile?rev=136720&view=auto
==============================================================================
--- lldb/trunk/source/Plugins/Platform/FreeBSD/Makefile (added)
+++ lldb/trunk/source/Plugins/Platform/FreeBSD/Makefile Tue Aug 2 15:52:42 2011
@@ -0,0 +1,14 @@
+##===- source/Plugins/Platform/Linux/Makefile --------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ../../../..
+LIBRARYNAME := lldbPluginPlatformFreeBSD
+BUILD_ARCHIVE = 1
+
+include $(LLDB_LEVEL)/Makefile
Added: lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp?rev=136720&view=auto
==============================================================================
--- lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp (added)
+++ lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp Tue Aug 2 15:52:42 2011
@@ -0,0 +1,262 @@
+//===-- PlatformFreeBSD.cpp ---------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "PlatformFreeBSD.h"
+
+// C Includes
+#include
+#include
+
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/Core/Error.h"
+#include "lldb/Core/Module.h"
+#include "lldb/Core/ModuleList.h"
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Core/StreamString.h"
+#include "lldb/Host/FileSpec.h"
+#include "lldb/Host/Host.h"
+#include "lldb/Target/Target.h"
+#include "lldb/Target/Process.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+Platform *
+PlatformFreeBSD::CreateInstance ()
+{
+ return new PlatformFreeBSD();
+}
+
+const char *
+PlatformFreeBSD::GetPluginNameStatic()
+{
+ return "plugin.platform.FreeBSD";
+}
+
+const char *
+PlatformFreeBSD::GetPluginDescriptionStatic()
+{
+ return "Default platform plugin for FreeBSD";
+}
+
+void
+PlatformFreeBSD::Initialize ()
+{
+ static bool g_initialized = false;
+
+ if (!g_initialized)
+ {
+ PlatformSP default_platform_sp (CreateInstance());
+ Platform::SetDefaultPlatform (default_platform_sp);
+ PluginManager::RegisterPlugin(GetPluginNameStatic(),
+ GetPluginDescriptionStatic(),
+ CreateInstance);
+ g_initialized = true;
+ }
+}
+
+void
+PlatformFreeBSD::Terminate ()
+{
+ PluginManager::UnregisterPlugin (PlatformFreeBSD::CreateInstance);
+}
+
+
+Error
+PlatformFreeBSD::ResolveExecutable (const FileSpec &exe_file,
+ const ArchSpec &exe_arch,
+ lldb::ModuleSP &exe_module_sp)
+{
+ Error error;
+ // Nothing special to do here, just use the actual file and architecture
+
+ FileSpec resolved_exe_file (exe_file);
+
+ // If we have "ls" as the exe_file, resolve the executable loation based on
+ // the current path variables
+ if (!resolved_exe_file.Exists())
+ resolved_exe_file.ResolveExecutableLocation ();
+
+ // Resolve any executable within a bundle on MacOSX
+ Host::ResolveExecutableInBundle (resolved_exe_file);
+
+ if (resolved_exe_file.Exists())
+ {
+ if (exe_arch.IsValid())
+ {
+ error = ModuleList::GetSharedModule (resolved_exe_file,
+ exe_arch,
+ NULL,
+ NULL,
+ 0,
+ exe_module_sp,
+ NULL,
+ NULL);
+
+ if (exe_module_sp->GetObjectFile() == NULL)
+ {
+ exe_module_sp.reset();
+ error.SetErrorStringWithFormat ("'%s%s%s' doesn't contain the architecture %s",
+ exe_file.GetDirectory().AsCString(""),
+ exe_file.GetDirectory() ? "/" : "",
+ exe_file.GetFilename().AsCString(""),
+ exe_arch.GetArchitectureName());
+ }
+ }
+ else
+ {
+ // No valid architecture was specified, ask the platform for
+ // the architectures that we should be using (in the correct order)
+ // and see if we can find a match that way
+ StreamString arch_names;
+ ArchSpec platform_arch;
+ for (uint32_t idx = 0; GetSupportedArchitectureAtIndex (idx, platform_arch); ++idx)
+ {
+ error = ModuleList::GetSharedModule (resolved_exe_file,
+ platform_arch,
+ NULL,
+ NULL,
+ 0,
+ exe_module_sp,
+ NULL,
+ NULL);
+ // Did we find an executable using one of the
+ if (error.Success())
+ {
+ if (exe_module_sp && exe_module_sp->GetObjectFile())
+ break;
+ else
+ error.SetErrorToGenericError();
+ }
+
+ if (idx > 0)
+ arch_names.PutCString (", ");
+ arch_names.PutCString (platform_arch.GetArchitectureName());
+ }
+
+ if (error.Fail() || !exe_module_sp)
+ {
+ error.SetErrorStringWithFormat ("'%s%s%s' doesn't contain any '%s' platform architectures: %s",
+ exe_file.GetDirectory().AsCString(""),
+ exe_file.GetDirectory() ? "/" : "",
+ exe_file.GetFilename().AsCString(""),
+ GetShortPluginName(),
+ arch_names.GetString().c_str());
+ }
+ }
+ }
+ else
+ {
+ error.SetErrorStringWithFormat ("'%s%s%s' does not exist",
+ exe_file.GetDirectory().AsCString(""),
+ exe_file.GetDirectory() ? "/" : "",
+ exe_file.GetFilename().AsCString(""));
+ }
+
+ return error;
+}
+
+Error
+PlatformFreeBSD::GetFile (const FileSpec &platform_file,
+ const UUID *uuid, FileSpec &local_file)
+{
+ // Default to the local case
+ local_file = platform_file;
+ return Error();
+}
+
+
+//------------------------------------------------------------------
+/// Default Constructor
+//------------------------------------------------------------------
+PlatformFreeBSD::PlatformFreeBSD () :
+ Platform(true)
+{
+}
+
+//------------------------------------------------------------------
+/// Destructor.
+///
+/// The destructor is virtual since this class is designed to be
+/// inherited from by the plug-in instance.
+//------------------------------------------------------------------
+PlatformFreeBSD::~PlatformFreeBSD()
+{
+}
+
+bool
+PlatformFreeBSD::GetProcessInfo (lldb::pid_t pid, ProcessInstanceInfo &process_info)
+{
+ return Host::GetProcessInfo (pid, process_info);
+}
+
+bool
+PlatformFreeBSD::GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch)
+{
+ if (idx == 0)
+ {
+ arch = Host::GetArchitecture (Host::eSystemDefaultArchitecture);
+ return arch.IsValid();
+ }
+ return false;
+}
+
+void
+PlatformFreeBSD::GetStatus (Stream &strm)
+{
+ struct utsname un;
+
+ if (uname(&un)) {
+ strm << "FreeBSD";
+ return;
+ }
+
+ strm << un.sysname << ' ' << un.release << ' ' << un.version << '\n';
+}
+
+size_t
+PlatformFreeBSD::GetSoftwareBreakpointTrapOpcode (Target &target,
+ BreakpointSite *bp_site)
+{
+ static const uint8_t g_i386_opcode[] = { 0xCC };
+
+ ArchSpec arch = target.GetArchitecture();
+ const uint8_t *opcode = NULL;
+ size_t opcode_size = 0;
+
+ switch (arch.GetCore())
+ {
+ default:
+ assert(false && "CPU type not supported!");
+ break;
+
+ case ArchSpec::eCore_x86_32_i386:
+ case ArchSpec::eCore_x86_64_x86_64:
+ opcode = g_i386_opcode;
+ opcode_size = sizeof(g_i386_opcode);
+ break;
+ }
+
+ bp_site->SetTrapOpcode(opcode, opcode_size);
+ return opcode_size;
+}
+
+lldb::ProcessSP
+PlatformFreeBSD::Attach(lldb::pid_t pid,
+ Debugger &debugger,
+ Target *target,
+ Listener &listener,
+ Error &error)
+{
+ ProcessSP processSP;
+ assert(!"Not implemented yet!");
+ return processSP;
+}
Added: lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h?rev=136720&view=auto
==============================================================================
--- lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h (added)
+++ lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h Tue Aug 2 15:52:42 2011
@@ -0,0 +1,109 @@
+//===-- PlatformFreeBSD.h -----------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_PlatformFreeBSD_h_
+#define liblldb_PlatformFreeBSD_h_
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/Target/Platform.h"
+
+namespace lldb_private {
+
+ class PlatformFreeBSD : public Platform
+ {
+ public:
+
+ static void
+ Initialize ();
+
+ static void
+ Terminate ();
+
+ PlatformFreeBSD ();
+
+ virtual
+ ~PlatformFreeBSD();
+
+ //------------------------------------------------------------
+ // lldb_private::PluginInterface functions
+ //------------------------------------------------------------
+ static Platform *
+ CreateInstance ();
+
+ static const char *
+ GetPluginNameStatic();
+
+ static const char *
+ GetPluginDescriptionStatic();
+
+ virtual const char *
+ GetPluginName()
+ {
+ return GetPluginNameStatic();
+ }
+
+ virtual const char *
+ GetShortPluginName()
+ {
+ return "PlatformFreeBSD";
+ }
+
+ virtual uint32_t
+ GetPluginVersion()
+ {
+ return 1;
+ }
+
+ //------------------------------------------------------------
+ // lldb_private::Platform functions
+ //------------------------------------------------------------
+ virtual Error
+ ResolveExecutable (const FileSpec &exe_file,
+ const ArchSpec &arch,
+ lldb::ModuleSP &module_sp);
+
+ virtual const char *
+ GetDescription ()
+ {
+ return GetPluginDescriptionStatic();
+ }
+
+ virtual void
+ GetStatus (Stream &strm);
+
+ virtual Error
+ GetFile (const FileSpec &platform_file,
+ const UUID* uuid, FileSpec &local_file);
+
+ virtual bool
+ GetProcessInfo (lldb::pid_t pid, ProcessInstanceInfo &proc_info);
+
+ virtual bool
+ GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch);
+
+ virtual size_t
+ GetSoftwareBreakpointTrapOpcode (Target &target,
+ BreakpointSite *bp_site);
+
+ virtual lldb::ProcessSP
+ Attach(lldb::pid_t pid, Debugger &debugger, Target *target,
+ Listener &listener, Error &error);
+
+ protected:
+
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN (PlatformFreeBSD);
+ };
+} // namespace lldb_private
+
+#endif // liblldb_PlatformFreeBSD_h_
Modified: lldb/trunk/source/Plugins/Platform/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Makefile?rev=136720&r1=136719&r2=136720&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Makefile (original)
+++ lldb/trunk/source/Plugins/Platform/Makefile Tue Aug 2 15:52:42 2011
@@ -19,6 +19,10 @@
ifeq ($(HOST_OS),Linux)
DIRS += Linux
-endif
+endif
+
+ifeq ($(HOST_OS),FreeBSD)
+ DIRS += FreeBSD
+endif
include $(LLDB_LEVEL)/Makefile
Modified: lldb/trunk/source/lldb.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/lldb.cpp?rev=136720&r1=136719&r2=136720&view=diff
==============================================================================
--- lldb/trunk/source/lldb.cpp (original)
+++ lldb/trunk/source/lldb.cpp Tue Aug 2 15:52:42 2011
@@ -56,6 +56,10 @@
#include "Plugins/Process/Linux/ProcessLinux.h"
#endif
+#if defined (__FreeBSD__)
+#include "Plugins/Platform/FreeBSD/PlatformFreeBSD.h"
+#endif
+
#include "Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h"
#include "Plugins/DynamicLoader/Static/DynamicLoaderStatic.h"
@@ -116,6 +120,9 @@
ProcessLinux::Initialize();
DynamicLoaderLinuxDYLD::Initialize();
#endif
+#if defined (__FreeBSD__)
+ PlatformFreeBSD::Initialize();
+#endif
//----------------------------------------------------------------------
// Platform agnostic plugins
//----------------------------------------------------------------------
@@ -181,6 +188,10 @@
ProcessLinux::Terminate();
DynamicLoaderLinuxDYLD::Terminate();
#endif
+
+#if defined (__FreeBSD__)
+ PlatformFreeBSD::Terminate();
+#endif
DynamicLoaderStatic::Terminate();
Modified: lldb/trunk/tools/driver/IOChannel.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/IOChannel.h?rev=136720&r1=136719&r2=136720&view=diff
==============================================================================
--- lldb/trunk/tools/driver/IOChannel.h (original)
+++ lldb/trunk/tools/driver/IOChannel.h Tue Aug 2 15:52:42 2011
@@ -13,7 +13,11 @@
#include
#include
+#if defined(__FreeBSD__)
+#include
+#else
#include
+#endif
#include
#include
#include
Modified: lldb/trunk/tools/driver/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Makefile?rev=136720&r1=136719&r2=136720&view=diff
==============================================================================
--- lldb/trunk/tools/driver/Makefile (original)
+++ lldb/trunk/tools/driver/Makefile Tue Aug 2 15:52:42 2011
@@ -23,3 +23,9 @@
LD.Flags += -Wl,-rpath,$(LibDir)
endif
+ifeq ($(HOST_OS),FreeBSD)
+ CPP.Flags += -I/usr/include/edit #-v
+ LD.Flags += -lEnhancedDisassembly
+ LD.Flags += -Wl,-rpath,$(LibDir)
+endif
+
From scallanan at apple.com Tue Aug 2 17:21:50 2011
From: scallanan at apple.com (Sean Callanan)
Date: Tue, 02 Aug 2011 22:21:50 -0000
Subject: [Lldb-commits] [lldb] r136733 - in /lldb/trunk:
source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
test/lang/cpp/static_methods/ test/lang/cpp/static_methods/Makefile
test/lang/cpp/static_methods/TestCPPStaticMethods.py
test/lang/cpp/static_methods/main.cpp
Message-ID: <20110802222150.71A432A6C12C@llvm.org>
Author: spyffe
Date: Tue Aug 2 17:21:50 2011
New Revision: 136733
URL: http://llvm.org/viewvc/llvm-project?rev=136733&view=rev
Log:
Fixed a bug in which the DWARF reader did not distinguish
appropriately between C++ static methods and non-static
methods. This bug made it impossible to call most static
methods, either because Clang did not recognize that a
method could be called without providing a "this"
parameter, or because Clang did not properly mangle the
name of the method when searching for it in the target.
Also added a testcase.
Added:
lldb/trunk/test/lang/cpp/static_methods/
lldb/trunk/test/lang/cpp/static_methods/Makefile
lldb/trunk/test/lang/cpp/static_methods/TestCPPStaticMethods.py
lldb/trunk/test/lang/cpp/static_methods/main.cpp
Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=136733&r1=136732&r2=136733&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Tue Aug 2 17:21:50 2011
@@ -2396,6 +2396,7 @@
DWARFCompileUnit* dwarf_cu,
const DWARFDebugInfoEntry *parent_die,
bool skip_artificial,
+ bool &is_static,
TypeList* type_list,
std::vector& function_param_types,
std::vector& function_param_decls,
@@ -2481,7 +2482,7 @@
const DWARFDebugInfoEntry *grandparent_die = parent_die->GetParent();
if (grandparent_die && (grandparent_die->Tag() == DW_TAG_structure_type ||
grandparent_die->Tag() == DW_TAG_class_type))
- {
+ {
LanguageType language = sc.comp_unit->GetLanguage();
if (language == eLanguageTypeObjC_plus_plus || language == eLanguageTypeC_plus_plus)
{
@@ -2492,10 +2493,12 @@
{
Type *this_type = ResolveTypeUID (param_type_die_offset);
if (this_type)
- {
+ {
uint32_t encoding_mask = this_type->GetEncodingMask();
if (encoding_mask & Type::eEncodingIsPointerUID)
{
+ is_static = false;
+
if (encoding_mask & (1u << Type::eEncodingIsConstUID))
type_quals |= clang::Qualifiers::Const;
if (encoding_mask & (1u << Type::eEncodingIsVolatileUID))
@@ -3567,6 +3570,12 @@
std::vector function_param_decls;
// Parse the function children for the parameters
+
+ const DWARFDebugInfoEntry *class_die = die->GetParent();
+ if (class_die && (class_die->Tag() == DW_TAG_structure_type ||
+ class_die->Tag() == DW_TAG_class_type))
+ is_static = true;
+
if (die->HasChildren())
{
bool skip_artificial = true;
@@ -3574,7 +3583,8 @@
type_sp,
dwarf_cu,
die,
- skip_artificial,
+ skip_artificial,
+ is_static,
type_list,
function_param_types,
function_param_decls,
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h?rev=136733&r1=136732&r2=136733&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Tue Aug 2 17:21:50 2011
@@ -275,6 +275,7 @@
DWARFCompileUnit* dwarf_cu,
const DWARFDebugInfoEntry *parent_die,
bool skip_artificial,
+ bool &is_static,
lldb_private::TypeList* type_list,
std::vector& function_args,
std::vector& function_param_decls,
Added: lldb/trunk/test/lang/cpp/static_methods/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/static_methods/Makefile?rev=136733&view=auto
==============================================================================
--- lldb/trunk/test/lang/cpp/static_methods/Makefile (added)
+++ lldb/trunk/test/lang/cpp/static_methods/Makefile Tue Aug 2 17:21:50 2011
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules
Added: lldb/trunk/test/lang/cpp/static_methods/TestCPPStaticMethods.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/static_methods/TestCPPStaticMethods.py?rev=136733&view=auto
==============================================================================
--- lldb/trunk/test/lang/cpp/static_methods/TestCPPStaticMethods.py (added)
+++ lldb/trunk/test/lang/cpp/static_methods/TestCPPStaticMethods.py Tue Aug 2 17:21:50 2011
@@ -0,0 +1,51 @@
+"""
+Tests expressions that distinguish between static and non-static methods.
+"""
+
+from lldbtest import *
+
+class CPPStaticMethodsTestCase(TestBase):
+
+ mydir = os.path.join("lang", "cpp", "static_methods")
+
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ def test_with_dsym_and_run_command(self):
+ """Test that static methods are properly distinguished from regular methods"""
+ self.buildDsym()
+ self.static_method_commands()
+
+ def test_with_dwarf_and_run_command(self):
+ """Test that static methods are properly distinguished from regular methods"""
+ self.buildDwarf()
+ self.static_method_commands()
+
+ def setUp(self):
+ TestBase.setUp(self)
+ self.line = line_number('main.cpp', '// Break at this line')
+
+ def static_method_commands(self):
+ """Test that static methods are properly distinguished from regular methods"""
+ self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
+
+ self.expect("breakpoint set -f main.cpp -l %d" % self.line,
+ BREAKPOINT_CREATED,
+ startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" % self.line)
+
+ self.runCmd("process launch", RUN_SUCCEEDED)
+
+ # The stop reason of the thread should be breakpoint.
+ self.expect("thread list",
+ STOPPED_DUE_TO_BREAKPOINT,
+ substrs = ['stopped', 'stop reason = breakpoint'])
+
+ self.expect("expression -- A::getStaticValue()",
+ startstr = "(int) $0 = 5")
+
+ self.expect("expression -- my_a.getMemberValue()",
+ startstr = "(int) $1 = 3")
+
+if __name__ == '__main__':
+ import atexit
+ lldb.SBDebugger.Initialize()
+ atexit.register(lambda: lldb.SBDebugger.Terminate())
+ unittest2.main()
\ No newline at end of file
Added: lldb/trunk/test/lang/cpp/static_methods/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/static_methods/main.cpp?rev=136733&view=auto
==============================================================================
--- lldb/trunk/test/lang/cpp/static_methods/main.cpp (added)
+++ lldb/trunk/test/lang/cpp/static_methods/main.cpp Tue Aug 2 17:21:50 2011
@@ -0,0 +1,38 @@
+//===-- main.cpp ------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include
+
+class A
+{
+public:
+ static int getStaticValue();
+ int getMemberValue();
+ int a;
+};
+
+int A::getStaticValue()
+{
+ return 5;
+}
+
+int A::getMemberValue()
+{
+ return a;
+}
+
+int main()
+{
+ A my_a;
+
+ my_a.a = 3;
+
+ printf("%d\n", A::getStaticValue()); // Break at this line
+ printf("%d\n", my_a.getMemberValue());
+}
From johnny.chen at apple.com Tue Aug 2 17:54:37 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Tue, 02 Aug 2011 22:54:37 -0000
Subject: [Lldb-commits] [lldb] r136740 - in /lldb/trunk/test:
benchmarks/example/TestRepeatedExprs.py benchmarks/example/main.cpp
lldbbench.py lldbtest.py
Message-ID: <20110802225437.53A432A6C12C@llvm.org>
Author: johnny
Date: Tue Aug 2 17:54:37 2011
New Revision: 136740
URL: http://llvm.org/viewvc/llvm-project?rev=136740&view=rev
Log:
Add the real benchmarks comparing lldb against gdb for repeated expression evaluations.
Modify lldbbench.py so that lldbtest.line_number() utility function is available to
BenchBase client as just line_number(), and modify lldbtest.py so that self.lldbExec
(the full path for the 'lldb' executable) is available to BenchBase client as well.
An example run of the test case on my MacBook Pro running Lion:
1: test_compare_lldb_to_gdb (TestRepeatedExprs.RepeatedExprsCase)
Test repeated expressions with lldb vs. gdb. ...
lldb_avg: 0.204339
gdb_avg: 0.205721
lldb_avg/gdb_avg: 0.993284
ok
Modified:
lldb/trunk/test/benchmarks/example/TestRepeatedExprs.py
lldb/trunk/test/benchmarks/example/main.cpp
lldb/trunk/test/lldbbench.py
lldb/trunk/test/lldbtest.py
Modified: lldb/trunk/test/benchmarks/example/TestRepeatedExprs.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/benchmarks/example/TestRepeatedExprs.py?rev=136740&r1=136739&r2=136740&view=diff
==============================================================================
--- lldb/trunk/test/benchmarks/example/TestRepeatedExprs.py (original)
+++ lldb/trunk/test/benchmarks/example/TestRepeatedExprs.py Tue Aug 2 17:54:37 2011
@@ -1,6 +1,6 @@
"""Test evaluating expressions repeatedly comparing lldb against gdb."""
-import os
+import os, sys
import unittest2
import lldb
import pexpect
@@ -10,28 +10,118 @@
mydir = os.path.join("benchmarks", "example")
- @benchmarks_test
- def test_with_lldb(self):
- """Test repeated expressions with lldb."""
- self.buildDefault()
- self.run_lldb_repeated_exprs()
+ def setUp(self):
+ BenchBase.setUp(self)
+ self.source = 'main.cpp'
+ self.line_to_break = line_number(self.source, '// Set breakpoint here.')
+ self.lldb_avg = None
+ self.gdb_avg = None
@benchmarks_test
- def test_with_gdb(self):
- """Test repeated expressions with gdb."""
+ def test_compare_lldb_to_gdb(self):
+ """Test repeated expressions with lldb vs. gdb."""
self.buildDefault()
- self.run_gdb_repeated_exprs()
+ self.exe_name = 'a.out'
- def run_lldb_repeated_exprs(self):
- for i in range(1000):
+ print
+ self.run_lldb_repeated_exprs(self.exe_name, 100)
+ self.run_gdb_repeated_exprs(self.exe_name, 100)
+ print "lldb_avg: %f" % self.lldb_avg
+ print "gdb_avg: %f" % self.gdb_avg
+ print "lldb_avg/gdb_avg: %f" % (self.lldb_avg/self.gdb_avg)
+
+ def run_lldb_repeated_exprs(self, exe_name, count):
+ exe = os.path.join(os.getcwd(), exe_name)
+
+ # Set self.child_prompt, which is "(lldb) ".
+ self.child_prompt = '(lldb) '
+ prompt = self.child_prompt
+
+ # So that the child gets torn down after the test.
+ self.child = pexpect.spawn('%s %s' % (self.lldbExec, exe))
+ child = self.child
+
+ # Turn on logging for what the child sends back.
+ if self.TraceOn():
+ child.logfile_read = sys.stdout
+
+ child.expect_exact(prompt)
+ child.sendline('breakpoint set -f %s -l %d' % (self.source, self.line_to_break))
+ child.expect_exact(prompt)
+ child.sendline('run')
+ child.expect_exact(prompt)
+ expr_cmd1 = 'expr ptr[j]->point.x'
+ expr_cmd2 = 'expr ptr[j]->point.y'
+
+ # Reset the stopwatch now.
+ self.stopwatch.reset()
+ for i in range(count):
with self.stopwatch:
- print "running "+self.testMethodName
- print "benchmarks result for "+self.testMethodName
- print "stopwatch:", str(self.stopwatch)
-
- def run_gdb_repeated_exprs(self):
- print "running "+self.testMethodName
- print "benchmarks result for "+self.testMethodName
+ child.sendline(expr_cmd1)
+ child.expect_exact(prompt)
+ child.sendline(expr_cmd2)
+ child.expect_exact(prompt)
+ child.sendline('process continue')
+ child.expect_exact(prompt)
+
+ child.sendline('quit')
+ try:
+ self.child.expect(pexpect.EOF)
+ except:
+ pass
+
+ self.lldb_avg = self.stopwatch.avg()
+ if self.TraceOn():
+ print "lldb expression benchmark:", str(self.stopwatch)
+ self.child = None
+
+ def run_gdb_repeated_exprs(self, exe_name, count):
+ exe = os.path.join(os.getcwd(), exe_name)
+
+ # Set self.child_prompt, which is "(gdb) ".
+ self.child_prompt = '(gdb) '
+ prompt = self.child_prompt
+
+ # So that the child gets torn down after the test.
+ self.child = pexpect.spawn('gdb %s' % exe)
+ child = self.child
+
+ # Turn on logging for what the child sends back.
+ if self.TraceOn():
+ child.logfile_read = sys.stdout
+
+ child.expect_exact(prompt)
+ child.sendline('break %s:%d' % (self.source, self.line_to_break))
+ child.expect_exact(prompt)
+ child.sendline('run')
+ child.expect_exact(prompt)
+ expr_cmd1 = 'print ptr[j]->point.x'
+ expr_cmd2 = 'print ptr[j]->point.y'
+
+ # Reset the stopwatch now.
+ self.stopwatch.reset()
+ for i in range(count):
+ with self.stopwatch:
+ child.sendline(expr_cmd1)
+ child.expect_exact(prompt)
+ child.sendline(expr_cmd2)
+ child.expect_exact(prompt)
+ child.sendline('continue')
+ child.expect_exact(prompt)
+
+ child.sendline('quit')
+ child.expect_exact('The program is running. Exit anyway?')
+ child.sendline('y')
+ try:
+ self.child.expect(pexpect.EOF)
+ except:
+ pass
+
+ self.gdb_avg = self.stopwatch.avg()
+ if self.TraceOn():
+ print "gdb expression benchmark:", str(self.stopwatch)
+ self.child = None
+
if __name__ == '__main__':
import atexit
Modified: lldb/trunk/test/benchmarks/example/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/benchmarks/example/main.cpp?rev=136740&r1=136739&r2=136740&view=diff
==============================================================================
--- lldb/trunk/test/benchmarks/example/main.cpp (original)
+++ lldb/trunk/test/benchmarks/example/main.cpp Tue Aug 2 17:54:37 2011
@@ -30,13 +30,13 @@
}
printf("Finished populating data.\n");
- for (int i = 0; i < 1000; ++i) {
+ for (int j = 0; j < 1000; ++j) {
bool dump = argc > 1; // Set breakpoint here.
// Evaluate a couple of expressions (2*1000 = 2000 exprs):
- // expr ptr[i]->point.x
- // expr ptr[i]->point.y
+ // expr ptr[j]->point.x
+ // expr ptr[j]->point.y
if (dump) {
- printf("data[%d] = %d (%d, %d)\n", i, ptr[i]->id, ptr[i]->point.x, ptr[i]->point.y);
+ printf("data[%d] = %d (%d, %d)\n", j, ptr[j]->id, ptr[j]->point.x, ptr[j]->point.y);
}
}
return 0;
Modified: lldb/trunk/test/lldbbench.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbbench.py?rev=136740&r1=136739&r2=136740&view=diff
==============================================================================
--- lldb/trunk/test/lldbbench.py (original)
+++ lldb/trunk/test/lldbbench.py Tue Aug 2 17:54:37 2011
@@ -1,6 +1,7 @@
import time
-from lldbtest import benchmarks_test
from lldbtest import Base
+from lldbtest import benchmarks_test
+from lldbtest import line_number
class Stopwatch(object):
"""Stopwatch provides a simple utility to start/stop your stopwatch multiple
@@ -80,7 +81,7 @@
return self.__total_elapsed__ / self.__laps__
def __str__(self):
- return "Avg: %f (Laps: %d, Total Elapsed Time: %d)" % (self.avg(),
+ return "Avg: %f (Laps: %d, Total Elapsed Time: %f)" % (self.avg(),
self.__laps__,
self.__total_elapsed__)
Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=136740&r1=136739&r2=136740&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Tue Aug 2 17:54:37 2011
@@ -451,6 +451,9 @@
#import traceback
#traceback.print_stack()
+ if "LLDB_EXEC" in os.environ:
+ self.lldbExec = os.environ["LLDB_EXEC"]
+
# Assign the test method name to self.testMethodName.
#
# For an example of the use of this attribute, look at test/types dir.
@@ -837,9 +840,6 @@
# Works with the test driver to conditionally skip tests via decorators.
Base.setUp(self)
- if "LLDB_EXEC" in os.environ:
- self.lldbExec = os.environ["LLDB_EXEC"]
-
try:
if lldb.blacklist:
className = self.__class__.__name__
From granata.enrico at gmail.com Tue Aug 2 18:12:24 2011
From: granata.enrico at gmail.com (Enrico Granata)
Date: Tue, 02 Aug 2011 23:12:24 -0000
Subject: [Lldb-commits] [lldb] r136743 - in /lldb/trunk/source:
API/SBValue.cpp Core/ValueObject.cpp Core/ValueObjectDynamicValue.cpp
Core/ValueObjectSyntheticFilter.cpp
Message-ID: <20110802231224.8C9502A6C12D@llvm.org>
Author: enrico
Date: Tue Aug 2 18:12:24 2011
New Revision: 136743
URL: http://llvm.org/viewvc/llvm-project?rev=136743&view=rev
Log:
bug fix in SBValue::CreateValueFromAddress() where using the resulting VO as a pointer would crash LLDB ; minor improvements in dynamic formatters lookup
Modified:
lldb/trunk/source/API/SBValue.cpp
lldb/trunk/source/Core/ValueObject.cpp
lldb/trunk/source/Core/ValueObjectDynamicValue.cpp
lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp
Modified: lldb/trunk/source/API/SBValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValue.cpp?rev=136743&r1=136742&r2=136743&view=diff
==============================================================================
--- lldb/trunk/source/API/SBValue.cpp (original)
+++ lldb/trunk/source/API/SBValue.cpp Tue Aug 2 18:12:24 2011
@@ -457,6 +457,7 @@
GetTarget().GetProcess().GetAddressByteSize()));
result_valobj_sp->SetName(ConstString(name));
+ result_valobj_sp->GetValue().SetValueType(Value::eValueTypeLoadAddress);
result = SBValue(result_valobj_sp);
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=136743&r1=136742&r2=136743&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Tue Aug 2 18:12:24 2011
@@ -77,7 +77,7 @@
m_deref_valobj(NULL),
m_format (eFormatDefault),
m_last_format_mgr_revision(0),
- m_last_format_mgr_dynamic(lldb::eNoDynamicValues),
+ m_last_format_mgr_dynamic(parent.m_last_format_mgr_dynamic),
m_last_summary_format(),
m_forced_summary_format(),
m_last_value_format(),
@@ -532,7 +532,7 @@
const char *
ValueObject::GetSummaryAsCString ()
{
- if (UpdateValueIfNeeded (m_last_format_mgr_dynamic, true))
+ if (UpdateValueIfNeeded (true))
{
if (m_summary_str.empty())
{
@@ -788,7 +788,7 @@
ValueObject::GetObjectDescription ()
{
- if (!UpdateValueIfNeeded (m_last_format_mgr_dynamic, true))
+ if (!UpdateValueIfNeeded (true))
return NULL;
if (!m_object_desc_str.empty())
Modified: lldb/trunk/source/Core/ValueObjectDynamicValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectDynamicValue.cpp?rev=136743&r1=136742&r2=136743&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectDynamicValue.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectDynamicValue.cpp Tue Aug 2 18:12:24 2011
@@ -40,6 +40,7 @@
m_type_sp(),
m_use_dynamic (use_dynamic)
{
+ m_last_format_mgr_dynamic = use_dynamic;
SetName (parent.GetName());
}
Modified: lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp?rev=136743&r1=136742&r2=136743&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp Tue Aug 2 18:12:24 2011
@@ -64,7 +64,7 @@
ConstString
ValueObjectSynthetic::GetTypeName()
{
- const bool success = UpdateValueIfNeeded();
+ const bool success = UpdateValueIfNeeded(false);
if (success && m_type_sp)
return ClangASTType::GetConstTypeName (GetClangType());
else
@@ -90,7 +90,7 @@
size_t
ValueObjectSynthetic::GetByteSize()
{
- const bool success = UpdateValueIfNeeded();
+ const bool success = UpdateValueIfNeeded(false);
if (success && m_type_sp)
return m_value.GetValueByteSize(GetClangAST(), NULL);
else
@@ -109,7 +109,7 @@
SetValueIsValid (false);
m_error.Clear();
- if (!m_parent->UpdateValueIfNeeded())
+ if (!m_parent->UpdateValueIfNeeded(false))
{
// our parent could not update.. as we are meaningless without a parent, just stop
if (m_error.Success() && m_parent->GetError().Fail())
From jmolenda at apple.com Tue Aug 2 18:28:55 2011
From: jmolenda at apple.com (Jason Molenda)
Date: Tue, 02 Aug 2011 23:28:55 -0000
Subject: [Lldb-commits] [lldb] r136744 -
/lldb/trunk/source/Commands/CommandObjectTarget.cpp
Message-ID: <20110802232855.616392A6C12C@llvm.org>
Author: jmolenda
Date: Tue Aug 2 18:28:55 2011
New Revision: 136744
URL: http://llvm.org/viewvc/llvm-project?rev=136744&view=rev
Log:
Change CommandObjectTargetModulesAdd to set the return status
object on successful adding of a module.
Modified:
lldb/trunk/source/Commands/CommandObjectTarget.cpp
Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=136744&r1=136743&r2=136744&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Tue Aug 2 18:28:55 2011
@@ -2174,6 +2174,7 @@
result.SetStatus (eReturnStatusFailed);
return false;
}
+ result.SetStatus (eReturnStatusSuccessFinishResult);
}
else
{
From gclayton at apple.com Tue Aug 2 18:35:43 2011
From: gclayton at apple.com (Greg Clayton)
Date: Tue, 02 Aug 2011 23:35:43 -0000
Subject: [Lldb-commits] [lldb] r136745 - in /lldb/trunk:
include/lldb/Target/StackFrame.h source/Target/StackFrame.cpp
Message-ID: <20110802233543.5EF662A6C12C@llvm.org>
Author: gclayton
Date: Tue Aug 2 18:35:43 2011
New Revision: 136745
URL: http://llvm.org/viewvc/llvm-project?rev=136745&view=rev
Log:
Fixed an issue where StackFrame::GetValueForVariableExpressionPath(...)
was previously using the entire frame variable list instead of using the
in scope variable list. I added a new function to a stack frame:
lldb::VariableListSP
StackFrame::GetInScopeVariableList (bool get_file_globals);
This gets only variables that are in scope and they will be ordered such
that the variables from the current scope are first.
Modified:
lldb/trunk/include/lldb/Target/StackFrame.h
lldb/trunk/source/Target/StackFrame.cpp
Modified: lldb/trunk/include/lldb/Target/StackFrame.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/StackFrame.h?rev=136745&r1=136744&r2=136745&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/StackFrame.h (original)
+++ lldb/trunk/include/lldb/Target/StackFrame.h Tue Aug 2 18:35:43 2011
@@ -101,6 +101,9 @@
VariableList *
GetVariableList (bool get_file_globals);
+ lldb::VariableListSP
+ GetInScopeVariableList (bool get_file_globals);
+
// See ExpressionPathOption enumeration for "options" values
lldb::ValueObjectSP
GetValueForVariableExpressionPath (const char *var_expr,
Modified: lldb/trunk/source/Target/StackFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrame.cpp?rev=136745&r1=136744&r2=136745&view=diff
==============================================================================
--- lldb/trunk/source/Target/StackFrame.cpp (original)
+++ lldb/trunk/source/Target/StackFrame.cpp Tue Aug 2 18:35:43 2011
@@ -485,6 +485,34 @@
return m_variable_list_sp.get();
}
+VariableListSP
+StackFrame::GetInScopeVariableList (bool get_file_globals)
+{
+ VariableListSP var_list_sp(new VariableList);
+ GetSymbolContext (eSymbolContextCompUnit | eSymbolContextBlock);
+
+ if (m_sc.block)
+ {
+ const bool can_create = true;
+ const bool get_parent_variables = true;
+ const bool stop_if_block_is_inlined_function = true;
+ m_sc.block->AppendVariables (can_create,
+ get_parent_variables,
+ stop_if_block_is_inlined_function,
+ var_list_sp.get());
+ }
+
+ if (m_sc.comp_unit)
+ {
+ VariableListSP global_variable_list_sp (m_sc.comp_unit->GetVariableList(true));
+ if (global_variable_list_sp)
+ var_list_sp->AddVariables (global_variable_list_sp.get());
+ }
+
+ return var_list_sp;
+}
+
+
ValueObjectSP
StackFrame::GetValueForVariableExpressionPath (const char *var_expr_cstr,
lldb::DynamicValueType use_dynamic,
@@ -502,7 +530,10 @@
bool address_of = false;
ValueObjectSP valobj_sp;
const bool get_file_globals = true;
- VariableList *variable_list = GetVariableList (get_file_globals);
+ // When looking up a variable for an expression, we need only consider the
+ // variables that are in scope.
+ VariableListSP var_list_sp (GetInScopeVariableList (get_file_globals));
+ VariableList *variable_list = var_list_sp.get();
if (variable_list)
{
From jingham at apple.com Tue Aug 2 20:00:07 2011
From: jingham at apple.com (Jim Ingham)
Date: Wed, 03 Aug 2011 01:00:07 -0000
Subject: [Lldb-commits] [lldb] r136754 - /lldb/trunk/source/Target/Target.cpp
Message-ID: <20110803010007.268502A6C12C@llvm.org>
Author: jingham
Date: Tue Aug 2 20:00:06 2011
New Revision: 136754
URL: http://llvm.org/viewvc/llvm-project?rev=136754&view=rev
Log:
Fix a copy/paste error in a comment.
Modified:
lldb/trunk/source/Target/Target.cpp
Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=136754&r1=136753&r2=136754&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Tue Aug 2 20:00:06 2011
@@ -541,7 +541,7 @@
void
Target::ModuleUpdated (ModuleSP &old_module_sp, ModuleSP &new_module_sp)
{
- // A module is being added to this target for the first time
+ // A module is replacing an already added module
ModuleList module_list;
module_list.Append (old_module_sp);
ModulesDidUnload (module_list);
From jingham at apple.com Tue Aug 2 20:03:17 2011
From: jingham at apple.com (Jim Ingham)
Date: Wed, 03 Aug 2011 01:03:17 -0000
Subject: [Lldb-commits] [lldb] r136755 - in /lldb/trunk:
include/lldb/Core/Module.h source/Core/Module.cpp
source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
Message-ID: <20110803010318.040FD2A6C12C@llvm.org>
Author: jingham
Date: Tue Aug 2 20:03:17 2011
New Revision: 136755
URL: http://llvm.org/viewvc/llvm-project?rev=136755&view=rev
Log:
Add method Module::IsLoadedInTarget, and then in the MacOS X dynamic loader, after we
have initialized our shared library state, discard all the modules that didn't make
it into the running process.
Modified:
lldb/trunk/include/lldb/Core/Module.h
lldb/trunk/source/Core/Module.cpp
lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
Modified: lldb/trunk/include/lldb/Core/Module.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Module.h?rev=136755&r1=136754&r2=136755&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Module.h (original)
+++ lldb/trunk/include/lldb/Core/Module.h Tue Aug 2 20:03:17 2011
@@ -399,6 +399,20 @@
//------------------------------------------------------------------
bool
IsExecutable ();
+
+ //------------------------------------------------------------------
+ /// Tells whether this module has been loaded in the target passed in.
+ /// This call doesn't distinguish between whether the module is loaded
+ /// by the dynamic loader, or by a "target module add" type call.
+ ///
+ /// @param[in] target
+ /// The target to check whether this is loaded in.
+ ///
+ /// @return
+ /// \b true if it is, \b false otherwise.
+ //------------------------------------------------------------------
+ bool
+ IsLoadedInTarget (Target *target);
//------------------------------------------------------------------
/// Get the number of compile units for this module.
Modified: lldb/trunk/source/Core/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=136755&r1=136754&r2=136755&view=diff
==============================================================================
--- lldb/trunk/source/Core/Module.cpp (original)
+++ lldb/trunk/source/Core/Module.cpp Tue Aug 2 20:03:17 2011
@@ -690,6 +690,29 @@
return GetObjectFile()->IsExecutable();
}
+bool
+Module::IsLoadedInTarget (Target *target)
+{
+ ObjectFile *obj_file = GetObjectFile();
+ if (obj_file)
+ {
+ SectionList *sections = obj_file->GetSectionList();
+ if (sections != NULL)
+ {
+ size_t num_sections = sections->GetSize();
+ bool loaded = false;
+ for (size_t sect_idx = 0; sect_idx < num_sections; sect_idx++)
+ {
+ SectionSP section_sp = sections->GetSectionAtIndex(sect_idx);
+ if (section_sp->GetLoadBaseAddress(target) != LLDB_INVALID_ADDRESS)
+ {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+}
bool
Module::SetArchitecture (const ArchSpec &new_arch)
{
Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp?rev=136755&r1=136754&r2=136755&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp Tue Aug 2 20:03:17 2011
@@ -947,6 +947,36 @@
}
}
}
+
+ // Now we have one more bit of business. If there is a library left in the images for our target that
+ // doesn't have a load address, then it must be something that we were expecting to load (for instance we
+ // read a load command for it) but it didn't in fact load - probably because DYLD_*_PATH pointed
+ // to an equivalent version. We don't want it to stay in the target's module list or it will confuse
+ // us, so unload it here.
+ Target *target = m_process->CalculateTarget();
+ ModuleList &modules = target->GetImages();
+ ModuleList not_loaded_modules;
+ size_t num_modules = modules.GetSize();
+ for (size_t i = 0; i < num_modules; i++)
+ {
+ ModuleSP module_sp = modules.GetModuleAtIndex(i);
+ if (!module_sp->IsLoadedInTarget (target))
+ {
+ if (log)
+ {
+ StreamString s;
+ module_sp->GetDescription (&s);
+ log->Printf ("Unloading pre-run module: %s.", s.GetData ());
+ }
+ not_loaded_modules.Append (module_sp);
+ }
+ }
+
+ if (not_loaded_modules.GetSize() != 0)
+ {
+ target->ModulesDidUnload(not_loaded_modules);
+ }
+
return true;
}
else
From gclayton at apple.com Tue Aug 2 20:23:56 2011
From: gclayton at apple.com (Greg Clayton)
Date: Wed, 03 Aug 2011 01:23:56 -0000
Subject: [Lldb-commits] [lldb] r136758 - /lldb/trunk/source/Target/Target.cpp
Message-ID: <20110803012356.0C4EB2A6C12C@llvm.org>
Author: gclayton
Date: Tue Aug 2 20:23:55 2011
New Revision: 136758
URL: http://llvm.org/viewvc/llvm-project?rev=136758&view=rev
Log:
Create the scratch AST context in the accessor function, not
only when the executable is set.
Modified:
lldb/trunk/source/Target/Target.cpp
Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=136758&r1=136757&r2=136758&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Tue Aug 2 20:23:55 2011
@@ -465,11 +465,6 @@
}
}
- // Now see if we know the target triple, and if so, create our scratch AST context:
- if (m_arch.IsValid())
- {
- m_scratch_ast_context_ap.reset (new ClangASTContext(m_arch.GetTriple().str().c_str()));
- }
}
UpdateInstanceName();
@@ -911,6 +906,9 @@
ClangASTContext *
Target::GetScratchClangASTContext()
{
+ // Now see if we know the target triple, and if so, create our scratch AST context:
+ if (m_scratch_ast_context_ap.get() == NULL && m_arch.IsValid())
+ m_scratch_ast_context_ap.reset (new ClangASTContext(m_arch.GetTriple().str().c_str()));
return m_scratch_ast_context_ap.get();
}
From johnny.chen at apple.com Tue Aug 2 20:34:29 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Wed, 03 Aug 2011 01:34:29 -0000
Subject: [Lldb-commits] [lldb] r136760 - in
/lldb/trunk/test/functionalities/non-overlapping-index-variable-i: ./
Makefile TestIndexVariable.py main.cpp
Message-ID: <20110803013429.4AAB42A6C12C@llvm.org>
Author: johnny
Date: Tue Aug 2 20:34:29 2011
New Revision: 136760
URL: http://llvm.org/viewvc/llvm-project?rev=136760&view=rev
Log:
Add a test file to go with r136745. It fails, though, for:
expr ptr[i]->point.x
Radar to be filed.
Added:
lldb/trunk/test/functionalities/non-overlapping-index-variable-i/
lldb/trunk/test/functionalities/non-overlapping-index-variable-i/Makefile
lldb/trunk/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py
lldb/trunk/test/functionalities/non-overlapping-index-variable-i/main.cpp
Added: lldb/trunk/test/functionalities/non-overlapping-index-variable-i/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/non-overlapping-index-variable-i/Makefile?rev=136760&view=auto
==============================================================================
--- lldb/trunk/test/functionalities/non-overlapping-index-variable-i/Makefile (added)
+++ lldb/trunk/test/functionalities/non-overlapping-index-variable-i/Makefile Tue Aug 2 20:34:29 2011
@@ -0,0 +1,5 @@
+LEVEL = ../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules
Added: lldb/trunk/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py?rev=136760&view=auto
==============================================================================
--- lldb/trunk/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py (added)
+++ lldb/trunk/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py Tue Aug 2 20:34:29 2011
@@ -0,0 +1,52 @@
+"""Test evaluating expressions which ref. index variable 'i' which just goes
+from out of scope to in scope when stopped at the breakpoint."""
+
+import unittest2
+import lldb
+from lldbtest import *
+
+class NonOverlappingIndexVariableCase(TestBase):
+
+ mydir = os.path.join("functionalities", "non-overlapping-index-variable-i")
+
+ def setUp(self):
+ TestBase.setUp(self)
+ self.source = 'main.cpp'
+ self.line_to_break = line_number(self.source, '// Set breakpoint here.')
+ self.lldb_avg = None
+ self.gdb_avg = None
+
+ def test_eval_index_variable(self):
+ """Test expressions of variable 'i' which appears in two for loops."""
+ self.buildDefault()
+ self.exe_name = 'a.out'
+ self.eval_index_variable_i(self.exe_name)
+
+ def eval_index_variable_i(self, exe_name):
+ """Test expressions of variable 'i' which appears in two for loops."""
+ self.runCmd("file %s" % exe_name, CURRENT_EXECUTABLE_SET)
+
+ self.expect('breakpoint set -f %s -l %d' % (self.source, self.line_to_break),
+ BREAKPOINT_CREATED,
+ startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
+ (self.source, self.line_to_break))
+
+ self.runCmd("run", RUN_SUCCEEDED)
+
+ # The stop reason of the thread should be breakpoint.
+ self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+ substrs = ['stopped',
+ 'stop reason = breakpoint'])
+
+ self.runCmd('frame variable i')
+ self.runCmd('expr i')
+ self.runCmd('expr ptr[0]->point.x')
+ self.runCmd('expr ptr[0]->point.y')
+ self.runCmd('expr ptr[i]->point.x')
+ self.runCmd('expr ptr[i]->point.y')
+
+if __name__ == '__main__':
+ import atexit
+ lldb.SBDebugger.Initialize()
+ atexit.register(lambda: lldb.SBDebugger.Terminate())
+ unittest2.main()
Added: lldb/trunk/test/functionalities/non-overlapping-index-variable-i/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/non-overlapping-index-variable-i/main.cpp?rev=136760&view=auto
==============================================================================
--- lldb/trunk/test/functionalities/non-overlapping-index-variable-i/main.cpp (added)
+++ lldb/trunk/test/functionalities/non-overlapping-index-variable-i/main.cpp Tue Aug 2 20:34:29 2011
@@ -0,0 +1,43 @@
+#include
+
+class Point {
+public:
+ int x;
+ int y;
+ Point(int a, int b):
+ x(a),
+ y(b)
+ {}
+};
+
+class Data {
+public:
+ int id;
+ Point point;
+ Data(int i):
+ id(i),
+ point(0, 0)
+ {}
+};
+
+int main(int argc, char const *argv[]) {
+ Data *data[1000];
+ Data **ptr = data;
+ for (int i = 0; i < 1000; ++i) {
+ ptr[i] = new Data(i);
+ ptr[i]->point.x = i;
+ ptr[i]->point.y = i+1;
+ }
+
+ printf("Finished populating data.\n");
+ for (int i = 0; i < 1000; ++i) {
+ bool dump = argc > 1; // Set breakpoint here.
+ // Evaluate a couple of expressions (2*1000 = 2000 exprs):
+ // expr ptr[i]->point.x
+ // expr ptr[i]->point.y
+ if (dump) {
+ printf("data[%d] = %d (%d, %d)\n", i, ptr[i]->id, ptr[i]->point.x, ptr[i]->point.y);
+ }
+ }
+ return 0;
+}
From granata.enrico at gmail.com Tue Aug 2 21:18:51 2011
From: granata.enrico at gmail.com (Enrico Granata)
Date: Wed, 03 Aug 2011 02:18:51 -0000
Subject: [Lldb-commits] [lldb] r136763 - in /lldb/trunk:
include/lldb/Core/FormatManager.h source/Core/ValueObject.cpp
source/Core/ValueObjectDynamicValue.cpp
source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
test/lang/objc/objc-dynamic-value/TestObjCDynamicValue.py
Message-ID: <20110803021851.BE2EC2A6C12C@llvm.org>
Author: enrico
Date: Tue Aug 2 21:18:51 2011
New Revision: 136763
URL: http://llvm.org/viewvc/llvm-project?rev=136763&view=rev
Log:
Fixed an issue where the KVO swizzled type would be returned as the dynamic type instead of the actual user-level type
- see the test case in lang/objc/objc-dynamic-value for an example
Objective-C dynamic type lookup now works for every Objective-C type
- previously, true dynamic lookup was only performed for type id
Modified:
lldb/trunk/include/lldb/Core/FormatManager.h
lldb/trunk/source/Core/ValueObject.cpp
lldb/trunk/source/Core/ValueObjectDynamicValue.cpp
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
lldb/trunk/test/lang/objc/objc-dynamic-value/TestObjCDynamicValue.py
Modified: lldb/trunk/include/lldb/Core/FormatManager.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/FormatManager.h?rev=136763&r1=136762&r2=136763&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/FormatManager.h (original)
+++ lldb/trunk/include/lldb/Core/FormatManager.h Tue Aug 2 21:18:51 2011
@@ -360,12 +360,13 @@
if (log)
log->Printf("appended bitfield info, final result is %s", name.GetCString());
}
+ const char* typeName = name.GetCString();
if (log)
log->Printf("trying to get %s for VO name %s of type %s",
m_name.c_str(),
vobj.GetName().AsCString(),
- name.AsCString());
- if (Get(name.GetCString(), entry))
+ typeName);
+ if (Get(typeName, entry))
{
if (log)
log->Printf("direct match found, returning");
@@ -385,7 +386,8 @@
}
}
if (use_dynamic != lldb::eNoDynamicValues &&
- typePtr == vobj.GetClangAST()->ObjCBuiltinIdTy.getTypePtr())
+ (/*strstr(typeName, "id") == typeName ||*/
+ ClangASTType::GetMinimumLanguage(vobj.GetClangAST(), vobj.GetClangType()) == lldb::eLanguageTypeObjC))
{
if (log)
log->Printf("this is an ObjC 'id', let's do dynamic search");
Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=136763&r1=136762&r2=136763&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Tue Aug 2 21:18:51 2011
@@ -93,7 +93,7 @@
m_is_bitfield_for_scalar(false),
m_is_expression_path_child(false),
m_is_child_at_offset(false),
- m_is_expression_result(false),
+ m_is_expression_result(parent.m_is_expression_result),
m_dump_printable_counter(0)
{
m_manager->ManageObject(this);
@@ -240,7 +240,7 @@
m_synthetic_value = NULL;
- Debugger::Formatting::ValueFormats::Get(*this, use_dynamic, m_last_value_format);
+ Debugger::Formatting::ValueFormats::Get(*this, lldb::eNoDynamicValues, m_last_value_format);
Debugger::Formatting::GetSummaryFormat(*this, use_dynamic, m_last_summary_format);
Debugger::Formatting::GetSyntheticFilter(*this, use_dynamic, m_last_synthetic_filter);
@@ -2599,23 +2599,26 @@
// Always show the type for the top level items.
if (show_types || (curr_depth == 0 && !flat_output))
{
- s.Printf("(%s", valobj->GetTypeName().AsCString(""));
- if (use_dynamic != lldb::eNoDynamicValues &&
- strcmp(valobj->GetTypeName().AsCString("NULL"), "id") == 0)
+ const char* typeName = valobj->GetTypeName().AsCString("");
+ s.Printf("(%s", typeName);
+ // only show dynamic types if the user really wants to see types
+ if (show_types && use_dynamic != lldb::eNoDynamicValues &&
+ (/*strstr(typeName, "id") == typeName ||*/
+ ClangASTType::GetMinimumLanguage(valobj->GetClangAST(), valobj->GetClangType()) == lldb::eLanguageTypeObjC))
{
Process* process = valobj->GetUpdatePoint().GetProcessSP().get();
if (process == NULL)
- s.Printf(") ");
+ s.Printf(", dynamic type: unknown) ");
else
{
ObjCLanguageRuntime *runtime = process->GetObjCLanguageRuntime();
if (runtime == NULL)
- s.Printf(") ");
+ s.Printf(", dynamic type: unknown) ");
else
{
ObjCLanguageRuntime::ObjCISA isa = runtime->GetISA(*valobj);
if (!runtime->IsValidISA(isa))
- s.Printf(") ");
+ s.Printf(", dynamic type: unknown) ");
else
s.Printf(", dynamic type: %s) ",
runtime->GetActualTypeName(isa).GetCString());
Modified: lldb/trunk/source/Core/ValueObjectDynamicValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectDynamicValue.cpp?rev=136763&r1=136762&r2=136763&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectDynamicValue.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectDynamicValue.cpp Tue Aug 2 21:18:51 2011
@@ -160,7 +160,7 @@
{
LanguageRuntime *objc_runtime = process->GetLanguageRuntime (lldb::eLanguageTypeObjC);
if (objc_runtime)
- found_dynamic_type = cpp_runtime->GetDynamicTypeAndAddress (*m_parent, m_use_dynamic, class_type_or_name, dynamic_address);
+ found_dynamic_type = objc_runtime->GetDynamicTypeAndAddress (*m_parent, m_use_dynamic, class_type_or_name, dynamic_address);
}
}
Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp?rev=136763&r1=136762&r2=136763&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Tue Aug 2 21:18:51 2011
@@ -26,6 +26,7 @@
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/Scalar.h"
#include "lldb/Core/StreamString.h"
+#include "lldb/Core/ValueObjectConstResult.h"
#include "lldb/Expression/ClangFunction.h"
#include "lldb/Expression/ClangUtilityFunction.h"
#include "lldb/Symbol/ClangASTContext.h"
@@ -566,9 +567,35 @@
lldb_private::ObjCLanguageRuntime::ObjCISA
AppleObjCRuntimeV2::GetISA(ValueObject& valobj)
{
+
+ if (valobj.GetIsExpressionResult() &&
+ valobj.GetValue().GetValueType() == Value::eValueTypeHostAddress)
+ {
+ // when using the expression parser, an additional layer of "frozen data"
+ // can be created, which is basically a byte-exact copy of the data returned
+ // by the expression, but in host memory. because Python code might need to read
+ // into the object memory in non-obvious ways, we need to hand it the target version
+ // of the expression output
+ lldb::addr_t tgt_address = valobj.GetValueAsUnsigned();
+ ValueObjectSP target_object = ValueObjectConstResult::Create (valobj.GetExecutionContextScope(),
+ valobj.GetClangAST(),
+ valobj.GetClangType(),
+ valobj.GetName(),
+ tgt_address,
+ eAddressTypeLoad,
+ valobj.GetUpdatePoint().GetProcessSP()->GetAddressByteSize());
+ return GetISA(*target_object);
+ }
+
if (ClangASTType::GetMinimumLanguage(valobj.GetClangAST(),valobj.GetClangType()) != lldb::eLanguageTypeObjC)
return 0;
+ // if we get an invalid VO (which might still happen when playing around
+ // with pointers returned by the expression parser, don't consider this
+ // a valid ObjC object)
+ if (valobj.GetValue().GetContextType() == Value::eContextTypeInvalid)
+ return 0;
+
uint32_t offset = 0;
uint64_t isa_pointer = valobj.GetDataExtractor().GetPointer(&offset);
@@ -583,6 +610,8 @@
return isa;
}
+// TODO: should we have a transparent_kvo parameter here to say if we
+// want to replace the KVO swizzled class with the actual user-level type?
ConstString
AppleObjCRuntimeV2::GetActualTypeName(lldb_private::ObjCLanguageRuntime::ObjCISA isa)
{
@@ -625,7 +654,20 @@
//printf("name_pointer: %llx\n", name_pointer);
char* cstr = new char[512];
if (m_process->ReadCStringFromMemory(name_pointer, cstr, 512) > 0)
- return ConstString(cstr);
+ {
+ if (::strstr(cstr, "NSKVONotify") == cstr)
+ {
+ // the ObjC runtime implements KVO by replacing the isa with a special
+ // NSKVONotifying_className that overrides the relevant methods
+ // the side effect on us is that getting the typename for a KVO-ed object
+ // will return the swizzled class instead of the actual one
+ // this swizzled class is a descendant of the real class, so just
+ // return the parent type and all should be fine
+ return GetActualTypeName(GetParentClass(isa));
+ }
+ else
+ return ConstString(cstr);
+ }
else
return ConstString("unknown");
}
Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py?rev=136763&r1=136762&r2=136763&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py Tue Aug 2 21:18:51 2011
@@ -226,9 +226,12 @@
substrs = ['Process Name: a.out Process Id:'])
self.expect('frame variable dyn_test', matching=False,
substrs = ['Process Name: a.out Process Id:'])
- self.expect('frame variable dyn_test -d run-target',
+ self.expect('frame variable dyn_test -d run-target -T',
substrs = ['(id, dynamic type:',
'Process Name: a.out Process Id:'])
+ self.expect('frame variable dyn_test -d run-target',
+ substrs = ['(id)',
+ 'Process Name: a.out Process Id:'])
# check that we can format stuff out of the expression parser
Modified: lldb/trunk/test/lang/objc/objc-dynamic-value/TestObjCDynamicValue.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/objc-dynamic-value/TestObjCDynamicValue.py?rev=136763&r1=136762&r2=136763&view=diff
==============================================================================
--- lldb/trunk/test/lang/objc/objc-dynamic-value/TestObjCDynamicValue.py (original)
+++ lldb/trunk/test/lang/objc/objc-dynamic-value/TestObjCDynamicValue.py Tue Aug 2 21:18:51 2011
@@ -93,6 +93,14 @@
self.expect('frame var -d run-target myObserver->_source', 'frame var finds its way into a child member',
patterns = ['\(SourceDerived \*\)'])
+
+ # check that our ObjC GetISA() does a good job at hiding KVO swizzled classes
+
+ self.expect('frame var -d run-target myObserver->_source -T', 'the KVO-ed class is hidden',
+ substrs = ['dynamic type: SourceDerived'])
+
+ self.expect('frame var -d run-target myObserver->_source -T', 'the KVO-ed class is hidden', matching = False,
+ substrs = ['dynamic type: NSKVONotify'])
# This test is not entirely related to the main thrust of this test case, but since we're here,
# try stepping into setProperty, and make sure we get into the version in Source:
From gclayton at apple.com Tue Aug 2 23:39:36 2011
From: gclayton at apple.com (Greg Clayton)
Date: Wed, 03 Aug 2011 04:39:36 -0000
Subject: [Lldb-commits] [lldb] r136765 -
/lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
Message-ID: <20110803043936.67F962A6C12C@llvm.org>
Author: gclayton
Date: Tue Aug 2 23:39:36 2011
New Revision: 136765
URL: http://llvm.org/viewvc/llvm-project?rev=136765&view=rev
Log:
Fixed an issue with parsing object files from .a archives.
The entire .a file gets cached, and after the first .o file
gets loaded, a cached version would get used when trying to
extract the skinny slice from a fat BSD archive and would
cause a code path to get taken in the BSD archive parser
even if we aren't at a BSD archive offset.
Modified:
lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
Modified: lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp?rev=136765&r1=136764&r2=136765&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp Tue Aug 2 23:39:36 2011
@@ -244,41 +244,33 @@
ObjectContainerBSDArchive::CreateInstance
(
Module* module,
- DataBufferSP& dataSP,
+ DataBufferSP& data_sp,
const FileSpec *file,
addr_t offset,
addr_t length)
{
- if (file)
+ if (file && data_sp && ObjectContainerBSDArchive::MagicBytesMatch(data_sp))
{
- std::string object;
-
Archive::shared_ptr archive_sp (Archive::FindCachedArchive (*file, module->GetArchitecture(), module->GetModificationTime()));
-
+
if (archive_sp)
{
// We already have this archive in our cache, use it
- std::auto_ptr container_ap(new ObjectContainerBSDArchive (module, dataSP, file, offset, length));
+ std::auto_ptr container_ap(new ObjectContainerBSDArchive (module, data_sp, file, offset, length));
if (container_ap.get())
{
container_ap->SetArchive (archive_sp);
return container_ap.release();
}
}
-
- if (dataSP)
- {
- if (ObjectContainerBSDArchive::MagicBytesMatch(dataSP))
- {
- // Read everything since we need that in order to index all the
- // objects in the archive
- dataSP = file->ReadFileContents(offset, length);
-
- std::auto_ptr container_ap(new ObjectContainerBSDArchive (module, dataSP, file, offset, length));
- if (container_ap->ParseHeader())
- return container_ap.release();
- }
- }
+
+ // Read everything since we need that in order to index all the
+ // objects in the archive
+ data_sp = file->ReadFileContents(offset, length);
+
+ std::auto_ptr container_ap(new ObjectContainerBSDArchive (module, data_sp, file, offset, length));
+ if (container_ap->ParseHeader())
+ return container_ap.release();
}
return NULL;
}
From johnny.chen at apple.com Tue Aug 2 23:50:37 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Wed, 03 Aug 2011 04:50:37 -0000
Subject: [Lldb-commits] [lldb] r136766 -
/lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
Message-ID: <20110803045037.6F2222A6C12C@llvm.org>
Author: johnny
Date: Tue Aug 2 23:50:37 2011
New Revision: 136766
URL: http://llvm.org/viewvc/llvm-project?rev=136766&view=rev
Log:
Fixed an issue of wrong (by +2) branch target calculation in the disassembler's symbolic information output.
A8.6.23 BLX (immediate T2)
Target Address = Align(PC, 4) + offset value
rdar://problem/9885678
Modified:
lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
Modified: lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp?rev=136766&r1=136765&r2=136766&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp (original)
+++ lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp Tue Aug 2 23:50:37 2011
@@ -146,6 +146,7 @@
PadString(s, p.second, operandColWidth);
}
+#define AlignPC(pc_val) (pc_val & 0xFFFFFFFC)
void
InstructionLLVM::Dump
(
@@ -355,6 +356,11 @@
const char *pos = NULL;
operands.Clear(); comment.Clear();
if (EDGetInstString(&inst_str, m_inst) == 0 && (pos = strstr(inst_str, "#")) != NULL) {
+ if (m_arch_type == llvm::Triple::thumb && opcode.GetString() == "blx") {
+ // A8.6.23 BLX (immediate)
+ // Target Address = Align(PC,4) + offset value
+ PC = AlignPC(PC);
+ }
uint64_t operand_value = PC + atoi(++pos);
// Put the address value into the comment.
comment.Printf("0x%llx ", operand_value);
From scallanan at apple.com Wed Aug 3 11:23:08 2011
From: scallanan at apple.com (Sean Callanan)
Date: Wed, 03 Aug 2011 16:23:08 -0000
Subject: [Lldb-commits] [lldb] r136784 - in /lldb/trunk:
source/Expression/ClangUserExpression.cpp
test/lang/objc/objc-static-method/TestObjCStaticMethod.py
test/lang/objc/objc-static-method/static.m
Message-ID: <20110803162308.E3F2A2A6C12C@llvm.org>
Author: spyffe
Date: Wed Aug 3 11:23:08 2011
New Revision: 136784
URL: http://llvm.org/viewvc/llvm-project?rev=136784&view=rev
Log:
Improved the expression parser's detection of the
current context. Previously, if there was a variable
called "self" available, the expression parser
assumed it was inside a method. But class methods
in Objective-C also take a "self" parameter, of DWARF
type "id". We now detect this properly, and only
assume we're in an instance method if "self" is a
pointer to an Objective-C object.
Modified:
lldb/trunk/source/Expression/ClangUserExpression.cpp
lldb/trunk/test/lang/objc/objc-static-method/TestObjCStaticMethod.py
lldb/trunk/test/lang/objc/objc-static-method/static.m
Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUserExpression.cpp?rev=136784&r1=136783&r2=136784&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangUserExpression.cpp (original)
+++ lldb/trunk/source/Expression/ClangUserExpression.cpp Wed Aug 3 11:23:08 2011
@@ -68,9 +68,6 @@
void
ClangUserExpression::ScanContext(ExecutionContext &exe_ctx)
{
- if (!exe_ctx.frame)
- return;
-
VariableList *vars = exe_ctx.frame->GetVariableList(false);
if (!vars)
@@ -102,6 +99,13 @@
else if (self_var.get())
{
m_objectivec = true;
+
+ Type *self_type = self_var->GetType();
+
+ if (self_type->GetClangForwardType() == self_type->GetClangASTContext().GetBuiltInType_objc_id())
+ {
+ m_objectivec = false;
+ }
}
}
Modified: lldb/trunk/test/lang/objc/objc-static-method/TestObjCStaticMethod.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/objc-static-method/TestObjCStaticMethod.py?rev=136784&r1=136783&r2=136784&view=diff
==============================================================================
--- lldb/trunk/test/lang/objc/objc-static-method/TestObjCStaticMethod.py (original)
+++ lldb/trunk/test/lang/objc/objc-static-method/TestObjCStaticMethod.py Wed Aug 3 11:23:08 2011
@@ -14,7 +14,6 @@
@python_api_test
# "expression" can't call functions in class methods
- @unittest2.expectedFailure
def test_with_dsym_and_python_api(self):
"""Test calling functions in static methods."""
self.buildDsym()
@@ -22,7 +21,6 @@
@python_api_test
# "expression" can't call functions in class methods
- @unittest2.expectedFailure
def test_with_dwarf_and_python_api(self):
"""Test calling functions in static methods."""
self.buildDwarf()
@@ -35,7 +33,6 @@
self.main_source = "static.m"
self.break_line = line_number(self.main_source, '// Set breakpoint here.')
- @unittest2.expectedFailure
#rdar://problem/9745789 "expression" can't call functions in class methods
def objc_static_method(self):
"""Test calling functions in static methods."""
@@ -66,7 +63,7 @@
cmd_value = frame.EvaluateExpression ("(char *) sel_getName (_cmd)")
self.assertTrue (cmd_value.IsValid())
sel_name = cmd_value.GetSummary()
- self.assertTrue (sel_name == "doSomethingWithString:", "Got the right value for the selector as string.")
+ self.assertTrue (sel_name == "\"doSomethingWithString:\"", "Got the right value for the selector as string.")
if __name__ == '__main__':
import atexit
Modified: lldb/trunk/test/lang/objc/objc-static-method/static.m
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/objc-static-method/static.m?rev=136784&r1=136783&r2=136784&view=diff
==============================================================================
--- lldb/trunk/test/lang/objc/objc-static-method/static.m (original)
+++ lldb/trunk/test/lang/objc/objc-static-method/static.m Wed Aug 3 11:23:08 2011
@@ -2,14 +2,17 @@
@interface Foo : NSObject
+(void) doSomethingWithString: (NSString *) string;
-
+-(void) doSomethingWithNothing;
@end
@implementation Foo
+(void) doSomethingWithString: (NSString *) string
{
NSLog (@"String is: %@.", string); // Set breakpoint here.
+}
+-(void) doSomethingWithNothing
+{
}
@end
From granata.enrico at gmail.com Wed Aug 3 11:23:33 2011
From: granata.enrico at gmail.com (Enrico Granata)
Date: Wed, 03 Aug 2011 16:23:33 -0000
Subject: [Lldb-commits] [lldb] r136785 - in /lldb/trunk:
source/Core/Module.cpp
test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py
test/functionalities/data-formatter/data-formatter-advanced/main.cpp
Message-ID: <20110803162333.CDDC72A6C12C@llvm.org>
Author: enrico
Date: Wed Aug 3 11:23:33 2011
New Revision: 136785
URL: http://llvm.org/viewvc/llvm-project?rev=136785&view=rev
Log:
testing for a previous issue where formats in summaries where not enforced in all cases ; removed an unused local variable
Modified:
lldb/trunk/source/Core/Module.cpp
lldb/trunk/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py
lldb/trunk/test/functionalities/data-formatter/data-formatter-advanced/main.cpp
Modified: lldb/trunk/source/Core/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=136785&r1=136784&r2=136785&view=diff
==============================================================================
--- lldb/trunk/source/Core/Module.cpp (original)
+++ lldb/trunk/source/Core/Module.cpp Wed Aug 3 11:23:33 2011
@@ -700,7 +700,6 @@
if (sections != NULL)
{
size_t num_sections = sections->GetSize();
- bool loaded = false;
for (size_t sect_idx = 0; sect_idx < num_sections; sect_idx++)
{
SectionSP section_sp = sections->GetSectionAtIndex(sect_idx);
Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py?rev=136785&r1=136784&r2=136785&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py Wed Aug 3 11:23:33 2011
@@ -171,6 +171,24 @@
self.expect("frame variable sparray",
substrs = ['[0x0000000f,0x0000000c,0x00000009]'])
+ # check that we can format a variable in a summary even if a format is defined for its datatype
+ self.runCmd("type format add -f hex int")
+ self.runCmd("type summary add -f \"x=${var.x%i}\" Simple")
+
+ self.expect("frame variable a_simple_object",
+ substrs = ['x=3'])
+
+ self.expect("frame variable a_simple_object", matching=False,
+ substrs = ['0x0'])
+
+ # now check that the default is applied if we do not hand out a format
+ self.runCmd("type summary add -f \"x=${var.x}\" Simple")
+
+ self.expect("frame variable a_simple_object", matching=False,
+ substrs = ['x=3'])
+
+ self.expect("frame variable a_simple_object", matching=True,
+ substrs = ['x=0x00000003'])
if __name__ == '__main__':
Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-advanced/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-advanced/main.cpp?rev=136785&r1=136784&r2=136785&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-advanced/main.cpp (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-advanced/main.cpp Wed Aug 3 11:23:33 2011
@@ -106,5 +106,7 @@
SimpleWithPointers(-4,-5,'6'),
SimpleWithPointers(-7,-8,'9')};
+ Simple a_simple_object(3,0.14,'E');
+
return 0; // Set break point at this line.
}
\ No newline at end of file
From granata.enrico at gmail.com Wed Aug 3 12:20:19 2011
From: granata.enrico at gmail.com (Enrico Granata)
Date: Wed, 03 Aug 2011 17:20:19 -0000
Subject: [Lldb-commits] [lldb] r136791 - /lldb/trunk/test/blacklist.py
Message-ID: <20110803172019.BDB6F2A6C12C@llvm.org>
Author: enrico
Date: Wed Aug 3 12:20:19 2011
New Revision: 136791
URL: http://llvm.org/viewvc/llvm-project?rev=136791&view=rev
Log:
temporarily blacklisting a test case causing hangs on Mac OS X
Modified:
lldb/trunk/test/blacklist.py
Modified: lldb/trunk/test/blacklist.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/blacklist.py?rev=136791&r1=136790&r2=136791&view=diff
==============================================================================
--- lldb/trunk/test/blacklist.py (original)
+++ lldb/trunk/test/blacklist.py Wed Aug 3 12:20:19 2011
@@ -13,6 +13,7 @@
}
"""
-blacklist = {'STLTestCase': ' Crashed while running the entire test suite'
+blacklist = {'STLTestCase': ' Crashed while running the entire test suite',
+ 'LoadUnloadTestCase' : 'taking down debugserver and causing the whole test suite to hang'
# To skip this test case: ./dotest.py -b blacklist.py -v -w 2> ~/Developer/Log/lldbtest.log
}
From jingham at apple.com Wed Aug 3 12:41:29 2011
From: jingham at apple.com (Jim Ingham)
Date: Wed, 03 Aug 2011 17:41:29 -0000
Subject: [Lldb-commits] [lldb] r136793 - in /lldb/trunk/test: blacklist.py
functionalities/load_unload/TestLoadUnload.py
Message-ID: <20110803174129.15BED2A6C12C@llvm.org>
Author: jingham
Date: Wed Aug 3 12:41:28 2011
New Revision: 136793
URL: http://llvm.org/viewvc/llvm-project?rev=136793&view=rev
Log:
Don't set DYLD_LIBRARY_PATH in the Python environment (which will get passed down to
debugserver) but set it in the debugger settings (which will just get passed down to
the target).
Modified:
lldb/trunk/test/blacklist.py
lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py
Modified: lldb/trunk/test/blacklist.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/blacklist.py?rev=136793&r1=136792&r2=136793&view=diff
==============================================================================
--- lldb/trunk/test/blacklist.py (original)
+++ lldb/trunk/test/blacklist.py Wed Aug 3 12:41:28 2011
@@ -13,7 +13,6 @@
}
"""
-blacklist = {'STLTestCase': ' Crashed while running the entire test suite',
- 'LoadUnloadTestCase' : 'taking down debugserver and causing the whole test suite to hang'
+blacklist = {'STLTestCase': ' Crashed while running the entire test suite'
# To skip this test case: ./dotest.py -b blacklist.py -v -w 2> ~/Developer/Log/lldbtest.log
}
Modified: lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py?rev=136793&r1=136792&r2=136793&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py (original)
+++ lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py Wed Aug 3 12:41:28 2011
@@ -115,8 +115,8 @@
self.runCmd("process kill")
# Try again with the DYLD_LIBRARY_PATH environment variable properly set.
- os.environ[dylibPath] = new_dir
- self.addTearDownHook(lambda: os.environ.pop(dylibPath))
+ env_cmd_string = "settings set target.process.env-vars " + dylibPath + "=" + new_dir
+ self.runCmd("env_cmd_string")
self.runCmd("run")
self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
patterns = ["frame #0.*d_function.*at d.c:%d" % self.line_d_function])
From johnny.chen at apple.com Wed Aug 3 13:28:41 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Wed, 03 Aug 2011 18:28:41 -0000
Subject: [Lldb-commits] [lldb] r136796 -
/lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py
Message-ID: <20110803182841.873782A6C12E@llvm.org>
Author: johnny
Date: Wed Aug 3 13:28:41 2011
New Revision: 136796
URL: http://llvm.org/viewvc/llvm-project?rev=136796&view=rev
Log:
Unquote the env_cmd_string variable.
Skip the test case test_dyld_library_path(self) because it causes the debugserver to crash.
Modified:
lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py
Modified: lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py?rev=136796&r1=136795&r2=136796&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py (original)
+++ lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py Wed Aug 3 13:28:41 2011
@@ -65,7 +65,7 @@
self.expect("target modules list", "LLDB successfully locates the relocated dynamic library",
substrs = [new_dylib])
-
+ @unittest2.skip("debugserver crashes?")
def test_dyld_library_path(self):
"""Test DYLD_LIBRARY_PATH after moving libd.dylib, which defines d_function, somewhere else."""
@@ -115,8 +115,8 @@
self.runCmd("process kill")
# Try again with the DYLD_LIBRARY_PATH environment variable properly set.
- env_cmd_string = "settings set target.process.env-vars " + dylibPath + "=" + new_dir
- self.runCmd("env_cmd_string")
+ env_cmd_string = 'settings set target.process.env-vars ["%s"]=%s' % (dylibPath, new_dir)
+ self.runCmd(env_cmd_string)
self.runCmd("run")
self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
patterns = ["frame #0.*d_function.*at d.c:%d" % self.line_d_function])
From johnny.chen at apple.com Wed Aug 3 13:35:48 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Wed, 03 Aug 2011 18:35:48 -0000
Subject: [Lldb-commits] [lldb] r136798 -
/lldb/trunk/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py
Message-ID: <20110803183548.BD3D22A6C12E@llvm.org>
Author: johnny
Date: Wed Aug 3 13:35:48 2011
New Revision: 136798
URL: http://llvm.org/viewvc/llvm-project?rev=136798&view=rev
Log:
Add expectedFailure decorator.
rdar://problem/9890530
Modified:
lldb/trunk/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py
Modified: lldb/trunk/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py?rev=136798&r1=136797&r2=136798&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py (original)
+++ lldb/trunk/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py Wed Aug 3 13:35:48 2011
@@ -16,6 +16,8 @@
self.lldb_avg = None
self.gdb_avg = None
+ # rdar://problem/9890530
+ @unittest2.expectedFailure
def test_eval_index_variable(self):
"""Test expressions of variable 'i' which appears in two for loops."""
self.buildDefault()
From johnny.chen at apple.com Wed Aug 3 13:55:26 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Wed, 03 Aug 2011 18:55:26 -0000
Subject: [Lldb-commits] [lldb] r136800 - in
/lldb/trunk/source/Plugins/Process/Utility: RegisterContextMach_arm.cpp
RegisterContextMach_i386.cpp RegisterContextMach_x86_64.cpp
Message-ID: <20110803185526.CFDBA2A6C12C@llvm.org>
Author: johnny
Date: Wed Aug 3 13:55:26 2011
New Revision: 136800
URL: http://llvm.org/viewvc/llvm-project?rev=136800&view=rev
Log:
Patch from David Forsythe for FreeBSD build!
Modified:
lldb/trunk/source/Plugins/Process/Utility/RegisterContextMach_arm.cpp
lldb/trunk/source/Plugins/Process/Utility/RegisterContextMach_i386.cpp
lldb/trunk/source/Plugins/Process/Utility/RegisterContextMach_x86_64.cpp
Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextMach_arm.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextMach_arm.cpp?rev=136800&r1=136799&r2=136800&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextMach_arm.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextMach_arm.cpp Wed Aug 3 13:55:26 2011
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+#if defined(__APPLE__)
+
#include "RegisterContextMach_arm.h"
// C Includes
@@ -82,4 +84,4 @@
return ::thread_set_state(tid, flavor, (thread_state_t)&dbg, DBGWordCount);
}
-
+#endif
Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextMach_i386.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextMach_i386.cpp?rev=136800&r1=136799&r2=136800&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextMach_i386.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextMach_i386.cpp Wed Aug 3 13:55:26 2011
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+#if defined(__APPLE__)
// C Includes
#include
@@ -68,4 +69,4 @@
return ::thread_set_state(tid, flavor, (thread_state_t)&exc, EXCWordCount);
}
-
+#endif
Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextMach_x86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextMach_x86_64.cpp?rev=136800&r1=136799&r2=136800&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextMach_x86_64.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextMach_x86_64.cpp Wed Aug 3 13:55:26 2011
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+#if defined(__APPLE__)
// C Includes
#include
@@ -68,3 +69,4 @@
return ::thread_set_state(tid, flavor, (thread_state_t)&exc, EXCWordCount);
}
+#endif
From jingham at apple.com Wed Aug 3 14:32:42 2011
From: jingham at apple.com (Jim Ingham)
Date: Wed, 03 Aug 2011 19:32:42 -0000
Subject: [Lldb-commits] [lldb] r136801 - in
/lldb/trunk/test/functionalities/load_unload: Makefile TestLoadUnload.py
hidden/
Message-ID: <20110803193242.870792A6C12C@llvm.org>
Author: jingham
Date: Wed Aug 3 14:32:42 2011
New Revision: 136801
URL: http://llvm.org/viewvc/llvm-project?rev=136801&view=rev
Log:
Add a directory to make the second copy of libd.dylib in, so we don't have
to make & delete directories in the test case. Make a real copy of libd.dylib
in that directory so the two libraries are actually different. Use (and remove)
the DYLD_LIBRARY_PATH to point to the new library.
Added:
lldb/trunk/test/functionalities/load_unload/hidden/
Modified:
lldb/trunk/test/functionalities/load_unload/Makefile
lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py
Modified: lldb/trunk/test/functionalities/load_unload/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/load_unload/Makefile?rev=136801&r1=136800&r2=136801&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/load_unload/Makefile (original)
+++ lldb/trunk/test/functionalities/load_unload/Makefile Wed Aug 3 14:32:42 2011
@@ -7,12 +7,18 @@
CFLAGS ?=-arch x86_64 -gdwarf-2 -O0
CWD := $(shell pwd)
+all: a.out hidden/libd.dylib
+
a.out: main.o libd.dylib
$(CC) $(CFLAGS) -o a.out main.o -L. -ld
main.o: main.c
$(CC) $(CFLAGS) -c main.c
+hidden/libd.dylib: b.o
+ $(CC) $(CFLAGS) -dynamiclib -o hidden/libd.dylib d.o
+ dsymutil -o hidden/libd.dylib.dSYM hidden/libd.dylib
+
liba.dylib: a.o libb.dylib
$(CC) $(CFLAGS) -dynamiclib -install_name "@executable_path/liba.dylib" -o liba.dylib a.o -L. -lb
dsymutil liba.dylib
@@ -42,4 +48,4 @@
$(CC) $(CFLAGS) -c d.c
clean:
- rm -rf *.o *~ *.dylib a.out *.dSYM
+ rm -rf *.o *~ *.dylib a.out *.dSYM hidden/*
Modified: lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py?rev=136801&r1=136800&r2=136801&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py (original)
+++ lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py Wed Aug 3 14:32:42 2011
@@ -23,7 +23,7 @@
@unittest2.expectedFailure
def test_modules_search_paths(self):
- """Test target modules list after moving libd.dylib, and verifies that it works with 'target modules search-paths add'."""
+ """Test target modules list after loading a different copy of the library libd.dylib, and verifies that it works with 'target modules search-paths add'."""
# Invoke the default build rule.
self.buildDefault()
@@ -31,23 +31,12 @@
if sys.platform.startswith("darwin"):
dylibName = 'libd.dylib'
- # Now let's move the dynamic library to a different directory than $CWD.
-
- # The directory to relocate the dynamic library to.
- new_dir = os.path.join(os.getcwd(), "dyld_path")
-
- # This is the function to remove the dyld_path directory after the test.
- def remove_dyld_dir():
- import shutil
- shutil.rmtree(new_dir)
+ # The directory with the the dynamic library we did not link to.
+ new_dir = os.path.join(os.getcwd(), "hidden")
old_dylib = os.path.join(os.getcwd(), dylibName)
new_dylib = os.path.join(new_dir, dylibName)
- os.mkdir(new_dir)
- os.rename(old_dylib, new_dylib)
- self.addTearDownHook(remove_dyld_dir)
-
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
@@ -65,62 +54,64 @@
self.expect("target modules list", "LLDB successfully locates the relocated dynamic library",
substrs = [new_dylib])
- @unittest2.skip("debugserver crashes?")
+
def test_dyld_library_path(self):
"""Test DYLD_LIBRARY_PATH after moving libd.dylib, which defines d_function, somewhere else."""
# Invoke the default build rule.
self.buildDefault()
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
if sys.platform.startswith("darwin"):
dylibName = 'libd.dylib'
dsymName = 'libd.dylib.dSYM'
dylibPath = 'DYLD_LIBRARY_PATH'
- # Now let's move the dynamic library to a different directory than $CWD.
-
# The directory to relocate the dynamic library and its debugging info.
- new_dir = os.path.join(os.getcwd(), "dyld_path")
-
- # This is the function to remove the dyld_path directory after the test.
- def remove_dyld_dir():
- import shutil
- shutil.rmtree(new_dir)
+ new_dir = os.path.join(os.getcwd(), "hidden")
old_dylib = os.path.join(os.getcwd(), dylibName)
new_dylib = os.path.join(new_dir, dylibName)
old_dSYM = os.path.join(os.getcwd(), dsymName)
new_dSYM = os.path.join(new_dir, dsymName)
- #system(["ls", "-lR", "."])
- os.mkdir(new_dir)
- os.rename(old_dylib, new_dylib)
- if dsymName:
- os.rename(old_dSYM, new_dSYM)
- self.addTearDownHook(remove_dyld_dir)
+
#system(["ls", "-lR", "."])
- # With libd.dylib moved, a.out run should fail.
- exe = os.path.join(os.getcwd(), "a.out")
- self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- # Set breakpoint by function name d_function.
- self.expect("breakpoint set -n d_function", BREAKPOINT_CREATED,
- substrs = ["Breakpoint created",
- "name = 'd_function'",
- "locations = 0 (pending)"])
- self.runCmd("run")
- self.expect("process status", "Not expected to hit the d_function breakpoint",
- matching=False,
- substrs = ["stop reason = breakpoint"])
- # Kill the inferior process.
- self.runCmd("process kill")
+ # Try running with the DYLD_LIBRARY_PATH environment variable set, make sure
+ # we pick up the hidden dylib.
- # Try again with the DYLD_LIBRARY_PATH environment variable properly set.
- env_cmd_string = 'settings set target.process.env-vars ["%s"]=%s' % (dylibPath, new_dir)
+ env_cmd_string = "settings set target.process.env-vars " + dylibPath + "=" + new_dir
+ print "Set environment to: ", env_cmd_string
self.runCmd(env_cmd_string)
+ self.runCmd("settings show target.process.env-vars")
+
+ remove_dyld_path_cmd = "settings remove target.process.env-vars " + dylibPath
+ self.addTearDownHook(lambda: self.runCmd(remove_dyld_path_cmd))
+
+ self.expect("breakpoint set -f d.c -l %d" % self.line_d_function,
+ BREAKPOINT_CREATED,
+ startstr = "Breakpoint created: 1: file ='d.c', line = %d" %
+ self.line_d_function)
+ # For now we don't track DYLD_LIBRARY_PATH, so the old library will be in
+ # the modules list.
+ self.expect("target modules list",
+ substrs = [old_dylib],
+ matching=True)
+
self.runCmd("run")
self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
patterns = ["frame #0.*d_function.*at d.c:%d" % self.line_d_function])
+ # After run, make sure the hidden library is present, and the one we didn't
+ # load is not.
+ self.expect("target modules list",
+ substrs = [new_dylib])
+ self.expect("target modules list",
+ substrs = [old_dylib],
+ matching=False)
+
def test_lldb_process_load_and_unload_commands(self):
"""Test that lldb process load/unload command work correctly."""
From johnny.chen at apple.com Wed Aug 3 15:24:31 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Wed, 03 Aug 2011 20:24:31 -0000
Subject: [Lldb-commits] [lldb] r136805 - /lldb/trunk/test/api/
Message-ID: <20110803202431.1D83D2A6C12C@llvm.org>
Author: johnny
Date: Wed Aug 3 15:24:30 2011
New Revision: 136805
URL: http://llvm.org/viewvc/llvm-project?rev=136805&view=rev
Log:
Add a test directory for lldb C++ API programs.
Added:
lldb/trunk/test/api/
From johnny.chen at apple.com Wed Aug 3 15:28:34 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Wed, 03 Aug 2011 20:28:34 -0000
Subject: [Lldb-commits] [lldb] r136806 -
/lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py
Message-ID: <20110803202834.42A7B2A6C12C@llvm.org>
Author: johnny
Date: Wed Aug 3 15:28:34 2011
New Revision: 136806
URL: http://llvm.org/viewvc/llvm-project?rev=136806&view=rev
Log:
Conditionize the 'print "Set environment ..."' stmt.
Modified:
lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py
Modified: lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py?rev=136806&r1=136805&r2=136806&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py (original)
+++ lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py Wed Aug 3 15:28:34 2011
@@ -83,7 +83,8 @@
# we pick up the hidden dylib.
env_cmd_string = "settings set target.process.env-vars " + dylibPath + "=" + new_dir
- print "Set environment to: ", env_cmd_string
+ if self.TraceOn():
+ print "Set environment to: ", env_cmd_string
self.runCmd(env_cmd_string)
self.runCmd("settings show target.process.env-vars")
From johnny.chen at apple.com Wed Aug 3 15:39:26 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Wed, 03 Aug 2011 20:39:26 -0000
Subject: [Lldb-commits] [lldb] r136808 - in /lldb/trunk/test:
benchmarks/example/main.cpp
functionalities/non-overlapping-index-variable-i/main.cpp
Message-ID: <20110803203926.B43162A6C12C@llvm.org>
Author: johnny
Date: Wed Aug 3 15:39:26 2011
New Revision: 136808
URL: http://llvm.org/viewvc/llvm-project?rev=136808&view=rev
Log:
Add license header comment.
Modified:
lldb/trunk/test/benchmarks/example/main.cpp
lldb/trunk/test/functionalities/non-overlapping-index-variable-i/main.cpp
Modified: lldb/trunk/test/benchmarks/example/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/benchmarks/example/main.cpp?rev=136808&r1=136807&r2=136808&view=diff
==============================================================================
--- lldb/trunk/test/benchmarks/example/main.cpp (original)
+++ lldb/trunk/test/benchmarks/example/main.cpp Wed Aug 3 15:39:26 2011
@@ -1,3 +1,11 @@
+//===-- main.c --------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
#include
class Point {
Modified: lldb/trunk/test/functionalities/non-overlapping-index-variable-i/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/non-overlapping-index-variable-i/main.cpp?rev=136808&r1=136807&r2=136808&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/non-overlapping-index-variable-i/main.cpp (original)
+++ lldb/trunk/test/functionalities/non-overlapping-index-variable-i/main.cpp Wed Aug 3 15:39:26 2011
@@ -1,3 +1,11 @@
+//===-- main.c --------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
#include
class Point {
From johnny.chen at apple.com Wed Aug 3 15:40:35 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Wed, 03 Aug 2011 20:40:35 -0000
Subject: [Lldb-commits] [lldb] r136809 - in /lldb/trunk/test:
benchmarks/example/main.cpp
functionalities/non-overlapping-index-variable-i/main.cpp
Message-ID: <20110803204035.50E6F2A6C12C@llvm.org>
Author: johnny
Date: Wed Aug 3 15:40:35 2011
New Revision: 136809
URL: http://llvm.org/viewvc/llvm-project?rev=136809&view=rev
Log:
Fix typos.
Modified:
lldb/trunk/test/benchmarks/example/main.cpp
lldb/trunk/test/functionalities/non-overlapping-index-variable-i/main.cpp
Modified: lldb/trunk/test/benchmarks/example/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/benchmarks/example/main.cpp?rev=136809&r1=136808&r2=136809&view=diff
==============================================================================
--- lldb/trunk/test/benchmarks/example/main.cpp (original)
+++ lldb/trunk/test/benchmarks/example/main.cpp Wed Aug 3 15:40:35 2011
@@ -1,4 +1,4 @@
-//===-- main.c --------------------------------------------------*- C++ -*-===//
+//===-- main.cpp ------------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
Modified: lldb/trunk/test/functionalities/non-overlapping-index-variable-i/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/non-overlapping-index-variable-i/main.cpp?rev=136809&r1=136808&r2=136809&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/non-overlapping-index-variable-i/main.cpp (original)
+++ lldb/trunk/test/functionalities/non-overlapping-index-variable-i/main.cpp Wed Aug 3 15:40:35 2011
@@ -1,4 +1,4 @@
-//===-- main.c --------------------------------------------------*- C++ -*-===//
+//===-- main.cpp ------------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
From johnny.chen at apple.com Wed Aug 3 15:58:02 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Wed, 03 Aug 2011 20:58:02 -0000
Subject: [Lldb-commits] [lldb] r136812 -
/lldb/trunk/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py
Message-ID: <20110803205802.941932A6C12C@llvm.org>
Author: johnny
Date: Wed Aug 3 15:58:02 2011
New Revision: 136812
URL: http://llvm.org/viewvc/llvm-project?rev=136812&view=rev
Log:
Remove copy-and-paste residues.
Modified:
lldb/trunk/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py
Modified: lldb/trunk/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py?rev=136812&r1=136811&r2=136812&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py (original)
+++ lldb/trunk/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py Wed Aug 3 15:58:02 2011
@@ -13,8 +13,6 @@
TestBase.setUp(self)
self.source = 'main.cpp'
self.line_to_break = line_number(self.source, '// Set breakpoint here.')
- self.lldb_avg = None
- self.gdb_avg = None
# rdar://problem/9890530
@unittest2.expectedFailure
From johnny.chen at apple.com Wed Aug 3 16:18:23 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Wed, 03 Aug 2011 21:18:23 -0000
Subject: [Lldb-commits] [lldb] r136815 -
/lldb/trunk/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py
Message-ID: <20110803211823.B30AB2A6C12C@llvm.org>
Author: johnny
Date: Wed Aug 3 16:18:23 2011
New Revision: 136815
URL: http://llvm.org/viewvc/llvm-project?rev=136815&view=rev
Log:
Minor modification to get the full path to the target program.
Modified:
lldb/trunk/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py
Modified: lldb/trunk/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py?rev=136815&r1=136814&r2=136815&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py (original)
+++ lldb/trunk/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py Wed Aug 3 16:18:23 2011
@@ -24,7 +24,8 @@
def eval_index_variable_i(self, exe_name):
"""Test expressions of variable 'i' which appears in two for loops."""
- self.runCmd("file %s" % exe_name, CURRENT_EXECUTABLE_SET)
+ exe = os.path.join(os.getcwd(), exe_name)
+ self.runCmd("file %s" % exe, CURRENT_EXECUTABLE_SET)
self.expect('breakpoint set -f %s -l %d' % (self.source, self.line_to_break),
BREAKPOINT_CREATED,
From granata.enrico at gmail.com Wed Aug 3 17:01:27 2011
From: granata.enrico at gmail.com (Enrico Granata)
Date: Wed, 03 Aug 2011 22:01:27 -0000
Subject: [Lldb-commits] [lldb] r136819 - in
/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime:
AppleObjCRuntimeV2.cpp AppleObjCRuntimeV2.h
Message-ID: <20110803220127.AEE5E2A6C12C@llvm.org>
Author: enrico
Date: Wed Aug 3 17:01:27 2011
New Revision: 136819
URL: http://llvm.org/viewvc/llvm-project?rev=136819&view=rev
Log:
Basic handling of Objective-C tagged pointers: return a custom ISA and typename when one is detected
Modified:
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp?rev=136819&r1=136818&r2=136819&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Wed Aug 3 17:01:27 2011
@@ -564,6 +564,18 @@
return ivar_offset;
}
+// tagged pointers are marked by having their least-significant bit
+// set. this makes them "invalid" as pointers because they violate
+// the alignment requirements. this way, we can always know when
+// we are dealing with a tagged pointer, and use the lookup approach
+// that the runtime would
+bool
+AppleObjCRuntimeV2::IsTaggedPointer(lldb::addr_t ptr)
+{
+ return (ptr & 0x01);
+}
+
+
lldb_private::ObjCLanguageRuntime::ObjCISA
AppleObjCRuntimeV2::GetISA(ValueObject& valobj)
{
@@ -599,6 +611,10 @@
uint32_t offset = 0;
uint64_t isa_pointer = valobj.GetDataExtractor().GetPointer(&offset);
+ // tagged pointer
+ if (IsTaggedPointer(isa_pointer))
+ return g_objc_Tagged_ISA;
+
uint8_t pointer_size = valobj.GetUpdatePoint().GetProcessSP()->GetAddressByteSize();
Error error;
@@ -617,6 +633,9 @@
{
if (!IsValidISA(isa))
return ConstString(NULL);
+
+ if (isa == g_objc_Tagged_ISA)
+ return ConstString("_lldb_Tagged_ObjC_ISA");
uint8_t pointer_size = m_process->GetAddressByteSize();
Error error;
@@ -678,6 +697,9 @@
if (!IsValidISA(isa))
return 0;
+ if (isa == g_objc_Tagged_ISA)
+ return 0;
+
uint8_t pointer_size = m_process->GetAddressByteSize();
Error error;
lldb::addr_t parent_pointer = isa + pointer_size;
Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h?rev=136819&r1=136818&r2=136819&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h Wed Aug 3 17:01:27 2011
@@ -83,6 +83,11 @@
return (isa != 0);
}
+ // this is not a valid ISA in the sense that no valid
+ // class pointer can live at address 1. we use it to refer to
+ // tagged types, where the ISA must be dynamically determined
+ static const ObjCISA g_objc_Tagged_ISA = 1;
+
virtual ObjCISA
GetISA(ValueObject& valobj);
@@ -97,6 +102,9 @@
private:
AppleObjCRuntimeV2(Process *process, ModuleSP &objc_module_sp);
+ bool
+ IsTaggedPointer(lldb::addr_t ptr);
+
bool RunFunctionToFindClassName (lldb::addr_t class_addr, Thread *thread, char *name_dst, size_t max_name_len);
bool m_has_object_getClass;
From gclayton at apple.com Wed Aug 3 17:57:10 2011
From: gclayton at apple.com (Greg Clayton)
Date: Wed, 03 Aug 2011 22:57:10 -0000
Subject: [Lldb-commits] [lldb] r136829 - in /lldb/trunk: include/lldb/
include/lldb/API/ include/lldb/Symbol/ lldb.xcodeproj/ resources/
scripts/Python/interface/ source/API/ source/Symbol/ test/
test/expression_command/test/
test/functionalities/breakpoint/breakpoint_conditions/
test/functionalities/conditional_break/ test/lang/c/array_types/
test/lang/c/bitfields/ test/lang/cpp/class_static/
test/lang/objc/foundation/ test/lang/objc/objc-ivar-offsets/
test/lang/objc/objc-stepping/ test/python_api/frame/
test/python_api/lldbut...
Message-ID: <20110803225710.DE2B92A6C12C@llvm.org>
Author: gclayton
Date: Wed Aug 3 17:57:10 2011
New Revision: 136829
URL: http://llvm.org/viewvc/llvm-project?rev=136829&view=rev
Log:
Cleaned up the SBType.h file to not include internal headers and reorganized
the SBType implementation classes.
Fixed LLDB core and the test suite to not use deprecated SBValue APIs.
Added a few new APIs to SBValue:
int64_t
SBValue::GetValueAsSigned(int64_t fail_value=0);
uint64_t
SBValue::GetValueAsUnsigned(uint64_t fail_value=0)
Modified:
lldb/trunk/include/lldb/API/SBBreakpoint.h
lldb/trunk/include/lldb/API/SBType.h
lldb/trunk/include/lldb/API/SBValue.h
lldb/trunk/include/lldb/Symbol/ClangASTType.h
lldb/trunk/include/lldb/Symbol/Type.h
lldb/trunk/include/lldb/lldb-forward-rtti.h
lldb/trunk/include/lldb/lldb-forward.h
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/resources/LLDB-Info.plist
lldb/trunk/scripts/Python/interface/SBType.i
lldb/trunk/scripts/Python/interface/SBValue.i
lldb/trunk/source/API/SBFrame.cpp
lldb/trunk/source/API/SBModule.cpp
lldb/trunk/source/API/SBTarget.cpp
lldb/trunk/source/API/SBType.cpp
lldb/trunk/source/API/SBValue.cpp
lldb/trunk/source/Symbol/ClangASTType.cpp
lldb/trunk/source/Symbol/Type.cpp
lldb/trunk/test/expression_command/test/TestExprs.py
lldb/trunk/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
lldb/trunk/test/functionalities/conditional_break/TestConditionalBreak.py
lldb/trunk/test/lang/c/array_types/TestArrayTypes.py
lldb/trunk/test/lang/c/bitfields/TestBitfields.py
lldb/trunk/test/lang/cpp/class_static/TestStaticVariables.py
lldb/trunk/test/lang/objc/foundation/TestObjCMethods.py
lldb/trunk/test/lang/objc/objc-ivar-offsets/TestObjCIvarOffsets.py
lldb/trunk/test/lang/objc/objc-stepping/TestObjCStepping.py
lldb/trunk/test/lldbutil.py
lldb/trunk/test/python_api/frame/TestFrames.py
lldb/trunk/test/python_api/lldbutil/iter/TestRegistersIterator.py
lldb/trunk/test/python_api/process/TestProcessAPI.py
Modified: lldb/trunk/include/lldb/API/SBBreakpoint.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBBreakpoint.h?rev=136829&r1=136828&r2=136829&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBBreakpoint.h (original)
+++ lldb/trunk/include/lldb/API/SBBreakpoint.h Wed Aug 3 17:57:10 2011
@@ -11,7 +11,6 @@
#define LLDB_SBBreakpoint_h_
#include "lldb/API/SBDefines.h"
-#include
namespace lldb {
Modified: lldb/trunk/include/lldb/API/SBType.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBType.h?rev=136829&r1=136828&r2=136829&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBType.h (original)
+++ lldb/trunk/include/lldb/API/SBType.h Wed Aug 3 17:57:10 2011
@@ -11,8 +11,6 @@
#define LLDB_SBType_h_
#include "lldb/API/SBDefines.h"
-#include "lldb/Symbol/ClangASTType.h"
-#include "lldb/Symbol/Type.h"
namespace lldb {
@@ -75,17 +73,16 @@
GetName();
protected:
- std::auto_ptr m_opaque_ap;
+ lldb::TypeImplSP m_opaque_sp;
friend class SBModule;
friend class SBTarget;
friend class SBValue;
friend class SBTypeList;
- SBType (clang::ASTContext*, clang_type_t);
- SBType (lldb_private::ClangASTType type);
- SBType (lldb::TypeSP type);
- SBType (lldb_private::TypeImpl impl);
+ SBType (const lldb_private::ClangASTType &);
+ SBType (const lldb::TypeSP &);
+ SBType (const lldb::TypeImplSP &);
SBType();
};
@@ -101,7 +98,7 @@
operator = (const SBTypeList& rhs);
void
- AppendType(SBType type);
+ Append (const SBType& type);
SBType
GetTypeAtIndex(int index) const;
Modified: lldb/trunk/include/lldb/API/SBValue.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBValue.h?rev=136829&r1=136828&r2=136829&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBValue.h (original)
+++ lldb/trunk/include/lldb/API/SBValue.h Wed Aug 3 17:57:10 2011
@@ -71,6 +71,12 @@
const char *
GetValue ();
+ int64_t
+ GetValueAsSigned(int64_t fail_value=0);
+
+ uint64_t
+ GetValueAsUnsigned(uint64_t fail_value=0);
+
ValueType
GetValueType ();
Modified: lldb/trunk/include/lldb/Symbol/ClangASTType.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTType.h?rev=136829&r1=136828&r2=136829&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangASTType.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTType.h Wed Aug 3 17:57:10 2011
@@ -31,8 +31,8 @@
public:
ClangASTType (clang::ASTContext *ast_context, lldb::clang_type_t type) :
- m_type (type),
- m_ast (ast_context)
+ m_type (type),
+ m_ast (ast_context)
{
}
@@ -58,6 +58,12 @@
return *this;
}
+ bool
+ IsValid () const
+ {
+ return m_type != NULL && m_ast != NULL;
+ }
+
lldb::clang_type_t
GetOpaqueQualType() const
{
@@ -288,6 +294,9 @@
clang::ASTContext *m_ast;
};
+bool operator == (const ClangASTType &lhs, const ClangASTType &rhs);
+bool operator != (const ClangASTType &lhs, const ClangASTType &rhs);
+
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Symbol/Type.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Type.h?rev=136829&r1=136828&r2=136829&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/Type.h (original)
+++ lldb/trunk/include/lldb/Symbol/Type.h Wed Aug 3 17:57:10 2011
@@ -14,6 +14,7 @@
#include "lldb/Core/ClangForward.h"
#include "lldb/Core/ConstString.h"
#include "lldb/Core/UserID.h"
+#include "lldb/Symbol/ClangASTType.h"
#include "lldb/Symbol/Declaration.h"
#include
@@ -272,9 +273,12 @@
operator= (const TypeAndOrName &rhs);
ConstString GetName () const;
- lldb::TypeSP GetTypeSP () const {
+
+ lldb::TypeSP
+ GetTypeSP () const
+ {
return m_type_sp;
- };
+ }
void
SetName (ConstString &type_name_const_str);
@@ -298,21 +302,23 @@
class TypeImpl
{
-private:
- std::auto_ptr m_clang_ast_type;
- lldb::TypeSP m_lldb_type;
-
public:
TypeImpl() :
- m_clang_ast_type(NULL),
- m_lldb_type(lldb::TypeSP())
- {}
+ m_clang_ast_type(),
+ m_type_sp()
+ {
+ }
TypeImpl(const TypeImpl& rhs) :
- m_clang_ast_type(rhs.m_clang_ast_type.get()),
- m_lldb_type(rhs.m_lldb_type)
- {}
+ m_clang_ast_type(rhs.m_clang_ast_type),
+ m_type_sp(rhs.m_type_sp)
+ {
+ }
+
+ TypeImpl(const lldb_private::ClangASTType& type);
+
+ TypeImpl(const lldb::TypeSP& type);
TypeImpl&
operator = (const TypeImpl& rhs);
@@ -320,31 +326,25 @@
bool
operator == (const TypeImpl& rhs)
{
- return (m_clang_ast_type.get() == rhs.m_clang_ast_type.get()) &&
- (m_lldb_type.get() == rhs.m_lldb_type.get());
+ return m_clang_ast_type == rhs.m_clang_ast_type && m_type_sp.get() == rhs.m_type_sp.get();
}
bool
operator != (const TypeImpl& rhs)
{
- return (m_clang_ast_type.get() != rhs.m_clang_ast_type.get()) ||
- (m_lldb_type.get() != rhs.m_lldb_type.get());
+ return m_clang_ast_type != rhs.m_clang_ast_type || m_type_sp.get() != rhs.m_type_sp.get();
}
- TypeImpl(const lldb_private::ClangASTType& type);
-
- TypeImpl(lldb::TypeSP type);
-
bool
IsValid()
{
- return (m_lldb_type.get() != NULL) || (m_clang_ast_type.get() != NULL);
+ return m_type_sp.get() != NULL || m_clang_ast_type.IsValid();
}
- lldb_private::ClangASTType*
- GetClangASTType()
+ const lldb_private::ClangASTType &
+ GetClangASTType() const
{
- return m_clang_ast_type.get();
+ return m_clang_ast_type;
}
clang::ASTContext*
@@ -352,37 +352,43 @@
lldb::clang_type_t
GetOpaqueQualType();
+
+private:
+ ClangASTType m_clang_ast_type;
+ lldb::TypeSP m_type_sp;
};
class TypeListImpl
{
public:
TypeListImpl() :
- m_content() {}
+ m_content()
+ {
+ }
void
- AppendType(TypeImpl& type)
+ Append (const lldb::TypeImplSP& type)
{
m_content.push_back(type);
}
- TypeImpl
- GetTypeAtIndex(int index)
+ lldb::TypeImplSP
+ GetTypeAtIndex(size_t idx)
{
- if (index < 0 || index >= GetSize())
- return TypeImpl();
-
- return m_content[index];
+ lldb::TypeImplSP type_sp;
+ if (idx < GetSize())
+ type_sp = m_content[idx];
+ return type_sp;
}
- int
+ size_t
GetSize()
{
return m_content.size();
}
private:
- std::vector m_content;
+ std::vector m_content;
};
Modified: lldb/trunk/include/lldb/lldb-forward-rtti.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-forward-rtti.h?rev=136829&r1=136828&r2=136829&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-forward-rtti.h (original)
+++ lldb/trunk/include/lldb/lldb-forward-rtti.h Wed Aug 3 17:57:10 2011
@@ -74,6 +74,7 @@
typedef SharedPtr::Type ThreadPlanSP;
typedef SharedPtr::Type ThreadPlanTracerSP;
typedef SharedPtr::Type TypeSP;
+ typedef SharedPtr::Type TypeImplSP;
typedef SharedPtr::Type FuncUnwindersSP;
typedef SharedPtr::Type UserSettingsControllerSP;
typedef SharedPtr::Type UnwindPlanSP;
Modified: lldb/trunk/include/lldb/lldb-forward.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-forward.h?rev=136829&r1=136828&r2=136829&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-forward.h (original)
+++ lldb/trunk/include/lldb/lldb-forward.h Wed Aug 3 17:57:10 2011
@@ -163,8 +163,10 @@
class ThreadSpec;
class TimeValue;
class Type;
+class TypeImpl;
class TypeAndOrName;
class TypeList;
+class TypeListImpl;
class UUID;
class Unwind;
class UnwindAssembly;
Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=136829&r1=136828&r2=136829&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Wed Aug 3 17:57:10 2011
@@ -3420,10 +3420,10 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 70;
+ CURRENT_PROJECT_VERSION = 71;
DEBUG_INFORMATION_FORMAT = dwarf;
DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 70;
+ DYLIB_CURRENT_VERSION = 71;
EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -3472,11 +3472,11 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 70;
+ CURRENT_PROJECT_VERSION = 71;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 70;
+ DYLIB_CURRENT_VERSION = 71;
EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -3523,8 +3523,8 @@
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 70;
- DYLIB_CURRENT_VERSION = 70;
+ CURRENT_PROJECT_VERSION = 71;
+ DYLIB_CURRENT_VERSION = 71;
EXECUTABLE_EXTENSION = a;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -3562,9 +3562,9 @@
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 70;
+ CURRENT_PROJECT_VERSION = 71;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
- DYLIB_CURRENT_VERSION = 70;
+ DYLIB_CURRENT_VERSION = 71;
EXECUTABLE_EXTENSION = a;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -3602,9 +3602,9 @@
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 70;
+ CURRENT_PROJECT_VERSION = 71;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
- DYLIB_CURRENT_VERSION = 70;
+ DYLIB_CURRENT_VERSION = 71;
EXECUTABLE_EXTENSION = a;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -3672,7 +3672,7 @@
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 70;
+ CURRENT_PROJECT_VERSION = 71;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -3703,11 +3703,11 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 70;
+ CURRENT_PROJECT_VERSION = 71;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 70;
+ DYLIB_CURRENT_VERSION = 71;
EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -3832,7 +3832,7 @@
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 70;
+ CURRENT_PROJECT_VERSION = 71;
DEBUG_INFORMATION_FORMAT = dwarf;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -3864,7 +3864,7 @@
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 70;
+ CURRENT_PROJECT_VERSION = 71;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
Modified: lldb/trunk/resources/LLDB-Info.plist
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/resources/LLDB-Info.plist?rev=136829&r1=136828&r2=136829&view=diff
==============================================================================
--- lldb/trunk/resources/LLDB-Info.plist (original)
+++ lldb/trunk/resources/LLDB-Info.plist Wed Aug 3 17:57:10 2011
@@ -17,7 +17,7 @@
CFBundleSignature
????
CFBundleVersion
- 70
+ 71
CFBundleName
${EXECUTABLE_NAME}
Modified: lldb/trunk/scripts/Python/interface/SBType.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBType.i?rev=136829&r1=136828&r2=136829&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBType.i (original)
+++ lldb/trunk/scripts/Python/interface/SBType.i Wed Aug 3 17:57:10 2011
@@ -54,7 +54,7 @@
SBTypeList();
void
- AppendType(SBType type);
+ Append(const SBType& type);
SBType
GetTypeAtIndex(int index);
Modified: lldb/trunk/scripts/Python/interface/SBValue.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBValue.i?rev=136829&r1=136828&r2=136829&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBValue.i (original)
+++ lldb/trunk/scripts/Python/interface/SBValue.i Wed Aug 3 17:57:10 2011
@@ -82,14 +82,6 @@
size_t
GetByteSize ();
- %define DEPRECATED
- "The method which takes an SBFrame is deprecated - SBValues know their own frames."
- %enddef
-
- %feature("docstring", DEPRECATED) IsInScope;
- bool
- IsInScope (const lldb::SBFrame &frame);
-
bool
IsInScope ();
@@ -99,48 +91,30 @@
void
SetFormat (lldb::Format format);
- %feature("docstring", DEPRECATED) GetValue;
- const char *
- GetValue (const lldb::SBFrame &frame);
-
const char *
GetValue ();
+ int64_t
+ GetValueAsSigned(int64_t fail_value=0);
+
+ uint64_t
+ GetValueAsUnsigned(uint64_t fail_value=0);
+
ValueType
GetValueType ();
- %feature("docstring", DEPRECATED) GetValueDidChange;
- bool
- GetValueDidChange (const lldb::SBFrame &frame);
-
bool
GetValueDidChange ();
- %feature("docstring", DEPRECATED) GetSummary;
- const char *
- GetSummary (const lldb::SBFrame &frame);
-
const char *
GetSummary ();
- %feature("docstring", DEPRECATED) GetObjectDescription;
- const char *
- GetObjectDescription (const lldb::SBFrame &frame);
-
const char *
GetObjectDescription ();
- %feature("docstring", DEPRECATED) GetLocation;
- const char *
- GetLocation (const lldb::SBFrame &frame);
-
const char *
GetLocation ();
- %feature("docstring", DEPRECATED) SetValueFromCString;
- bool
- SetValueFromCString (const lldb::SBFrame &frame, const char *value_str);
-
bool
SetValueFromCString (const char *value_str);
Modified: lldb/trunk/source/API/SBFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=136829&r1=136828&r2=136829&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFrame.cpp (original)
+++ lldb/trunk/source/API/SBFrame.cpp Wed Aug 3 17:57:10 2011
@@ -768,8 +768,8 @@
if (expr_log)
expr_log->Printf("** [SBFrame::EvaluateExpression] Expression result is %s, summary %s **",
- expr_result.GetValue(*this),
- expr_result.GetSummary(*this));
+ expr_result.GetValue(),
+ expr_result.GetSummary());
if (log)
log->Printf ("SBFrame(%p)::EvaluateExpression (expr=\"%s\") => SBValue(%p)", m_opaque_sp.get(),
Modified: lldb/trunk/source/API/SBModule.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBModule.cpp?rev=136829&r1=136828&r2=136829&view=diff
==============================================================================
--- lldb/trunk/source/API/SBModule.cpp (original)
+++ lldb/trunk/source/API/SBModule.cpp Wed Aug 3 17:57:10 2011
@@ -347,27 +347,24 @@
lldb::SBType
SBModule::FindFirstType (const char* name_cstr)
{
- if (!IsValid())
- return lldb::SBType();
-
- SymbolContext sc;
- TypeList type_list;
- uint32_t num_matches = 0;
- ConstString name(name_cstr);
-
- num_matches = m_opaque_sp->FindTypes(sc,
- name,
- false,
- 1,
- type_list);
-
- if (num_matches)
+ SBType sb_type;
+ if (IsValid())
{
- TypeSP type_sp (type_list.GetTypeAtIndex(0));
- return lldb::SBType(type_sp);
+ SymbolContext sc;
+ TypeList type_list;
+ uint32_t num_matches = 0;
+ ConstString name(name_cstr);
+
+ num_matches = m_opaque_sp->FindTypes(sc,
+ name,
+ false,
+ 1,
+ type_list);
+
+ if (num_matches)
+ sb_type = lldb::SBType(type_list.GetTypeAtIndex(0));
}
- else
- return lldb::SBType();
+ return sb_type;
}
lldb::SBTypeList
@@ -376,25 +373,25 @@
SBTypeList retval;
- if (!IsValid())
- return retval;
-
- SymbolContext sc;
- TypeList type_list;
- uint32_t num_matches = 0;
- ConstString name(type);
-
- num_matches = m_opaque_sp->FindTypes(sc,
- name,
- false,
- UINT32_MAX,
- type_list);
-
- for (size_t idx = 0; idx < num_matches; idx++)
+ if (IsValid())
{
- TypeSP sp_at_idx = type_list.GetTypeAtIndex(idx);
+ SymbolContext sc;
+ TypeList type_list;
+ uint32_t num_matches = 0;
+ ConstString name(type);
- retval.AppendType(SBType(sp_at_idx));
+ num_matches = m_opaque_sp->FindTypes(sc,
+ name,
+ false,
+ UINT32_MAX,
+ type_list);
+
+ for (size_t idx = 0; idx < num_matches; idx++)
+ {
+ TypeSP type_sp (type_list.GetTypeAtIndex(idx));
+ if (type_sp)
+ retval.Append(SBType(type_sp));
+ }
}
return retval;
Modified: lldb/trunk/source/API/SBTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=136829&r1=136828&r2=136829&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTarget.cpp (original)
+++ lldb/trunk/source/API/SBTarget.cpp Wed Aug 3 17:57:10 2011
@@ -918,9 +918,9 @@
for (size_t idx = 0; idx < num_matches; idx++)
{
- TypeSP sp_at_idx = type_list.GetTypeAtIndex(idx);
-
- retval.AppendType(SBType(sp_at_idx));
+ TypeSP type_sp (type_list.GetTypeAtIndex(idx));
+ if (type_sp)
+ retval.Append(SBType(type_sp));
}
}
return retval;
Modified: lldb/trunk/source/API/SBType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBType.cpp?rev=136829&r1=136828&r2=136829&view=diff
==============================================================================
--- lldb/trunk/source/API/SBType.cpp (original)
+++ lldb/trunk/source/API/SBType.cpp Wed Aug 3 17:57:10 2011
@@ -14,60 +14,62 @@
#include "clang/AST/Type.h"
#include "lldb/API/SBDefines.h"
-
#include "lldb/API/SBType.h"
#include "lldb/API/SBStream.h"
#include "lldb/Core/ConstString.h"
#include "lldb/Core/Log.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/ClangASTType.h"
+#include "lldb/Symbol/Type.h"
using namespace lldb;
using namespace lldb_private;
using namespace clang;
-SBType::SBType (lldb_private::ClangASTType type) :
-m_opaque_ap(new TypeImpl(ClangASTType(type.GetASTContext(),
- type.GetOpaqueQualType())))
+SBType::SBType() :
+ m_opaque_sp()
{
}
-SBType::SBType (lldb::TypeSP type) :
-m_opaque_ap(new TypeImpl(type))
-{}
+SBType::SBType (const lldb_private::ClangASTType &type) :
+ m_opaque_sp(new TypeImpl(ClangASTType(type.GetASTContext(),
+ type.GetOpaqueQualType())))
+{
+}
-SBType::SBType (const SBType &rhs)
+SBType::SBType (const lldb::TypeSP &type_sp) :
+ m_opaque_sp(new TypeImpl(type_sp))
{
- if (rhs.m_opaque_ap.get() != NULL)
- {
- m_opaque_ap = std::auto_ptr(new TypeImpl(ClangASTType(rhs.m_opaque_ap->GetASTContext(),
- rhs.m_opaque_ap->GetOpaqueQualType())));
- }
}
-SBType::SBType (clang::ASTContext *ctx, clang_type_t ty) :
-m_opaque_ap(new TypeImpl(ClangASTType(ctx, ty)))
+SBType::SBType (const lldb::TypeImplSP &type_impl_sp) :
+ m_opaque_sp(type_impl_sp)
{
}
+
-SBType::SBType() :
-m_opaque_ap(NULL)
+SBType::SBType (const SBType &rhs) :
+ m_opaque_sp()
{
+ if (this != &rhs)
+ {
+ m_opaque_sp = rhs.m_opaque_sp;
+ }
}
-SBType::SBType (TypeImpl impl) :
-m_opaque_ap(&impl)
-{}
+//SBType::SBType (TypeImpl* impl) :
+// m_opaque_ap(impl)
+//{}
+//
bool
SBType::operator == (const lldb::SBType &rhs) const
{
if (IsValid() == false)
return !rhs.IsValid();
- return (rhs.m_opaque_ap->GetASTContext() == m_opaque_ap->GetASTContext())
- &&
- (rhs.m_opaque_ap->GetOpaqueQualType() == m_opaque_ap->GetOpaqueQualType());
+ return (rhs.m_opaque_sp->GetASTContext() == m_opaque_sp->GetASTContext()) &&
+ (rhs.m_opaque_sp->GetOpaqueQualType() == m_opaque_sp->GetOpaqueQualType());
}
bool
@@ -76,9 +78,8 @@
if (IsValid() == false)
return rhs.IsValid();
- return (rhs.m_opaque_ap->GetASTContext() != m_opaque_ap->GetASTContext())
- ||
- (rhs.m_opaque_ap->GetOpaqueQualType() != m_opaque_ap->GetOpaqueQualType());
+ return (rhs.m_opaque_sp->GetASTContext() != m_opaque_sp->GetASTContext()) ||
+ (rhs.m_opaque_sp->GetOpaqueQualType() != m_opaque_sp->GetOpaqueQualType());
}
@@ -87,11 +88,7 @@
{
if (*this != rhs)
{
- if (!rhs.IsValid())
- m_opaque_ap.reset(NULL);
- else
- m_opaque_ap = std::auto_ptr(new TypeImpl(ClangASTType(rhs.m_opaque_ap->GetASTContext(),
- rhs.m_opaque_ap->GetOpaqueQualType())));
+ m_opaque_sp = rhs.m_opaque_sp;
}
return *this;
}
@@ -102,9 +99,9 @@
lldb_private::TypeImpl &
SBType::ref ()
{
- if (m_opaque_ap.get() == NULL)
- m_opaque_ap.reset (new lldb_private::TypeImpl());
- return *m_opaque_ap;
+ if (m_opaque_sp.get() == NULL)
+ m_opaque_sp.reset (new lldb_private::TypeImpl());
+ return *m_opaque_sp;
}
const lldb_private::TypeImpl &
@@ -113,17 +110,17 @@
// "const SBAddress &addr" should already have checked "addr.IsValid()"
// prior to calling this function. In case you didn't we will assert
// and die to let you know.
- assert (m_opaque_ap.get());
- return *m_opaque_ap;
+ assert (m_opaque_sp.get());
+ return *m_opaque_sp;
}
bool
SBType::IsValid() const
{
- if (m_opaque_ap.get() == NULL)
+ if (m_opaque_sp.get() == NULL)
return false;
- return m_opaque_ap->IsValid();
+ return m_opaque_sp->IsValid();
}
size_t
@@ -132,7 +129,7 @@
if (!IsValid())
return 0;
- return ClangASTType::GetTypeByteSize(m_opaque_ap->GetASTContext(), m_opaque_ap->GetOpaqueQualType());
+ return ClangASTType::GetTypeByteSize(m_opaque_sp->GetASTContext(), m_opaque_sp->GetOpaqueQualType());
}
@@ -142,7 +139,7 @@
if (!IsValid())
return false;
- QualType qt = QualType::getFromOpaquePtr(m_opaque_ap->GetOpaqueQualType());
+ QualType qt = QualType::getFromOpaquePtr(m_opaque_sp->GetOpaqueQualType());
const clang::Type* typePtr = qt.getTypePtrOrNull();
if (typePtr)
@@ -156,7 +153,7 @@
if (!IsValid())
return false;
- QualType qt = QualType::getFromOpaquePtr(m_opaque_ap->GetOpaqueQualType());
+ QualType qt = QualType::getFromOpaquePtr(m_opaque_sp->GetOpaqueQualType());
const clang::Type* typePtr = qt.getTypePtrOrNull();
if (typePtr)
@@ -170,8 +167,8 @@
if (!IsValid())
return SBType();
- return SBType(m_opaque_ap->GetASTContext(),
- ClangASTContext::CreatePointerType(m_opaque_ap->GetASTContext(), m_opaque_ap->GetOpaqueQualType()));
+ return SBType(ClangASTType(m_opaque_sp->GetASTContext(),
+ ClangASTContext::CreatePointerType(m_opaque_sp->GetASTContext(), m_opaque_sp->GetOpaqueQualType())));
}
SBType
@@ -180,11 +177,11 @@
if (!IsValid())
return SBType();
- QualType qt = QualType::getFromOpaquePtr(m_opaque_ap->GetOpaqueQualType());
+ QualType qt = QualType::getFromOpaquePtr(m_opaque_sp->GetOpaqueQualType());
const clang::Type* typePtr = qt.getTypePtrOrNull();
if (typePtr)
- return SBType(m_opaque_ap->GetASTContext(),typePtr->getPointeeType().getAsOpaquePtr());
+ return SBType(ClangASTType(m_opaque_sp->GetASTContext(),typePtr->getPointeeType().getAsOpaquePtr()));
return SBType();
}
@@ -194,8 +191,8 @@
if (!IsValid())
return SBType();
- return SBType(m_opaque_ap->GetASTContext(),
- ClangASTContext::CreateLValueReferenceType(m_opaque_ap->GetASTContext(), m_opaque_ap->GetOpaqueQualType()));
+ return SBType(ClangASTType(m_opaque_sp->GetASTContext(),
+ ClangASTContext::CreateLValueReferenceType(m_opaque_sp->GetASTContext(), m_opaque_sp->GetOpaqueQualType())));
}
SBType
@@ -204,9 +201,9 @@
if (!IsValid())
return SBType();
- QualType qt = QualType::getFromOpaquePtr(m_opaque_ap->GetOpaqueQualType());
+ QualType qt = QualType::getFromOpaquePtr(m_opaque_sp->GetOpaqueQualType());
- return SBType(m_opaque_ap->GetASTContext(),qt.getNonReferenceType().getAsOpaquePtr());
+ return SBType(ClangASTType(m_opaque_sp->GetASTContext(),qt.getNonReferenceType().getAsOpaquePtr()));
}
SBType
@@ -221,89 +218,88 @@
switch (type)
{
case eBasicTypeChar:
- base_type_qual = m_opaque_ap->GetASTContext()->CharTy;
+ base_type_qual = m_opaque_sp->GetASTContext()->CharTy;
break;
case eBasicTypeSignedChar:
- base_type_qual = m_opaque_ap->GetASTContext()->SignedCharTy;
+ base_type_qual = m_opaque_sp->GetASTContext()->SignedCharTy;
break;
case eBasicTypeShort:
- base_type_qual = m_opaque_ap->GetASTContext()->ShortTy;
+ base_type_qual = m_opaque_sp->GetASTContext()->ShortTy;
break;
case eBasicTypeUnsignedShort:
- base_type_qual = m_opaque_ap->GetASTContext()->UnsignedShortTy;
+ base_type_qual = m_opaque_sp->GetASTContext()->UnsignedShortTy;
break;
case eBasicTypeInt:
- base_type_qual = m_opaque_ap->GetASTContext()->IntTy;
+ base_type_qual = m_opaque_sp->GetASTContext()->IntTy;
break;
case eBasicTypeUnsignedInt:
- base_type_qual = m_opaque_ap->GetASTContext()->UnsignedIntTy;
+ base_type_qual = m_opaque_sp->GetASTContext()->UnsignedIntTy;
break;
case eBasicTypeLong:
- base_type_qual = m_opaque_ap->GetASTContext()->LongTy;
+ base_type_qual = m_opaque_sp->GetASTContext()->LongTy;
break;
case eBasicTypeUnsignedLong:
- base_type_qual = m_opaque_ap->GetASTContext()->UnsignedLongTy;
+ base_type_qual = m_opaque_sp->GetASTContext()->UnsignedLongTy;
break;
case eBasicTypeBool:
- base_type_qual = m_opaque_ap->GetASTContext()->BoolTy;
+ base_type_qual = m_opaque_sp->GetASTContext()->BoolTy;
break;
case eBasicTypeFloat:
- base_type_qual = m_opaque_ap->GetASTContext()->FloatTy;
+ base_type_qual = m_opaque_sp->GetASTContext()->FloatTy;
break;
case eBasicTypeDouble:
- base_type_qual = m_opaque_ap->GetASTContext()->DoubleTy;
+ base_type_qual = m_opaque_sp->GetASTContext()->DoubleTy;
break;
case eBasicTypeObjCID:
- base_type_qual = m_opaque_ap->GetASTContext()->ObjCBuiltinIdTy;
+ base_type_qual = m_opaque_sp->GetASTContext()->ObjCBuiltinIdTy;
break;
case eBasicTypeVoid:
- base_type_qual = m_opaque_ap->GetASTContext()->VoidTy;
+ base_type_qual = m_opaque_sp->GetASTContext()->VoidTy;
break;
case eBasicTypeWChar:
- base_type_qual = m_opaque_ap->GetASTContext()->WCharTy;
+ base_type_qual = m_opaque_sp->GetASTContext()->WCharTy;
break;
case eBasicTypeChar16:
- base_type_qual = m_opaque_ap->GetASTContext()->Char16Ty;
+ base_type_qual = m_opaque_sp->GetASTContext()->Char16Ty;
break;
case eBasicTypeChar32:
- base_type_qual = m_opaque_ap->GetASTContext()->Char32Ty;
+ base_type_qual = m_opaque_sp->GetASTContext()->Char32Ty;
break;
case eBasicTypeLongLong:
- base_type_qual = m_opaque_ap->GetASTContext()->LongLongTy;
+ base_type_qual = m_opaque_sp->GetASTContext()->LongLongTy;
break;
case eBasicTypeUnsignedLongLong:
- base_type_qual = m_opaque_ap->GetASTContext()->UnsignedLongLongTy;
+ base_type_qual = m_opaque_sp->GetASTContext()->UnsignedLongLongTy;
break;
case eBasicTypeInt128:
- base_type_qual = m_opaque_ap->GetASTContext()->Int128Ty;
+ base_type_qual = m_opaque_sp->GetASTContext()->Int128Ty;
break;
case eBasicTypeUnsignedInt128:
- base_type_qual = m_opaque_ap->GetASTContext()->UnsignedInt128Ty;
+ base_type_qual = m_opaque_sp->GetASTContext()->UnsignedInt128Ty;
break;
case eBasicTypeLongDouble:
- base_type_qual = m_opaque_ap->GetASTContext()->LongDoubleTy;
+ base_type_qual = m_opaque_sp->GetASTContext()->LongDoubleTy;
break;
case eBasicTypeFloatComplex:
- base_type_qual = m_opaque_ap->GetASTContext()->FloatComplexTy;
+ base_type_qual = m_opaque_sp->GetASTContext()->FloatComplexTy;
break;
case eBasicTypeDoubleComplex:
- base_type_qual = m_opaque_ap->GetASTContext()->DoubleComplexTy;
+ base_type_qual = m_opaque_sp->GetASTContext()->DoubleComplexTy;
break;
case eBasicTypeLongDoubleComplex:
- base_type_qual = m_opaque_ap->GetASTContext()->LongDoubleComplexTy;
+ base_type_qual = m_opaque_sp->GetASTContext()->LongDoubleComplexTy;
break;
case eBasicTypeObjCClass:
- base_type_qual = m_opaque_ap->GetASTContext()->ObjCBuiltinClassTy;
+ base_type_qual = m_opaque_sp->GetASTContext()->ObjCBuiltinClassTy;
break;
case eBasicTypeObjCSel:
- base_type_qual = m_opaque_ap->GetASTContext()->ObjCBuiltinSelTy;
+ base_type_qual = m_opaque_sp->GetASTContext()->ObjCBuiltinSelTy;
break;
default:
return SBType();
}
- return SBType(m_opaque_ap->GetASTContext(),
- base_type_qual.getAsOpaquePtr());
+ return SBType(ClangASTType(m_opaque_sp->GetASTContext(), base_type_qual.getAsOpaquePtr()));
}
const char*
@@ -312,38 +308,38 @@
if (!IsValid())
return "";
- return ClangASTType::GetConstTypeName(m_opaque_ap->GetOpaqueQualType()).GetCString();
+ return ClangASTType::GetConstTypeName(m_opaque_sp->GetOpaqueQualType()).GetCString();
}
SBTypeList::SBTypeList() :
-m_opaque_ap(new TypeListImpl())
+ m_opaque_ap(new TypeListImpl())
{
}
SBTypeList::SBTypeList(const SBTypeList& rhs) :
-m_opaque_ap(new TypeListImpl())
+ m_opaque_ap(new TypeListImpl())
{
- for (int j = 0; j < rhs.GetSize(); j++)
- AppendType(rhs.GetTypeAtIndex(j));
+ for (uint32_t i = 0, rhs_size = rhs.GetSize(); i < rhs_size; i++)
+ Append(rhs.GetTypeAtIndex(i));
}
SBTypeList&
SBTypeList::operator = (const SBTypeList& rhs)
{
- if (m_opaque_ap.get() != rhs.m_opaque_ap.get())
+ if (this != &rhs && m_opaque_ap.get() != rhs.m_opaque_ap.get())
{
m_opaque_ap.reset(new TypeListImpl());
- for (int j = 0; j < rhs.GetSize(); j++)
- AppendType(rhs.GetTypeAtIndex(j));
+ for (uint32_t i = 0, rhs_size = rhs.GetSize(); i < rhs_size; i++)
+ Append(rhs.GetTypeAtIndex(i));
}
return *this;
}
void
-SBTypeList::AppendType(SBType type)
+SBTypeList::Append (const SBType& type)
{
if (type.IsValid())
- m_opaque_ap->AppendType(*type.m_opaque_ap.get());
+ m_opaque_ap->Append (type.m_opaque_sp);
}
SBType
Modified: lldb/trunk/source/API/SBValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValue.cpp?rev=136829&r1=136828&r2=136829&view=diff
==============================================================================
--- lldb/trunk/source/API/SBValue.cpp (original)
+++ lldb/trunk/source/API/SBValue.cpp Wed Aug 3 17:57:10 2011
@@ -13,6 +13,7 @@
#include "lldb/Core/DataExtractor.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
+#include "lldb/Core/Scalar.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Core/Value.h"
@@ -270,8 +271,7 @@
if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
{
Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
- result = SBType(m_opaque_sp->GetClangAST(),
- m_opaque_sp->GetClangType());
+ result = SBType(ClangASTType (m_opaque_sp->GetClangAST(), m_opaque_sp->GetClangType()));
}
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
@@ -391,7 +391,7 @@
{
if (type.IsValid())
{
- result = SBValue(m_opaque_sp->GetSyntheticChildAtOffset(offset, *type.m_opaque_ap->GetClangASTType(), true));
+ result = SBValue(m_opaque_sp->GetSyntheticChildAtOffset(offset, type.m_opaque_sp->GetClangASTType(), true));
result.m_opaque_sp->SetName(ConstString(name));
}
}
@@ -449,8 +449,8 @@
lldb::DataBufferSP buffer(new lldb_private::DataBufferHeap(&address,sizeof(lldb::addr_t)));
ValueObjectSP result_valobj_sp(ValueObjectConstResult::Create(m_opaque_sp->GetUpdatePoint().GetExecutionContextScope(),
- real_type.m_opaque_ap->GetASTContext(),
- real_type.m_opaque_ap->GetOpaqueQualType(),
+ real_type.m_opaque_sp->GetASTContext(),
+ real_type.m_opaque_sp->GetOpaqueQualType(),
ConstString(name),
buffer,
lldb::endian::InlHostByteOrder(),
@@ -618,6 +618,38 @@
return sb_value;
}
+int64_t
+SBValue::GetValueAsSigned(int64_t fail_value)
+{
+ if (m_opaque_sp)
+ {
+ if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
+ {
+ Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
+ Scalar scalar;
+ if (m_opaque_sp->ResolveValue (scalar))
+ return scalar.GetRawBits64(fail_value);
+ }
+ }
+ return fail_value;
+}
+
+uint64_t
+SBValue::GetValueAsUnsigned(uint64_t fail_value)
+{
+ if (m_opaque_sp)
+ {
+ if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
+ {
+ Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
+ Scalar scalar;
+ if (m_opaque_sp->ResolveValue (scalar))
+ return scalar.GetRawBits64(fail_value);
+ }
+ }
+ return fail_value;
+}
+
uint32_t
SBValue::GetNumChildren ()
{
Modified: lldb/trunk/source/Symbol/ClangASTType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTType.cpp?rev=136829&r1=136828&r2=136829&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTType.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTType.cpp Wed Aug 3 17:57:10 2011
@@ -1606,3 +1606,17 @@
qual_type.getQualifiers().removeFastQualifiers();
return qual_type.getAsOpaquePtr();
}
+
+
+bool
+lldb_private::operator == (const lldb_private::ClangASTType &lhs, const lldb_private::ClangASTType &rhs)
+{
+ return lhs.GetASTContext() == rhs.GetASTContext() && lhs.GetOpaqueQualType() == rhs.GetOpaqueQualType();
+}
+
+
+bool
+lldb_private::operator != (const lldb_private::ClangASTType &lhs, const lldb_private::ClangASTType &rhs)
+{
+ return lhs.GetASTContext() != rhs.GetASTContext() || lhs.GetOpaqueQualType() != rhs.GetOpaqueQualType();
+}
Modified: lldb/trunk/source/Symbol/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Type.cpp?rev=136829&r1=136828&r2=136829&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Type.cpp (original)
+++ lldb/trunk/source/Symbol/Type.cpp Wed Aug 3 17:57:10 2011
@@ -731,25 +731,24 @@
return true;
}
-TypeImpl::TypeImpl(const lldb_private::ClangASTType& type) :
-m_clang_ast_type(new ClangASTType(type.GetASTContext(),
- type.GetOpaqueQualType())),
-m_lldb_type(lldb::TypeSP())
+TypeImpl::TypeImpl(const lldb_private::ClangASTType& clang_ast_type) :
+ m_clang_ast_type(clang_ast_type.GetASTContext(), clang_ast_type.GetOpaqueQualType()),
+ m_type_sp()
{}
-TypeImpl::TypeImpl(lldb::TypeSP type) :
-m_clang_ast_type(new ClangASTType(type->GetClangAST(),
- type->GetClangFullType())),
-m_lldb_type(type)
-{}
+TypeImpl::TypeImpl(const lldb::TypeSP& type) :
+ m_clang_ast_type(type->GetClangAST(), type->GetClangFullType()),
+ m_type_sp(type)
+{
+}
TypeImpl&
TypeImpl::operator = (const TypeImpl& rhs)
{
if (*this != rhs)
{
- m_clang_ast_type = std::auto_ptr(rhs.m_clang_ast_type.get());
- m_lldb_type = lldb::TypeSP(rhs.m_lldb_type);
+ m_clang_ast_type = rhs.m_clang_ast_type;
+ m_type_sp = rhs.m_type_sp;
}
return *this;
}
@@ -760,7 +759,7 @@
if (!IsValid())
return NULL;
- return m_clang_ast_type->GetASTContext();
+ return m_clang_ast_type.GetASTContext();
}
lldb::clang_type_t
@@ -769,5 +768,5 @@
if (!IsValid())
return NULL;
- return m_clang_ast_type->GetOpaqueQualType();
+ return m_clang_ast_type.GetOpaqueQualType();
}
Modified: lldb/trunk/test/expression_command/test/TestExprs.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/expression_command/test/TestExprs.py?rev=136829&r1=136828&r2=136829&view=diff
==============================================================================
--- lldb/trunk/test/expression_command/test/TestExprs.py (original)
+++ lldb/trunk/test/expression_command/test/TestExprs.py Wed Aug 3 17:57:10 2011
@@ -134,29 +134,29 @@
frame = thread.GetFrameAtIndex(0)
val = frame.EvaluateExpression("2.234")
- self.expect(val.GetValue(frame), "2.345 evaluated correctly", exe=False,
+ self.expect(val.GetValue(), "2.345 evaluated correctly", exe=False,
startstr = "2.234")
self.expect(val.GetTypeName(), "2.345 evaluated correctly", exe=False,
startstr = "double")
self.DebugSBValue(val)
val = frame.EvaluateExpression("argc")
- self.expect(val.GetValue(frame), "Argc evaluated correctly", exe=False,
+ self.expect(val.GetValue(), "Argc evaluated correctly", exe=False,
startstr = "4")
self.DebugSBValue(val)
val = frame.EvaluateExpression("*argv[1]")
- self.expect(val.GetValue(frame), "Argv[1] evaluated correctly", exe=False,
+ self.expect(val.GetValue(), "Argv[1] evaluated correctly", exe=False,
startstr = "'X'")
self.DebugSBValue(val)
val = frame.EvaluateExpression("*argv[2]")
- self.expect(val.GetValue(frame), "Argv[2] evaluated correctly", exe=False,
+ self.expect(val.GetValue(), "Argv[2] evaluated correctly", exe=False,
startstr = "'Y'")
self.DebugSBValue(val)
val = frame.EvaluateExpression("*argv[3]")
- self.expect(val.GetValue(frame), "Argv[3] evaluated correctly", exe=False,
+ self.expect(val.GetValue(), "Argv[3] evaluated correctly", exe=False,
startstr = "'Z'")
self.DebugSBValue(val)
Modified: lldb/trunk/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py?rev=136829&r1=136828&r2=136829&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py (original)
+++ lldb/trunk/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py Wed Aug 3 17:57:10 2011
@@ -149,7 +149,7 @@
frame0 = thread.GetFrameAtIndex(0)
var = frame0.FindValue('val', lldb.eValueTypeVariableArgument)
self.assertTrue(frame0.GetLineEntry().GetLine() == self.line1 and
- var.GetValue(frame0) == '3')
+ var.GetValue() == '3')
# The hit count for the breakpoint should be 3.
self.assertTrue(breakpoint.GetHitCount() == 3)
Modified: lldb/trunk/test/functionalities/conditional_break/TestConditionalBreak.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/conditional_break/TestConditionalBreak.py?rev=136829&r1=136828&r2=136829&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/conditional_break/TestConditionalBreak.py (original)
+++ lldb/trunk/test/functionalities/conditional_break/TestConditionalBreak.py Wed Aug 3 17:57:10 2011
@@ -90,7 +90,7 @@
# And the local variable 'val' should have a value of (int) 3.
val = frame1.FindVariable("val")
self.assertTrue(val.GetTypeName() == "int", "'val' has int type")
- self.assertTrue(val.GetValue(frame1) == "3", "'val' has a value of 3")
+ self.assertTrue(val.GetValue() == "3", "'val' has a value of 3")
break
process.Continue()
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=136829&r1=136828&r2=136829&view=diff
==============================================================================
--- lldb/trunk/test/lang/c/array_types/TestArrayTypes.py (original)
+++ lldb/trunk/test/lang/c/array_types/TestArrayTypes.py Wed Aug 3 17:57:10 2011
@@ -161,7 +161,7 @@
child3 = variable.GetChildAtIndex(3)
self.DebugSBValue(child3)
- self.assertTrue(child3.GetSummary(frame) == '"Guten Tag"',
+ self.assertTrue(child3.GetSummary() == '"Guten Tag"',
'strings[3] == "Guten Tag"')
# Lookup the "char_16" char array variable.
@@ -171,7 +171,7 @@
"Variable 'char_16' should have 16 children")
# Lookup the "ushort_matrix" ushort[] array variable.
- # Notice the pattern of int(child0_2.GetValue(frame), 0). We pass a
+ # Notice the pattern of int(child0_2.GetValue(), 0). We pass a
# base of 0 so that the proper radix is determined based on the contents
# of the string. Same applies to long().
variable = frame.FindVariable("ushort_matrix")
@@ -184,7 +184,7 @@
"Variable 'ushort_matrix[0]' should have 3 children")
child0_2 = child0.GetChildAtIndex(2)
self.DebugSBValue(child0_2)
- self.assertTrue(int(child0_2.GetValue(frame), 0) == 3,
+ self.assertTrue(int(child0_2.GetValue(), 0) == 3,
"ushort_matrix[0][2] == 3")
# Lookup the "long_6" char array variable.
@@ -194,7 +194,7 @@
"Variable 'long_6' should have 6 children")
child5 = variable.GetChildAtIndex(5)
self.DebugSBValue(child5)
- self.assertTrue(long(child5.GetValue(frame), 0) == 6,
+ self.assertTrue(long(child5.GetValue(), 0) == 6,
"long_6[5] == 6")
# Last, check that "long_6" has a value type of eValueTypeVariableLocal
Modified: lldb/trunk/test/lang/c/bitfields/TestBitfields.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/c/bitfields/TestBitfields.py?rev=136829&r1=136828&r2=136829&view=diff
==============================================================================
--- lldb/trunk/test/lang/c/bitfields/TestBitfields.py (original)
+++ lldb/trunk/test/lang/c/bitfields/TestBitfields.py Wed Aug 3 17:57:10 2011
@@ -116,31 +116,31 @@
bits.GetByteSize() == 4,
"(Bits)bits with byte size of 4 and 8 children")
- # Notice the pattern of int(b1.GetValue(frame), 0). We pass a base of 0
+ # Notice the pattern of int(b1.GetValue(), 0). We pass a base of 0
# so that the proper radix is determined based on the contents of the
# string.
b1 = bits.GetChildAtIndex(0)
self.DebugSBValue(b1)
self.assertTrue(b1.GetName() == "b1" and
b1.GetTypeName() == "uint32_t:1" and
- b1.IsInScope(frame) and
- int(b1.GetValue(frame), 0) == 1,
+ b1.IsInScope() and
+ int(b1.GetValue(), 0) == 1,
'bits.b1 has type uint32_t:1, is in scope, and == 1')
b7 = bits.GetChildAtIndex(6)
self.DebugSBValue(b7)
self.assertTrue(b7.GetName() == "b7" and
b7.GetTypeName() == "uint32_t:7" and
- b7.IsInScope(frame) and
- int(b7.GetValue(frame), 0) == 127,
+ b7.IsInScope() and
+ int(b7.GetValue(), 0) == 127,
'bits.b7 has type uint32_t:7, is in scope, and == 127')
four = bits.GetChildAtIndex(7)
self.DebugSBValue(four)
self.assertTrue(four.GetName() == "four" and
four.GetTypeName() == "uint32_t:4" and
- four.IsInScope(frame) and
- int(four.GetValue(frame), 0) == 15,
+ four.IsInScope() and
+ int(four.GetValue(), 0) == 15,
'bits.four has type uint32_t:4, is in scope, and == 15')
# Now kill the process, and we are done.
Modified: lldb/trunk/test/lang/cpp/class_static/TestStaticVariables.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/class_static/TestStaticVariables.py?rev=136829&r1=136828&r2=136829&view=diff
==============================================================================
--- lldb/trunk/test/lang/cpp/class_static/TestStaticVariables.py (original)
+++ lldb/trunk/test/lang/cpp/class_static/TestStaticVariables.py Wed Aug 3 17:57:10 2011
@@ -116,7 +116,7 @@
child1_x = child1.GetChildAtIndex(0)
self.DebugSBValue(child1_x)
self.assertTrue(child1_x.GetTypeName() == 'int' and
- child1_x.GetValue(frame) == '11')
+ child1_x.GetValue() == '11')
# SBFrame.FindValue() should also work.
val = frame.FindValue("A::g_points", lldb.eValueTypeVariableGlobal)
Modified: lldb/trunk/test/lang/objc/foundation/TestObjCMethods.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/foundation/TestObjCMethods.py?rev=136829&r1=136828&r2=136829&view=diff
==============================================================================
--- lldb/trunk/test/lang/objc/foundation/TestObjCMethods.py (original)
+++ lldb/trunk/test/lang/objc/foundation/TestObjCMethods.py Wed Aug 3 17:57:10 2011
@@ -240,9 +240,9 @@
my_str_var = my_var.GetChildMemberWithName("str")
self.assertTrue(my_str_var, "Found a str ivar in my")
- str_value = int(str_var.GetValue(cur_frame), 0)
+ str_value = int(str_var.GetValue(), 0)
- my_str_value = int(my_str_var.GetValue(cur_frame), 0)
+ my_str_value = int(my_str_var.GetValue(), 0)
self.assertTrue(str_value == my_str_value, "Got the correct value for my->str")
Modified: lldb/trunk/test/lang/objc/objc-ivar-offsets/TestObjCIvarOffsets.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/objc-ivar-offsets/TestObjCIvarOffsets.py?rev=136829&r1=136828&r2=136829&view=diff
==============================================================================
--- lldb/trunk/test/lang/objc/objc-ivar-offsets/TestObjCIvarOffsets.py (original)
+++ lldb/trunk/test/lang/objc/objc-ivar-offsets/TestObjCIvarOffsets.py Wed Aug 3 17:57:10 2011
@@ -58,14 +58,14 @@
mine_backed_int = mine.GetChildMemberWithName ("_backed_int")
self.assertTrue(mine_backed_int, "Found mine->backed_int local variable.")
- backed_value = int (mine_backed_int.GetValue (frame), 0)
+ backed_value = int (mine_backed_int.GetValue (), 0)
self.assertTrue (backed_value == 1111)
# Test the value object value for DerivedClass->_derived_backed_int
mine_derived_backed_int = mine.GetChildMemberWithName ("_derived_backed_int")
self.assertTrue(mine_derived_backed_int, "Found mine->derived_backed_int local variable.")
- derived_backed_value = int (mine_derived_backed_int.GetValue (frame), 0)
+ derived_backed_value = int (mine_derived_backed_int.GetValue (), 0)
self.assertTrue (derived_backed_value == 3333)
if __name__ == '__main__':
Modified: lldb/trunk/test/lang/objc/objc-stepping/TestObjCStepping.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/objc-stepping/TestObjCStepping.py?rev=136829&r1=136828&r2=136829&view=diff
==============================================================================
--- lldb/trunk/test/lang/objc/objc-stepping/TestObjCStepping.py (original)
+++ lldb/trunk/test/lang/objc/objc-stepping/TestObjCStepping.py Wed Aug 3 17:57:10 2011
@@ -84,7 +84,7 @@
self.assertTrue(mySource, "Found mySource local variable.")
mySource_isa = mySource.GetChildMemberWithName ("isa")
self.assertTrue(mySource_isa, "Found mySource->isa local variable.")
- mySource_isa.GetValue (thread.GetFrameAtIndex(0))
+ mySource_isa.GetValue ()
# Lets delete mySource so we can check that after stepping a child variable
# with no parent persists and is useful.
@@ -125,8 +125,8 @@
line_number = frame.GetLineEntry().GetLine()
self.assertTrue (line_number == self.line3, "Continued to third breakpoint in main, our object should now be swizzled.")
- mySource_isa.GetValue (frame)
- did_change = mySource_isa.GetValueDidChange (frame)
+ mySource_isa.GetValue ()
+ did_change = mySource_isa.GetValueDidChange ()
self.assertTrue (did_change, "The isa did indeed change, swizzled!")
Modified: lldb/trunk/test/lldbutil.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbutil.py?rev=136829&r1=136828&r2=136829&view=diff
==============================================================================
--- lldb/trunk/test/lldbutil.py (original)
+++ lldb/trunk/test/lldbutil.py Wed Aug 3 17:57:10 2011
@@ -447,7 +447,7 @@
for var in vars:
args.append("(%s)%s=%s" % (var.GetTypeName(),
var.GetName(),
- var.GetValue(frame)))
+ var.GetValue()))
if frame.GetFunction():
name = frame.GetFunction().GetName()
elif frame.GetSymbol():
@@ -472,7 +472,7 @@
#print >> output, value
print >> output, "%s (number of children = %d):" % (value.GetName(), value.GetNumChildren())
for child in value:
- print >> output, "Name: %s, Value: %s" % (child.GetName(), child.GetValue(frame))
+ print >> output, "Name: %s, Value: %s" % (child.GetName(), child.GetValue())
if string_buffer:
return output.getvalue()
Modified: lldb/trunk/test/python_api/frame/TestFrames.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/frame/TestFrames.py?rev=136829&r1=136828&r2=136829&view=diff
==============================================================================
--- lldb/trunk/test/python_api/frame/TestFrames.py (original)
+++ lldb/trunk/test/python_api/frame/TestFrames.py Wed Aug 3 17:57:10 2011
@@ -77,7 +77,7 @@
for val in valList:
argList.append("(%s)%s=%s" % (val.GetTypeName(),
val.GetName(),
- val.GetValue(frame)))
+ val.GetValue()))
print >> session, "%s(%s)" % (name, ", ".join(argList))
# Also check the generic pc & stack pointer. We can't test their absolute values,
@@ -85,10 +85,10 @@
gpr_reg_set = lldbutil.get_GPRs(frame)
pc_value = gpr_reg_set.GetChildMemberWithName("pc")
self.assertTrue (pc_value, "We should have a valid PC.")
- self.assertTrue (int(pc_value.GetValue(frame), 0) == frame.GetPC(), "PC gotten as a value should equal frame's GetPC")
+ self.assertTrue (int(pc_value.GetValue(), 0) == frame.GetPC(), "PC gotten as a value should equal frame's GetPC")
sp_value = gpr_reg_set.GetChildMemberWithName("sp")
self.assertTrue (sp_value, "We should have a valid Stack Pointer.")
- self.assertTrue (int(sp_value.GetValue(frame), 0) == frame.GetSP(), "SP gotten as a value should equal frame's GetSP")
+ self.assertTrue (int(sp_value.GetValue(), 0) == frame.GetSP(), "SP gotten as a value should equal frame's GetSP")
print >> session, "---"
process.Continue()
Modified: lldb/trunk/test/python_api/lldbutil/iter/TestRegistersIterator.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/lldbutil/iter/TestRegistersIterator.py?rev=136829&r1=136828&r2=136829&view=diff
==============================================================================
--- lldb/trunk/test/python_api/lldbutil/iter/TestRegistersIterator.py (original)
+++ lldb/trunk/test/python_api/lldbutil/iter/TestRegistersIterator.py Wed Aug 3 17:57:10 2011
@@ -54,7 +54,7 @@
for reg in REGs:
self.assertTrue(reg)
if self.TraceOn():
- print "%s => %s" % (reg.GetName(), reg.GetValue(frame))
+ print "%s => %s" % (reg.GetName(), reg.GetValue())
REGs = lldbutil.get_FPRs(frame)
num = len(REGs)
@@ -63,7 +63,7 @@
for reg in REGs:
self.assertTrue(reg)
if self.TraceOn():
- print "%s => %s" % (reg.GetName(), reg.GetValue(frame))
+ print "%s => %s" % (reg.GetName(), reg.GetValue())
REGs = lldbutil.get_ESRs(frame)
num = len(REGs)
@@ -72,7 +72,7 @@
for reg in REGs:
self.assertTrue(reg)
if self.TraceOn():
- print "%s => %s" % (reg.GetName(), reg.GetValue(frame))
+ print "%s => %s" % (reg.GetName(), reg.GetValue())
# And these should also work.
for kind in ["General Purpose Registers",
Modified: lldb/trunk/test/python_api/process/TestProcessAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/process/TestProcessAPI.py?rev=136829&r1=136828&r2=136829&view=diff
==============================================================================
--- lldb/trunk/test/python_api/process/TestProcessAPI.py (original)
+++ lldb/trunk/test/python_api/process/TestProcessAPI.py Wed Aug 3 17:57:10 2011
@@ -86,11 +86,11 @@
self.DebugSBValue(val)
# If the variable does not have a load address, there's no sense continuing.
- if not val.GetLocation(frame).startswith("0x"):
+ if not val.GetLocation().startswith("0x"):
return
# OK, let's get the hex location of the variable.
- location = int(val.GetLocation(frame), 16)
+ location = int(val.GetLocation(), 16)
# Due to the typemap magic (see lldb.swig), we pass in 1 to ReadMemory and
# expect to get a Python string as the result object!
@@ -128,11 +128,11 @@
self.DebugSBValue(val)
# If the variable does not have a load address, there's no sense continuing.
- if not val.GetLocation(frame).startswith("0x"):
+ if not val.GetLocation().startswith("0x"):
return
# OK, let's get the hex location of the variable.
- location = int(val.GetLocation(frame), 16)
+ location = int(val.GetLocation(), 16)
# The program logic makes the 'my_char' variable to have memory content as 'x'.
# But we want to use the WriteMemory() API to assign 'a' to the variable.
@@ -179,11 +179,11 @@
self.DebugSBValue(val)
# If the variable does not have a load address, there's no sense continuing.
- if not val.GetLocation(frame).startswith("0x"):
+ if not val.GetLocation().startswith("0x"):
return
# OK, let's get the hex location of the variable.
- location = int(val.GetLocation(frame), 16)
+ location = int(val.GetLocation(), 16)
# Note that the canonical from of the bytearray is little endian.
from lldbutil import int_to_bytearray, bytearray_to_int
@@ -212,14 +212,14 @@
self.fail("SBProcess.WriteMemory() failed")
# Make sure that the val we got originally updates itself to notice the change:
- self.expect(val.GetValue(frame),
+ self.expect(val.GetValue(),
"SBProcess.ReadMemory() successfully writes (int)256 to the memory location for 'my_int'",
exe=False,
startstr = '256')
# And for grins, get the SBValue for the global variable 'my_int' again, to make sure that also tracks the new value:
val = frame.FindValue("my_int", lldb.eValueTypeVariableGlobal)
- self.expect(val.GetValue(frame),
+ self.expect(val.GetValue(),
"SBProcess.ReadMemory() successfully writes (int)256 to the memory location for 'my_int'",
exe=False,
startstr = '256')
From gclayton at apple.com Wed Aug 3 17:57:43 2011
From: gclayton at apple.com (Greg Clayton)
Date: Wed, 03 Aug 2011 22:57:43 -0000
Subject: [Lldb-commits] [lldb] r136830 - /lldb/tags/lldb-71/
Message-ID: <20110803225743.18ECD2A6C12C@llvm.org>
Author: gclayton
Date: Wed Aug 3 17:57:42 2011
New Revision: 136830
URL: http://llvm.org/viewvc/llvm-project?rev=136830&view=rev
Log:
lldb-71
Added:
lldb/tags/lldb-71/
- copied from r136829, lldb/trunk/
From granata.enrico at gmail.com Wed Aug 3 20:41:03 2011
From: granata.enrico at gmail.com (Enrico Granata)
Date: Thu, 04 Aug 2011 01:41:03 -0000
Subject: [Lldb-commits] [lldb] r136861 - in /lldb/trunk: examples/synthetic/
include/lldb/API/ scripts/Python/interface/ source/API/ source/Core/
test/functionalities/data-formatter/data-formatter-objc/
test/functionalities/data-formatter/data-formatter-python-synth/
Message-ID: <20110804014103.4AFE42A6C12C@llvm.org>
Author: enrico
Date: Wed Aug 3 20:41:02 2011
New Revision: 136861
URL: http://llvm.org/viewvc/llvm-project?rev=136861&view=rev
Log:
APIs to GetValueAsSigned/Unsigned() in SBValue now also accept an SBError parameter to give more info about any problem
The synthetic children providers now use the new (safer) APIs to get the values of objects
As a side effect, fixed an issue in ValueObject where ResolveValue() was not always updating the value before reading it
Modified:
lldb/trunk/examples/synthetic/CFString.py
lldb/trunk/examples/synthetic/StdListSynthProvider.py
lldb/trunk/examples/synthetic/StdMapSynthProvider.py
lldb/trunk/examples/synthetic/StdVectorSynthProvider.py
lldb/trunk/include/lldb/API/SBValue.h
lldb/trunk/scripts/Python/interface/SBValue.i
lldb/trunk/source/API/SBValue.cpp
lldb/trunk/source/Core/ValueObject.cpp
lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/CFString.py
lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/StdListSynthProvider.py
lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/StdMapSynthProvider.py
lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/StdVectorSynthProvider.py
Modified: lldb/trunk/examples/synthetic/CFString.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/synthetic/CFString.py?rev=136861&r1=136860&r2=136861&view=diff
==============================================================================
--- lldb/trunk/examples/synthetic/CFString.py (original)
+++ lldb/trunk/examples/synthetic/CFString.py Wed Aug 3 20:41:02 2011
@@ -45,7 +45,7 @@
# for 32bit targets, use safe ObjC code
return self.handle_unicode_string_safe()
offset = 12
- pointer = int(self.valobj.GetValue(), 0) + offset
+ pointer = self.valobj.GetValueAsUnsigned(0) + offset
pystr = self.read_unicode(pointer)
return self.valobj.CreateValueFromExpression("content",
"(char*)\"" + pystr.encode('utf-8') + "\"")
@@ -60,7 +60,7 @@
def handle_unicode_string(self):
# step 1: find offset
if self.inline:
- pointer = int(self.valobj.GetValue(), 0) + self.size_of_cfruntime_base();
+ pointer = self.valobj.GetValueAsUnsigned(0) + self.size_of_cfruntime_base();
if self.explicit == False:
# untested, use the safe code path
return self.handle_unicode_string_safe();
@@ -76,11 +76,11 @@
# for an inline string)
pointer = pointer + 8;
else:
- pointer = int(self.valobj.GetValue(), 0) + self.size_of_cfruntime_base();
+ pointer = self.valobj.GetValueAsUnsigned(0) + self.size_of_cfruntime_base();
# read 8 bytes here and make an address out of them
vopointer = self.valobj.CreateChildAtOffset("dummy",
pointer,self.valobj.GetType().GetBasicType(lldb.eBasicTypeChar).GetPointerType());
- pointer = int(vopointer.GetValue(), 0)
+ pointer = vopointer.GetValueAsUnsigned(0)
# step 2: read Unicode data at pointer
pystr = self.read_unicode(pointer)
# step 3: return it
Modified: lldb/trunk/examples/synthetic/StdListSynthProvider.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/synthetic/StdListSynthProvider.py?rev=136861&r1=136860&r2=136861&view=diff
==============================================================================
--- lldb/trunk/examples/synthetic/StdListSynthProvider.py (original)
+++ lldb/trunk/examples/synthetic/StdListSynthProvider.py Wed Aug 3 20:41:02 2011
@@ -1,61 +1,68 @@
import re
class StdListSynthProvider:
+
def __init__(self, valobj, dict):
- self.valobj = valobj;
+ self.valobj = valobj
self.update()
+
def num_children(self):
- next_val = int(self.Mnext.GetValue(),0)
- prev_val = int(self.Mprev.GetValue(),0)
- if next_val == 0:
- return 0;
- if next_val == self.Mnode_address:
- return 0;
+ next_val = self.next.GetValueAsUnsigned(0)
+ prev_val = self.prev.GetValueAsUnsigned(0)
+ # After a std::list has been initialized, both next and prev will be non-NULL
+ if next_val == 0 or prev_val == 0:
+ return 0
+ if next_val == self.node_address:
+ return 0
if next_val == prev_val:
- return 1;
+ return 1
size = 2
- current = self.Mnext
- while int(current.GetChildMemberWithName('_M_next').GetValue(),0) != self.Mnode_address:
- size = size + 1;
+ current = self.next
+ while current.GetChildMemberWithName('_M_next').GetValueAsUnsigned(0) != self.node_address:
+ size = size + 1
current = current.GetChildMemberWithName('_M_next')
return (size - 1)
+
def get_child_index(self,name):
if name == "len":
- return self.num_children();
+ return self.num_children()
else:
return int(name.lstrip('[').rstrip(']'))
+
def get_child_at_index(self,index):
if index == self.num_children():
return self.valobj.CreateValueFromExpression("len",str(self.num_children()))
else:
offset = index
- current = self.Mnext;
+ current = self.next
while offset > 0:
- current = current.GetChildMemberWithName('_M_next');
- offset = offset - 1;
+ current = current.GetChildMemberWithName('_M_next')
+ offset = offset - 1
return current.CreateChildAtOffset('['+str(index)+']',2*current.GetType().GetByteSize(),self.data_type)
+
def extract_type_name(self,name):
self.type_name = name[16:]
index = 2
count_of_template = 1
while index < len(self.type_name):
if self.type_name[index] == '<':
- count_of_template = count_of_template + 1;
+ count_of_template = count_of_template + 1
elif self.type_name[index] == '>':
- count_of_template = count_of_template - 1;
+ count_of_template = count_of_template - 1
elif self.type_name[index] == ',' and count_of_template == 1:
self.type_name = self.type_name[:index]
break
- index = index + 1;
+ index = index + 1
self.type_name_nospaces = self.type_name.replace(", ", ",")
+
def update(self):
- self.Mimpl = self.valobj.GetChildMemberWithName('_M_impl')
- self.Mnode = self.Mimpl.GetChildMemberWithName('_M_node')
- self.extract_type_name(self.Mimpl.GetType().GetName())
- self.Mnode_address = int(self.valobj.AddressOf().GetValue(), 0)
- self.Mnext = self.Mnode.GetChildMemberWithName('_M_next')
- self.Mprev = self.Mnode.GetChildMemberWithName('_M_prev')
- self.data_type = self.Mnode.GetTarget().FindFirstType(self.type_name)
+ impl = self.valobj.GetChildMemberWithName('_M_impl')
+ node = impl.GetChildMemberWithName('_M_node')
+ self.extract_type_name(impl.GetType().GetName())
+ self.node_address = self.valobj.AddressOf().GetValueAsUnsigned(0)
+ self.next = node.GetChildMemberWithName('_M_next')
+ self.prev = node.GetChildMemberWithName('_M_prev')
+ self.data_type = node.GetTarget().FindFirstType(self.type_name)
# tries to fight against a difference in formatting type names between gcc and clang
if self.data_type.IsValid() == False:
- self.data_type = self.Mnode.GetTarget().FindFirstType(self.type_name_nospaces)
+ self.data_type = node.GetTarget().FindFirstType(self.type_name_nospaces)
self.data_size = self.data_type.GetByteSize()
Modified: lldb/trunk/examples/synthetic/StdMapSynthProvider.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/synthetic/StdMapSynthProvider.py?rev=136861&r1=136860&r2=136861&view=diff
==============================================================================
--- lldb/trunk/examples/synthetic/StdMapSynthProvider.py (original)
+++ lldb/trunk/examples/synthetic/StdMapSynthProvider.py Wed Aug 3 20:41:02 2011
@@ -58,7 +58,7 @@
root_ptr_val = self.node_ptr_value(self.Mroot)
if root_ptr_val == 0:
return 0;
- return int(self.Mimpl.GetChildMemberWithName('_M_node_count').GetValue(), 0);
+ return self.Mimpl.GetChildMemberWithName('_M_node_count').GetValueAsUnsigned(0)
def get_child_index(self,name):
if name == "len":
return self.num_children();
@@ -77,7 +77,7 @@
return current.CreateChildAtOffset('['+str(index)+']',self.skip_size,self.data_type)
# utility functions
def node_ptr_value(self,node):
- return int(node.GetValue(),0);
+ return node.GetValueAsUnsigned(0)
def right(self,node):
return node.GetChildMemberWithName("_M_right");
def left(self,node):
Modified: lldb/trunk/examples/synthetic/StdVectorSynthProvider.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/synthetic/StdVectorSynthProvider.py?rev=136861&r1=136860&r2=136861&view=diff
==============================================================================
--- lldb/trunk/examples/synthetic/StdVectorSynthProvider.py (original)
+++ lldb/trunk/examples/synthetic/StdVectorSynthProvider.py Wed Aug 3 20:41:02 2011
@@ -1,25 +1,55 @@
class StdVectorSynthProvider:
+
def __init__(self, valobj, dict):
self.valobj = valobj;
self.update()
+
def num_children(self):
- start_val = int(self.Mstart.GetValue(),0)
- finish_val = int(self.Mfinish.GetValue(),0)
- return (finish_val-start_val)/self.data_size
+ start_val = self.start.GetValueAsUnsigned(0)
+ finish_val = self.finish.GetValueAsUnsigned(0)
+ end_val = self.end.GetValueAsUnsigned(0)
+ # Before a vector has been constructed, it will contain bad values
+ # so we really need to be careful about the length we return since
+ # unitialized data can cause us to return a huge number. We need
+ # to also check for any of the start, finish or end of storage values
+ # being zero (NULL). If any are, then this vector has not been
+ # initialized yet and we should return zero
+
+ # Make sure nothing is NULL
+ if start_val == 0 or finish_val == 0 or end_val == 0:
+ return 0
+ # Make sure start is less than finish
+ if start_val >= finish_val:
+ return 0
+ # Make sure finish is less than or equal to end of storage
+ if finish_val > end_val:
+ return 0
+
+ # We might still get things wrong, so cap things at 256 items for now
+ # TODO: read a target "settings set" variable for this to allow it to
+ # be customized
+ num_children = (finish_val-start_val)/self.data_size
+ if num_children > 256:
+ return 256
+ return num_children
+
def get_child_index(self,name):
if name == "len":
return self.num_children();
else:
return int(name.lstrip('[').rstrip(']'))
+
def get_child_at_index(self,index):
if index == self.num_children():
return self.valobj.CreateValueFromExpression("len",str(self.num_children()))
else:
offset = index * self.data_size
- return self.Mstart.CreateChildAtOffset('['+str(index)+']',offset,self.data_type)
+ return self.start.CreateChildAtOffset('['+str(index)+']',offset,self.data_type)
+
def update(self):
- self.Mimpl = self.valobj.GetChildMemberWithName('_M_impl')
- self.Mstart = self.Mimpl.GetChildMemberWithName('_M_start')
- self.Mfinish = self.Mimpl.GetChildMemberWithName('_M_finish')
- self.data_type = self.Mstart.GetType().GetPointeeType()
+ impl = self.valobj.GetChildMemberWithName('_M_impl')
+ self.start = impl.GetChildMemberWithName('_M_start')
+ self.finish = impl.GetChildMemberWithName('_M_finish')
+ self.end = impl.GetChildMemberWithName('_M_end_of_storage')
+ self.data_type = self.start.GetType().GetPointeeType()
self.data_size = self.data_type.GetByteSize()
Modified: lldb/trunk/include/lldb/API/SBValue.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBValue.h?rev=136861&r1=136860&r2=136861&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBValue.h (original)
+++ lldb/trunk/include/lldb/API/SBValue.h Wed Aug 3 20:41:02 2011
@@ -72,6 +72,12 @@
GetValue ();
int64_t
+ GetValueAsSigned(SBError& error, int64_t fail_value=0);
+
+ uint64_t
+ GetValueAsUnsigned(SBError& error, uint64_t fail_value=0);
+
+ int64_t
GetValueAsSigned(int64_t fail_value=0);
uint64_t
Modified: lldb/trunk/scripts/Python/interface/SBValue.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBValue.i?rev=136861&r1=136860&r2=136861&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBValue.i (original)
+++ lldb/trunk/scripts/Python/interface/SBValue.i Wed Aug 3 20:41:02 2011
@@ -95,9 +95,15 @@
GetValue ();
int64_t
- GetValueAsSigned(int64_t fail_value=0);
+ GetValueAsSigned(SBError& error, int64_t fail_value=0);
uint64_t
+ GetValueAsUnsigned(SBError& error, uint64_t fail_value=0);
+
+ int64_t
+ GetValueAsSigned(int64_t fail_value=0);
+
+ uint64_t
GetValueAsUnsigned(uint64_t fail_value=0);
ValueType
Modified: lldb/trunk/source/API/SBValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValue.cpp?rev=136861&r1=136860&r2=136861&view=diff
==============================================================================
--- lldb/trunk/source/API/SBValue.cpp (original)
+++ lldb/trunk/source/API/SBValue.cpp Wed Aug 3 20:41:02 2011
@@ -619,6 +619,48 @@
}
int64_t
+SBValue::GetValueAsSigned(SBError& error, int64_t fail_value)
+{
+ if (m_opaque_sp)
+ {
+ if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
+ {
+ Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
+ Scalar scalar;
+ if (m_opaque_sp->ResolveValue (scalar))
+ return scalar.GetRawBits64(fail_value);
+ else
+ error.SetErrorString("could not get value");
+ }
+ else
+ error.SetErrorString("could not get target");
+ }
+ error.SetErrorString("invalid SBValue");
+ return fail_value;
+}
+
+uint64_t
+SBValue::GetValueAsUnsigned(SBError& error, uint64_t fail_value)
+{
+ if (m_opaque_sp)
+ {
+ if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
+ {
+ Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
+ Scalar scalar;
+ if (m_opaque_sp->ResolveValue (scalar))
+ return scalar.GetRawBits64(fail_value);
+ else
+ error.SetErrorString("could not get value");
+ }
+ else
+ error.SetErrorString("could not get target");
+ }
+ error.SetErrorString("invalid SBValue");
+ return fail_value;
+}
+
+int64_t
SBValue::GetValueAsSigned(int64_t fail_value)
{
if (m_opaque_sp)
Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=136861&r1=136860&r2=136861&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Wed Aug 3 20:41:02 2011
@@ -331,12 +331,17 @@
bool
ValueObject::ResolveValue (Scalar &scalar)
{
- ExecutionContext exe_ctx;
- ExecutionContextScope *exe_scope = GetExecutionContextScope();
- if (exe_scope)
- exe_scope->CalculateExecutionContext(exe_ctx);
- scalar = m_value.ResolveValue(&exe_ctx, GetClangAST ());
- return scalar.IsValid();
+ if (UpdateValueIfNeeded(false)) // make sure that you are up to date before returning anything
+ {
+ ExecutionContext exe_ctx;
+ ExecutionContextScope *exe_scope = GetExecutionContextScope();
+ if (exe_scope)
+ exe_scope->CalculateExecutionContext(exe_ctx);
+ scalar = m_value.ResolveValue(&exe_ctx, GetClangAST ());
+ return scalar.IsValid();
+ }
+ else
+ return false;
}
bool
Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/CFString.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/CFString.py?rev=136861&r1=136860&r2=136861&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/CFString.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/CFString.py Wed Aug 3 20:41:02 2011
@@ -45,7 +45,7 @@
# for 32bit targets, use safe ObjC code
return self.handle_unicode_string_safe()
offset = 12
- pointer = int(self.valobj.GetValue(), 0) + offset
+ pointer = self.valobj.GetValueAsUnsigned(0) + offset
pystr = self.read_unicode(pointer)
return self.valobj.CreateValueFromExpression("content",
"(char*)\"" + pystr.encode('utf-8') + "\"")
@@ -60,7 +60,7 @@
def handle_unicode_string(self):
# step 1: find offset
if self.inline:
- pointer = int(self.valobj.GetValue(), 0) + self.size_of_cfruntime_base();
+ pointer = self.valobj.GetValueAsUnsigned(0) + self.size_of_cfruntime_base();
if self.explicit == False:
# untested, use the safe code path
return self.handle_unicode_string_safe();
@@ -76,11 +76,11 @@
# for an inline string)
pointer = pointer + 8;
else:
- pointer = int(self.valobj.GetValue(), 0) + self.size_of_cfruntime_base();
+ pointer = self.valobj.GetValueAsUnsigned(0) + self.size_of_cfruntime_base();
# read 8 bytes here and make an address out of them
vopointer = self.valobj.CreateChildAtOffset("dummy",
pointer,self.valobj.GetType().GetBasicType(lldb.eBasicTypeChar).GetPointerType());
- pointer = int(vopointer.GetValue(), 0)
+ pointer = vopointer.GetValueAsUnsigned(0)
# step 2: read Unicode data at pointer
pystr = self.read_unicode(pointer)
# step 3: return it
Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/StdListSynthProvider.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/StdListSynthProvider.py?rev=136861&r1=136860&r2=136861&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/StdListSynthProvider.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/StdListSynthProvider.py Wed Aug 3 20:41:02 2011
@@ -6,8 +6,8 @@
self.update()
def num_children(self):
- next_val = int(self.next.GetValue(),0)
- prev_val = int(self.prev.GetValue(),0)
+ next_val = self.next.GetValueAsUnsigned(0)
+ prev_val = self.prev.GetValueAsUnsigned(0)
# After a std::list has been initialized, both next and prev will be non-NULL
if next_val == 0 or prev_val == 0:
return 0
@@ -17,7 +17,7 @@
return 1
size = 2
current = self.next
- while int(current.GetChildMemberWithName('_M_next').GetValue(),0) != self.node_address:
+ while current.GetChildMemberWithName('_M_next').GetValueAsUnsigned(0) != self.node_address:
size = size + 1
current = current.GetChildMemberWithName('_M_next')
return (size - 1)
@@ -58,7 +58,7 @@
impl = self.valobj.GetChildMemberWithName('_M_impl')
node = impl.GetChildMemberWithName('_M_node')
self.extract_type_name(impl.GetType().GetName())
- self.node_address = int(self.valobj.AddressOf().GetValue(), 0)
+ self.node_address = self.valobj.AddressOf().GetValueAsUnsigned(0)
self.next = node.GetChildMemberWithName('_M_next')
self.prev = node.GetChildMemberWithName('_M_prev')
self.data_type = node.GetTarget().FindFirstType(self.type_name)
Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/StdMapSynthProvider.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/StdMapSynthProvider.py?rev=136861&r1=136860&r2=136861&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/StdMapSynthProvider.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/StdMapSynthProvider.py Wed Aug 3 20:41:02 2011
@@ -58,7 +58,7 @@
root_ptr_val = self.node_ptr_value(self.Mroot)
if root_ptr_val == 0:
return 0;
- return int(self.Mimpl.GetChildMemberWithName('_M_node_count').GetValue(), 0);
+ return self.Mimpl.GetChildMemberWithName('_M_node_count').GetValueAsUnsigned(0)
def get_child_index(self,name):
if name == "len":
return self.num_children();
@@ -77,7 +77,7 @@
return current.CreateChildAtOffset('['+str(index)+']',self.skip_size,self.data_type)
# utility functions
def node_ptr_value(self,node):
- return int(node.GetValue(),0);
+ return node.GetValueAsUnsigned(0)
def right(self,node):
return node.GetChildMemberWithName("_M_right");
def left(self,node):
Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/StdVectorSynthProvider.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/StdVectorSynthProvider.py?rev=136861&r1=136860&r2=136861&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/StdVectorSynthProvider.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/StdVectorSynthProvider.py Wed Aug 3 20:41:02 2011
@@ -5,9 +5,9 @@
self.update()
def num_children(self):
- start_val = int(self.start.GetValue(),0)
- finish_val = int(self.finish.GetValue(),0)
- end_val = int(self.end.GetValue(),0)
+ start_val = self.start.GetValueAsUnsigned(0)
+ finish_val = self.finish.GetValueAsUnsigned(0)
+ end_val = self.end.GetValueAsUnsigned(0)
# Before a vector has been constructed, it will contain bad values
# so we really need to be careful about the length we return since
# unitialized data can cause us to return a huge number. We need
From granata.enrico at gmail.com Wed Aug 3 21:34:29 2011
From: granata.enrico at gmail.com (Enrico Granata)
Date: Thu, 04 Aug 2011 02:34:29 -0000
Subject: [Lldb-commits] [lldb] r136862 - in /lldb/trunk: include/lldb/
include/lldb/Core/ source/Core/
test/functionalities/data-formatter/data-formatter-python-synth/
Message-ID: <20110804023429.D5D712A6C12C@llvm.org>
Author: enrico
Date: Wed Aug 3 21:34:29 2011
New Revision: 136862
URL: http://llvm.org/viewvc/llvm-project?rev=136862&view=rev
Log:
New formatting symbol %# can be used in summary strings to get the "count of children" of a variable
- accordingly, the test cases for the synthetic providers for the std:: containers have been edited to use
${svar%#} instead of ${svar.len} to print out the count of elements ; the .len synthetic child has been
removed from the synthetic providers
The synthetic children providers for the std:: containers now return None when asked for children indexes >= num_children()
Basic code to support filter names based on regular expressions (WIP)
Modified:
lldb/trunk/include/lldb/Core/FormatManager.h
lldb/trunk/include/lldb/Core/ValueObject.h
lldb/trunk/include/lldb/lldb-enumerations.h
lldb/trunk/source/Core/Debugger.cpp
lldb/trunk/source/Core/FormatClasses.cpp
lldb/trunk/source/Core/FormatManager.cpp
lldb/trunk/source/Core/ValueObject.cpp
lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/StdListSynthProvider.py
lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/StdMapSynthProvider.py
lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/StdVectorSynthProvider.py
lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py
Modified: lldb/trunk/include/lldb/Core/FormatManager.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/FormatManager.h?rev=136862&r1=136861&r2=136862&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/FormatManager.h (original)
+++ lldb/trunk/include/lldb/Core/FormatManager.h Wed Aug 3 21:34:29 2011
@@ -564,6 +564,15 @@
bool
FormatNavigator::Delete(const char* type);
+template<>
+bool
+FormatNavigator::Get(const char* key, SyntheticFilter::SharedPointer& value);
+
+template<>
+bool
+FormatNavigator::Delete(const char* type);
+
+
class CategoryMap;
class FormatCategory
@@ -572,14 +581,17 @@
typedef FormatNavigator SummaryNavigator;
typedef FormatNavigator RegexSummaryNavigator;
typedef FormatNavigator FilterNavigator;
+ typedef FormatNavigator RegexFilterNavigator;
typedef SummaryNavigator::MapType SummaryMap;
typedef RegexSummaryNavigator::MapType RegexSummaryMap;
typedef FilterNavigator::MapType FilterMap;
+ typedef RegexFilterNavigator::MapType RegexFilterMap;
SummaryNavigator::SharedPointer m_summary_nav;
RegexSummaryNavigator::SharedPointer m_regex_summary_nav;
FilterNavigator::SharedPointer m_filter_nav;
+ RegexFilterNavigator::SharedPointer m_regex_filter_nav;
bool m_enabled;
@@ -611,12 +623,14 @@
typedef SummaryNavigator::SharedPointer SummaryNavigatorSP;
typedef RegexSummaryNavigator::SharedPointer RegexSummaryNavigatorSP;
typedef FilterNavigator::SharedPointer FilterNavigatorSP;
+ typedef RegexFilterNavigator::SharedPointer RegexFilterNavigatorSP;
FormatCategory(IFormatChangeListener* clist,
std::string name) :
m_summary_nav(new SummaryNavigator("summary",clist)),
m_regex_summary_nav(new RegexSummaryNavigator("regex-summary",clist)),
m_filter_nav(new FilterNavigator("filter",clist)),
+ m_regex_filter_nav(new RegexFilterNavigator("regex-filter",clist)),
m_enabled(false),
m_change_listener(clist),
m_mutex(Mutex::eMutexTypeRecursive),
@@ -641,6 +655,12 @@
return FilterNavigatorSP(m_filter_nav);
}
+ RegexFilterNavigatorSP
+ RegexFilter()
+ {
+ return RegexFilterNavigatorSP(m_regex_filter_nav);
+ }
+
bool
IsEnabled() const
{
@@ -671,7 +691,12 @@
{
if (!IsEnabled())
return false;
- return (Filter()->Get(vobj, entry, use_dynamic, reason));
+ if (Filter()->Get(vobj, entry, use_dynamic, reason))
+ return true;
+ bool regex = RegexFilter()->Get(vobj, entry, use_dynamic, reason);
+ if (regex && reason)
+ *reason |= lldb::eFormatterChoiceCriterionRegularExpressionFilter;
+ return regex;
}
// just a shortcut for Summary()->Clear; RegexSummary()->Clear()
Modified: lldb/trunk/include/lldb/Core/ValueObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObject.h?rev=136862&r1=136861&r2=136862&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ValueObject.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObject.h Wed Aug 3 21:34:29 2011
@@ -77,7 +77,8 @@
eDisplayValue = 1,
eDisplaySummary,
eDisplayLanguageSpecific,
- eDisplayLocation
+ eDisplayLocation,
+ eDisplayChildrenCount,
};
enum ExpressionPathScanEndReason
@@ -499,8 +500,9 @@
const char *
GetObjectDescription ();
- const char *
- GetPrintableRepresentation(ValueObjectRepresentationStyle val_obj_display = eDisplaySummary,
+ bool
+ GetPrintableRepresentation(Stream& s,
+ ValueObjectRepresentationStyle val_obj_display = eDisplaySummary,
lldb::Format custom_format = lldb::eFormatInvalid);
bool
Modified: lldb/trunk/include/lldb/lldb-enumerations.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-enumerations.h?rev=136862&r1=136861&r2=136862&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-enumerations.h (original)
+++ lldb/trunk/include/lldb/lldb-enumerations.h Wed Aug 3 21:34:29 2011
@@ -506,6 +506,7 @@
eFormatterChoiceCriterionNavigatedTypedefs = 0x00000002,
eFormatterChoiceCriterionNavigatedBaseClasses = 0x00000004,
eFormatterChoiceCriterionRegularExpressionSummary = 0x00000008,
+ eFormatterChoiceCriterionRegularExpressionFilter = 0x00000008,
eFormatterChoiceCriterionDynamicObjCHierarchy = 0x00000010
} FormatterChoiceCriterion;
Modified: lldb/trunk/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=136862&r1=136861&r2=136862&view=diff
==============================================================================
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Wed Aug 3 21:34:29 2011
@@ -742,6 +742,8 @@
// if this is an S, print the summary after all
else if (*format_name == 'S')
*val_obj_display = ValueObject::eDisplaySummary;
+ else if (*format_name == '#')
+ *val_obj_display = ValueObject::eDisplayChildrenCount;
else if (log)
log->Printf("%s is an error, leaving the previous value alone", format_name);
}
Modified: lldb/trunk/source/Core/FormatClasses.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/FormatClasses.cpp?rev=136862&r1=136861&r2=136862&view=diff
==============================================================================
--- lldb/trunk/source/Core/FormatClasses.cpp (original)
+++ lldb/trunk/source/Core/FormatClasses.cpp Wed Aug 3 21:34:29 2011
@@ -84,7 +84,7 @@
s.PutCString(", ");
s.PutCString(child_sp.get()->GetName().AsCString());
s.PutChar('=');
- s.PutCString(child_sp.get()->GetPrintableRepresentation());
+ child_sp.get()->GetPrintableRepresentation(s);
}
}
Modified: lldb/trunk/source/Core/FormatManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/FormatManager.cpp?rev=136862&r1=136861&r2=136862&view=diff
==============================================================================
--- lldb/trunk/source/Core/FormatManager.cpp (original)
+++ lldb/trunk/source/Core/FormatManager.cpp Wed Aug 3 21:34:29 2011
@@ -192,6 +192,44 @@
return false;
}
+template<>
+bool
+FormatNavigator::Get(const char* key, SyntheticFilter::SharedPointer& value)
+{
+ Mutex::Locker(m_format_map.mutex());
+ MapIterator pos, end = m_format_map.map().end();
+ for (pos = m_format_map.map().begin(); pos != end; pos++)
+ {
+ lldb::RegularExpressionSP regex = pos->first;
+ if (regex->Execute(key))
+ {
+ value = pos->second;
+ return true;
+ }
+ }
+ return false;
+}
+
+template<>
+bool
+FormatNavigator::Delete(const char* type)
+{
+ Mutex::Locker(m_format_map.mutex());
+ MapIterator pos, end = m_format_map.map().end();
+ for (pos = m_format_map.map().begin(); pos != end; pos++)
+ {
+ lldb::RegularExpressionSP regex = pos->first;
+ if ( ::strcmp(type,regex->GetText()) == 0)
+ {
+ m_format_map.map().erase(pos);
+ if (m_format_map.listener)
+ m_format_map.listener->Changed();
+ return true;
+ }
+ }
+ return false;
+}
+
lldb::Format
FormatManager::GetSingleItemFormat(lldb::Format vector_format)
{
Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=136862&r1=136861&r2=136862&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Wed Aug 3 21:34:29 2011
@@ -941,11 +941,9 @@
return 0;
}
-// this call should only return pointers to data that needs no special memory management
-// (either because they are hardcoded strings, or because they are backed by some other
-// object); returning any new()-ed or malloc()-ed data here, will lead to leaks!
-const char *
-ValueObject::GetPrintableRepresentation(ValueObjectRepresentationStyle val_obj_display,
+bool
+ValueObject::GetPrintableRepresentation(Stream& s,
+ ValueObjectRepresentationStyle val_obj_display,
lldb::Format custom_format)
{
@@ -955,6 +953,7 @@
SetFormat(custom_format);
const char * return_value;
+ std::auto_ptr alloc_mem;
switch(val_obj_display)
{
@@ -970,6 +969,17 @@
case eDisplayLocation:
return_value = GetLocationAsCString();
break;
+ case eDisplayChildrenCount:
+ // keep this out of the local scope so it will only get deleted when
+ // we exit the function (..and we have a copy of the data into the Stream)
+ alloc_mem = std::auto_ptr((char*)(return_value = new char[512]));
+ {
+ int count = GetNumChildren();
+ snprintf(alloc_mem.get(), 512, "%d", count);
+ break;
+ }
+ default:
+ break;
}
// this code snippet might lead to endless recursion, thus we use a RefCounter here to
@@ -983,16 +993,26 @@
{
if (ClangASTContext::IsAggregateType (GetClangType()) == true)
{
- // this thing has no value
- return_value = "";
+ // this thing has no value, and it seems to have no summary
+ // some combination of unitialized data and other factors can also
+ // raise this condition, so let's print a nice generic error message
+ return_value = "";
}
else
return_value = GetValueAsCString();
}
}
- return (return_value ? return_value : "");
-
+ if (return_value)
+ s.PutCString(return_value);
+ else
+ s.PutCString("");
+
+ // we should only return false here if we could not do *anything*
+ // even if we have an error message as output, that's a success
+ // from our callers' perspective, so return true
+ return true;
+
}
bool
@@ -1116,10 +1136,7 @@
(custom_format == lldb::eFormatDefault)) // use the [] operator
return false;
}
- const char *targetvalue = GetPrintableRepresentation(val_obj_display, custom_format);
- if (targetvalue)
- s.PutCString(targetvalue);
- bool var_success = (targetvalue != NULL);
+ bool var_success = GetPrintableRepresentation(s, val_obj_display, custom_format);
if (custom_format != eFormatInvalid)
SetFormat(eFormatDefault);
return var_success;
Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/StdListSynthProvider.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/StdListSynthProvider.py?rev=136862&r1=136861&r2=136862&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/StdListSynthProvider.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/StdListSynthProvider.py Wed Aug 3 21:34:29 2011
@@ -23,21 +23,17 @@
return (size - 1)
def get_child_index(self,name):
- if name == "len":
- return self.num_children()
- else:
- return int(name.lstrip('[').rstrip(']'))
+ return int(name.lstrip('[').rstrip(']'))
def get_child_at_index(self,index):
- if index == self.num_children():
- return self.valobj.CreateValueFromExpression("len",str(self.num_children()))
- else:
- offset = index
- current = self.next
- while offset > 0:
- current = current.GetChildMemberWithName('_M_next')
- offset = offset - 1
- return current.CreateChildAtOffset('['+str(index)+']',2*current.GetType().GetByteSize(),self.data_type)
+ if index >= self.num_children():
+ return None;
+ offset = index
+ current = self.next
+ while offset > 0:
+ current = current.GetChildMemberWithName('_M_next')
+ offset = offset - 1
+ return current.CreateChildAtOffset('['+str(index)+']',2*current.GetType().GetByteSize(),self.data_type)
def extract_type_name(self,name):
self.type_name = name[16:]
Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/StdMapSynthProvider.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/StdMapSynthProvider.py?rev=136862&r1=136861&r2=136862&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/StdMapSynthProvider.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/StdMapSynthProvider.py Wed Aug 3 21:34:29 2011
@@ -1,8 +1,11 @@
import re
+
class StdMapSynthProvider:
+
def __init__(self, valobj, dict):
self.valobj = valobj;
self.update()
+
def update(self):
self.Mt = self.valobj.GetChildMemberWithName('_M_t')
self.Mimpl = self.Mt.GetChildMemberWithName('_M_impl')
@@ -19,6 +22,7 @@
self.data_type = self.Mt.GetTarget().FindFirstType(self.gcc_type_name)
self.data_size = self.data_type.GetByteSize()
self.skip_size = self.Mheader.GetType().GetByteSize()
+
def expand_clang_type_name(self):
type_name = self.Mimpl.GetType().GetName()
index = type_name.find("std::pair<")
@@ -35,6 +39,7 @@
template_count = template_count - 1
index = index + 1;
self.clang_type_name = type_name
+
def expand_gcc_type_name(self):
type_name = self.Mt.GetType().GetName()
index = type_name.find("std::pair<")
@@ -54,36 +59,40 @@
index = index - 1
index = index + 1;
self.gcc_type_name = type_name
+
def num_children(self):
root_ptr_val = self.node_ptr_value(self.Mroot)
if root_ptr_val == 0:
return 0;
return self.Mimpl.GetChildMemberWithName('_M_node_count').GetValueAsUnsigned(0)
+
def get_child_index(self,name):
- if name == "len":
- return self.num_children();
- else:
- return int(name.lstrip('[').rstrip(']'))
+ return int(name.lstrip('[').rstrip(']'))
+
def get_child_at_index(self,index):
- if index == self.num_children():
- return self.valobj.CreateValueFromExpression("len",str(self.num_children()))
- else:
- offset = index
- current = self.left(self.Mheader);
- while offset > 0:
- current = self.increment_node(current)
- offset = offset - 1;
- # skip all the base stuff and get at the data
- return current.CreateChildAtOffset('['+str(index)+']',self.skip_size,self.data_type)
+ if index >= self.num_children():
+ return None;
+ offset = index
+ current = self.left(self.Mheader);
+ while offset > 0:
+ current = self.increment_node(current)
+ offset = offset - 1;
+ # skip all the base stuff and get at the data
+ return current.CreateChildAtOffset('['+str(index)+']',self.skip_size,self.data_type)
+
# utility functions
def node_ptr_value(self,node):
return node.GetValueAsUnsigned(0)
+
def right(self,node):
return node.GetChildMemberWithName("_M_right");
+
def left(self,node):
return node.GetChildMemberWithName("_M_left");
+
def parent(self,node):
return node.GetChildMemberWithName("_M_parent");
+
# from libstdc++ implementation of iterator for rbtree
def increment_node(self,node):
if self.node_ptr_value(self.right(node)) != 0:
Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/StdVectorSynthProvider.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/StdVectorSynthProvider.py?rev=136862&r1=136861&r2=136862&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/StdVectorSynthProvider.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/StdVectorSynthProvider.py Wed Aug 3 21:34:29 2011
@@ -1,55 +1,52 @@
class StdVectorSynthProvider:
- def __init__(self, valobj, dict):
- self.valobj = valobj;
- self.update()
-
- def num_children(self):
- start_val = self.start.GetValueAsUnsigned(0)
- finish_val = self.finish.GetValueAsUnsigned(0)
- end_val = self.end.GetValueAsUnsigned(0)
- # Before a vector has been constructed, it will contain bad values
- # so we really need to be careful about the length we return since
- # unitialized data can cause us to return a huge number. We need
- # to also check for any of the start, finish or end of storage values
- # being zero (NULL). If any are, then this vector has not been
- # initialized yet and we should return zero
+ def __init__(self, valobj, dict):
+ self.valobj = valobj;
+ self.update()
+
+ def num_children(self):
+ start_val = self.start.GetValueAsUnsigned(0)
+ finish_val = self.finish.GetValueAsUnsigned(0)
+ end_val = self.end.GetValueAsUnsigned(0)
+ # Before a vector has been constructed, it will contain bad values
+ # so we really need to be careful about the length we return since
+ # unitialized data can cause us to return a huge number. We need
+ # to also check for any of the start, finish or end of storage values
+ # being zero (NULL). If any are, then this vector has not been
+ # initialized yet and we should return zero
- # Make sure nothing is NULL
- if start_val == 0 or finish_val == 0 or end_val == 0:
- return 0
- # Make sure start is less than finish
- if start_val >= finish_val:
- return 0
- # Make sure finish is less than or equal to end of storage
- if finish_val > end_val:
- return 0
-
- # We might still get things wrong, so cap things at 256 items for now
- # TODO: read a target "settings set" variable for this to allow it to
- # be customized
- num_children = (finish_val-start_val)/self.data_size
- if num_children > 256:
- return 256
- return num_children
-
- def get_child_index(self,name):
- if name == "len":
- return self.num_children();
- else:
- return int(name.lstrip('[').rstrip(']'))
-
- def get_child_at_index(self,index):
- if index == self.num_children():
- return self.valobj.CreateValueFromExpression("len",str(self.num_children()))
- else:
- offset = index * self.data_size
- return self.start.CreateChildAtOffset('['+str(index)+']',offset,self.data_type)
-
- def update(self):
- impl = self.valobj.GetChildMemberWithName('_M_impl')
- self.start = impl.GetChildMemberWithName('_M_start')
- self.finish = impl.GetChildMemberWithName('_M_finish')
- self.end = impl.GetChildMemberWithName('_M_end_of_storage')
- self.data_type = self.start.GetType().GetPointeeType()
- self.data_size = self.data_type.GetByteSize()
+ # Make sure nothing is NULL
+ if start_val == 0 or finish_val == 0 or end_val == 0:
+ return 0
+ # Make sure start is less than finish
+ if start_val >= finish_val:
+ return 0
+ # Make sure finish is less than or equal to end of storage
+ if finish_val > end_val:
+ return 0
+
+ # We might still get things wrong, so cap things at 256 items for now
+ # TODO: read a target "settings set" variable for this to allow it to
+ # be customized
+ num_children = (finish_val-start_val)/self.data_size
+ if num_children > 256:
+ return 256
+ return num_children
+
+ def get_child_index(self,name):
+ return int(name.lstrip('[').rstrip(']'))
+
+ def get_child_at_index(self,index):
+ if index >= self.num_children():
+ return None;
+ offset = index * self.data_size
+ return self.start.CreateChildAtOffset('['+str(index)+']',offset,self.data_type)
+
+ def update(self):
+ impl = self.valobj.GetChildMemberWithName('_M_impl')
+ self.start = impl.GetChildMemberWithName('_M_start')
+ self.finish = impl.GetChildMemberWithName('_M_finish')
+ self.end = impl.GetChildMemberWithName('_M_end_of_storage')
+ self.data_type = self.start.GetType().GetPointeeType()
+ self.data_size = self.data_type.GetByteSize()
+
Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py?rev=136862&r1=136861&r2=136862&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py Wed Aug 3 21:34:29 2011
@@ -191,7 +191,7 @@
'smart'])
# test summaries based on synthetic children
- self.runCmd("type summary add std::string_vect string_vect -f \"vector has ${svar.len} items\" -e")
+ self.runCmd("type summary add std::string_vect string_vect -f \"vector has ${svar%#} items\" -e")
self.expect("frame variable strings",
substrs = ['vector has 3 items',
'goofy',
@@ -215,24 +215,24 @@
self.runCmd("frame variable numbers_list -T")
self.runCmd("type synth add std::int_list std::string_list int_list string_list -l StdListSynthProvider")
- self.runCmd("type summary add std::int_list std::string_list int_list string_list -f \"list has ${svar.len} items\" -e")
+ self.runCmd("type summary add std::int_list std::string_list int_list string_list -f \"list has ${svar%#} items\" -e")
self.runCmd("type format add -f hex int")
self.expect("frame variable numbers_list",
- substrs = ['list has 0x00000000 items',
+ substrs = ['list has 0 items',
'{}'])
self.runCmd("n")
self.expect("frame variable numbers_list",
- substrs = ['list has 0x00000001 items',
+ substrs = ['list has 1 items',
'[0] = ',
'0x12345678'])
self.runCmd("n");self.runCmd("n");self.runCmd("n");
self.expect("frame variable numbers_list",
- substrs = ['list has 0x00000004 items',
+ substrs = ['list has 4 items',
'[0] = ',
'0x12345678',
'[1] =',
@@ -245,7 +245,7 @@
self.runCmd("n");self.runCmd("n");
self.expect("frame variable numbers_list",
- substrs = ['list has 0x00000006 items',
+ substrs = ['list has 6 items',
'[0] = ',
'0x12345678',
'0x11223344',
@@ -259,14 +259,14 @@
self.runCmd("n")
self.expect("frame variable numbers_list",
- substrs = ['list has 0x00000000 items',
+ substrs = ['list has 0 items',
'{}'])
self.runCmd("n");self.runCmd("n");self.runCmd("n");self.runCmd("n");
self.expect("frame variable numbers_list",
- substrs = ['list has 0x00000004 items',
+ substrs = ['list has 4 items',
'[0] = ', '1',
'[1] = ', '2',
'[2] = ', '3',
@@ -305,7 +305,7 @@
self.runCmd("frame variable ii -T")
self.runCmd("script from StdMapSynthProvider import *")
- self.runCmd("type summary add std::intint_map intint_map -f \"map has ${svar.len} items\" -e")
+ self.runCmd("type summary add std::intint_map intint_map -f \"map has ${svar%#} items\" -e")
self.runCmd("type synth add std::intint_map intint_map -l StdMapSynthProvider")
@@ -356,7 +356,7 @@
self.runCmd("n")
self.runCmd("frame variable si -T")
- self.runCmd("type summary add std::strint_map strint_map -f \"map has ${svar.len} items\" -e")
+ self.runCmd("type summary add std::strint_map strint_map -f \"map has ${svar%#} items\" -e")
self.runCmd("type synth add std::strint_map strint_map -l StdMapSynthProvider")
self.expect('frame variable si',
@@ -400,7 +400,7 @@
self.runCmd("n")
self.runCmd("frame variable is -T")
- self.runCmd("type summary add std::intstr_map intstr_map -f \"map has ${svar.len} items\" -e")
+ self.runCmd("type summary add std::intstr_map intstr_map -f \"map has ${svar%#} items\" -e")
self.runCmd("type synth add std::intstr_map intstr_map -l StdMapSynthProvider")
self.expect('frame variable is',
@@ -433,7 +433,7 @@
self.runCmd("n")
self.runCmd("frame variable ss -T")
- self.runCmd("type summary add std::strstr_map strstr_map -f \"map has ${svar.len} items\" -e")
+ self.runCmd("type summary add std::strstr_map strstr_map -f \"map has ${svar%#} items\" -e")
self.runCmd("type synth add std::strstr_map strstr_map -l StdMapSynthProvider")
self.expect('frame variable ss',
From granata.enrico at gmail.com Wed Aug 3 21:35:14 2011
From: granata.enrico at gmail.com (Enrico Granata)
Date: Thu, 04 Aug 2011 02:35:14 -0000
Subject: [Lldb-commits] [lldb] r136863 - in /lldb/trunk/examples/synthetic:
StdListSynthProvider.py StdMapSynthProvider.py StdVectorSynthProvider.py
Message-ID: <20110804023514.391072A6C12C@llvm.org>
Author: enrico
Date: Wed Aug 3 21:35:14 2011
New Revision: 136863
URL: http://llvm.org/viewvc/llvm-project?rev=136863&view=rev
Log:
copying std:: SynthProviders in examples/synthetic
Modified:
lldb/trunk/examples/synthetic/StdListSynthProvider.py
lldb/trunk/examples/synthetic/StdMapSynthProvider.py
lldb/trunk/examples/synthetic/StdVectorSynthProvider.py
Modified: lldb/trunk/examples/synthetic/StdListSynthProvider.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/synthetic/StdListSynthProvider.py?rev=136863&r1=136862&r2=136863&view=diff
==============================================================================
--- lldb/trunk/examples/synthetic/StdListSynthProvider.py (original)
+++ lldb/trunk/examples/synthetic/StdListSynthProvider.py Wed Aug 3 21:35:14 2011
@@ -23,21 +23,17 @@
return (size - 1)
def get_child_index(self,name):
- if name == "len":
- return self.num_children()
- else:
- return int(name.lstrip('[').rstrip(']'))
+ return int(name.lstrip('[').rstrip(']'))
def get_child_at_index(self,index):
- if index == self.num_children():
- return self.valobj.CreateValueFromExpression("len",str(self.num_children()))
- else:
- offset = index
- current = self.next
- while offset > 0:
- current = current.GetChildMemberWithName('_M_next')
- offset = offset - 1
- return current.CreateChildAtOffset('['+str(index)+']',2*current.GetType().GetByteSize(),self.data_type)
+ if index >= self.num_children():
+ return None;
+ offset = index
+ current = self.next
+ while offset > 0:
+ current = current.GetChildMemberWithName('_M_next')
+ offset = offset - 1
+ return current.CreateChildAtOffset('['+str(index)+']',2*current.GetType().GetByteSize(),self.data_type)
def extract_type_name(self,name):
self.type_name = name[16:]
Modified: lldb/trunk/examples/synthetic/StdMapSynthProvider.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/synthetic/StdMapSynthProvider.py?rev=136863&r1=136862&r2=136863&view=diff
==============================================================================
--- lldb/trunk/examples/synthetic/StdMapSynthProvider.py (original)
+++ lldb/trunk/examples/synthetic/StdMapSynthProvider.py Wed Aug 3 21:35:14 2011
@@ -1,8 +1,11 @@
import re
+
class StdMapSynthProvider:
+
def __init__(self, valobj, dict):
self.valobj = valobj;
self.update()
+
def update(self):
self.Mt = self.valobj.GetChildMemberWithName('_M_t')
self.Mimpl = self.Mt.GetChildMemberWithName('_M_impl')
@@ -19,6 +22,7 @@
self.data_type = self.Mt.GetTarget().FindFirstType(self.gcc_type_name)
self.data_size = self.data_type.GetByteSize()
self.skip_size = self.Mheader.GetType().GetByteSize()
+
def expand_clang_type_name(self):
type_name = self.Mimpl.GetType().GetName()
index = type_name.find("std::pair<")
@@ -35,6 +39,7 @@
template_count = template_count - 1
index = index + 1;
self.clang_type_name = type_name
+
def expand_gcc_type_name(self):
type_name = self.Mt.GetType().GetName()
index = type_name.find("std::pair<")
@@ -54,36 +59,40 @@
index = index - 1
index = index + 1;
self.gcc_type_name = type_name
+
def num_children(self):
root_ptr_val = self.node_ptr_value(self.Mroot)
if root_ptr_val == 0:
return 0;
return self.Mimpl.GetChildMemberWithName('_M_node_count').GetValueAsUnsigned(0)
+
def get_child_index(self,name):
- if name == "len":
- return self.num_children();
- else:
- return int(name.lstrip('[').rstrip(']'))
+ return int(name.lstrip('[').rstrip(']'))
+
def get_child_at_index(self,index):
- if index == self.num_children():
- return self.valobj.CreateValueFromExpression("len",str(self.num_children()))
- else:
- offset = index
- current = self.left(self.Mheader);
- while offset > 0:
- current = self.increment_node(current)
- offset = offset - 1;
- # skip all the base stuff and get at the data
- return current.CreateChildAtOffset('['+str(index)+']',self.skip_size,self.data_type)
+ if index >= self.num_children():
+ return None;
+ offset = index
+ current = self.left(self.Mheader);
+ while offset > 0:
+ current = self.increment_node(current)
+ offset = offset - 1;
+ # skip all the base stuff and get at the data
+ return current.CreateChildAtOffset('['+str(index)+']',self.skip_size,self.data_type)
+
# utility functions
def node_ptr_value(self,node):
return node.GetValueAsUnsigned(0)
+
def right(self,node):
return node.GetChildMemberWithName("_M_right");
+
def left(self,node):
return node.GetChildMemberWithName("_M_left");
+
def parent(self,node):
return node.GetChildMemberWithName("_M_parent");
+
# from libstdc++ implementation of iterator for rbtree
def increment_node(self,node):
if self.node_ptr_value(self.right(node)) != 0:
Modified: lldb/trunk/examples/synthetic/StdVectorSynthProvider.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/synthetic/StdVectorSynthProvider.py?rev=136863&r1=136862&r2=136863&view=diff
==============================================================================
--- lldb/trunk/examples/synthetic/StdVectorSynthProvider.py (original)
+++ lldb/trunk/examples/synthetic/StdVectorSynthProvider.py Wed Aug 3 21:35:14 2011
@@ -1,55 +1,52 @@
class StdVectorSynthProvider:
- def __init__(self, valobj, dict):
- self.valobj = valobj;
- self.update()
-
- def num_children(self):
- start_val = self.start.GetValueAsUnsigned(0)
- finish_val = self.finish.GetValueAsUnsigned(0)
- end_val = self.end.GetValueAsUnsigned(0)
- # Before a vector has been constructed, it will contain bad values
- # so we really need to be careful about the length we return since
- # unitialized data can cause us to return a huge number. We need
- # to also check for any of the start, finish or end of storage values
- # being zero (NULL). If any are, then this vector has not been
- # initialized yet and we should return zero
+ def __init__(self, valobj, dict):
+ self.valobj = valobj;
+ self.update()
+
+ def num_children(self):
+ start_val = self.start.GetValueAsUnsigned(0)
+ finish_val = self.finish.GetValueAsUnsigned(0)
+ end_val = self.end.GetValueAsUnsigned(0)
+ # Before a vector has been constructed, it will contain bad values
+ # so we really need to be careful about the length we return since
+ # unitialized data can cause us to return a huge number. We need
+ # to also check for any of the start, finish or end of storage values
+ # being zero (NULL). If any are, then this vector has not been
+ # initialized yet and we should return zero
- # Make sure nothing is NULL
- if start_val == 0 or finish_val == 0 or end_val == 0:
- return 0
- # Make sure start is less than finish
- if start_val >= finish_val:
- return 0
- # Make sure finish is less than or equal to end of storage
- if finish_val > end_val:
- return 0
-
- # We might still get things wrong, so cap things at 256 items for now
- # TODO: read a target "settings set" variable for this to allow it to
- # be customized
- num_children = (finish_val-start_val)/self.data_size
- if num_children > 256:
- return 256
- return num_children
-
- def get_child_index(self,name):
- if name == "len":
- return self.num_children();
- else:
- return int(name.lstrip('[').rstrip(']'))
-
- def get_child_at_index(self,index):
- if index == self.num_children():
- return self.valobj.CreateValueFromExpression("len",str(self.num_children()))
- else:
- offset = index * self.data_size
- return self.start.CreateChildAtOffset('['+str(index)+']',offset,self.data_type)
-
- def update(self):
- impl = self.valobj.GetChildMemberWithName('_M_impl')
- self.start = impl.GetChildMemberWithName('_M_start')
- self.finish = impl.GetChildMemberWithName('_M_finish')
- self.end = impl.GetChildMemberWithName('_M_end_of_storage')
- self.data_type = self.start.GetType().GetPointeeType()
- self.data_size = self.data_type.GetByteSize()
+ # Make sure nothing is NULL
+ if start_val == 0 or finish_val == 0 or end_val == 0:
+ return 0
+ # Make sure start is less than finish
+ if start_val >= finish_val:
+ return 0
+ # Make sure finish is less than or equal to end of storage
+ if finish_val > end_val:
+ return 0
+
+ # We might still get things wrong, so cap things at 256 items for now
+ # TODO: read a target "settings set" variable for this to allow it to
+ # be customized
+ num_children = (finish_val-start_val)/self.data_size
+ if num_children > 256:
+ return 256
+ return num_children
+
+ def get_child_index(self,name):
+ return int(name.lstrip('[').rstrip(']'))
+
+ def get_child_at_index(self,index):
+ if index >= self.num_children():
+ return None;
+ offset = index * self.data_size
+ return self.start.CreateChildAtOffset('['+str(index)+']',offset,self.data_type)
+
+ def update(self):
+ impl = self.valobj.GetChildMemberWithName('_M_impl')
+ self.start = impl.GetChildMemberWithName('_M_start')
+ self.finish = impl.GetChildMemberWithName('_M_finish')
+ self.end = impl.GetChildMemberWithName('_M_end_of_storage')
+ self.data_type = self.start.GetType().GetPointeeType()
+ self.data_size = self.data_type.GetByteSize()
+
From granata.enrico at gmail.com Thu Aug 4 12:07:02 2011
From: granata.enrico at gmail.com (Enrico Granata)
Date: Thu, 04 Aug 2011 17:07:02 -0000
Subject: [Lldb-commits] [lldb] r136886 - /lldb/trunk/source/API/SBValue.cpp
Message-ID: <20110804170702.84B682A6C12C@llvm.org>
Author: enrico
Date: Thu Aug 4 12:07:02 2011
New Revision: 136886
URL: http://llvm.org/viewvc/llvm-project?rev=136886&view=rev
Log:
more logical behavior for SBValue::CreateValueFromAddress
Modified:
lldb/trunk/source/API/SBValue.cpp
Modified: lldb/trunk/source/API/SBValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValue.cpp?rev=136886&r1=136885&r2=136886&view=diff
==============================================================================
--- lldb/trunk/source/API/SBValue.cpp (original)
+++ lldb/trunk/source/API/SBValue.cpp Thu Aug 4 12:07:02 2011
@@ -448,16 +448,24 @@
lldb::DataBufferSP buffer(new lldb_private::DataBufferHeap(&address,sizeof(lldb::addr_t)));
- ValueObjectSP result_valobj_sp(ValueObjectConstResult::Create(m_opaque_sp->GetUpdatePoint().GetExecutionContextScope(),
- real_type.m_opaque_sp->GetASTContext(),
- real_type.m_opaque_sp->GetOpaqueQualType(),
- ConstString(name),
- buffer,
- lldb::endian::InlHostByteOrder(),
- GetTarget().GetProcess().GetAddressByteSize()));
+ ValueObjectSP ptr_result_valobj_sp(ValueObjectConstResult::Create(m_opaque_sp->GetUpdatePoint().GetExecutionContextScope(),
+ real_type.m_opaque_sp->GetASTContext(),
+ real_type.m_opaque_sp->GetOpaqueQualType(),
+ ConstString(name),
+ buffer,
+ lldb::endian::InlHostByteOrder(),
+ GetTarget().GetProcess().GetAddressByteSize()));
- result_valobj_sp->SetName(ConstString(name));
- result_valobj_sp->GetValue().SetValueType(Value::eValueTypeLoadAddress);
+ ValueObjectSP result_valobj_sp;
+
+ ptr_result_valobj_sp->GetValue().SetValueType(Value::eValueTypeLoadAddress);
+ if (ptr_result_valobj_sp)
+ {
+ Error err;
+ result_valobj_sp = ptr_result_valobj_sp->Dereference(err);
+ if (result_valobj_sp)
+ result_valobj_sp->SetName(ConstString(name));
+ }
result = SBValue(result_valobj_sp);
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
From granata.enrico at gmail.com Thu Aug 4 12:14:03 2011
From: granata.enrico at gmail.com (Enrico Granata)
Date: Thu, 04 Aug 2011 17:14:03 -0000
Subject: [Lldb-commits] [lldb] r136887 - in /lldb/trunk:
examples/synthetic/CFString.py
test/functionalities/data-formatter/data-formatter-objc/CFString.py
Message-ID: <20110804171403.AB9D92A6C12C@llvm.org>
Author: enrico
Date: Thu Aug 4 12:14:03 2011
New Revision: 136887
URL: http://llvm.org/viewvc/llvm-project?rev=136887&view=rev
Log:
changing CFString.py to reflect the new behavior of CreateValueFromAddress
Modified:
lldb/trunk/examples/synthetic/CFString.py
lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/CFString.py
Modified: lldb/trunk/examples/synthetic/CFString.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/synthetic/CFString.py?rev=136887&r1=136886&r2=136887&view=diff
==============================================================================
--- lldb/trunk/examples/synthetic/CFString.py (original)
+++ lldb/trunk/examples/synthetic/CFString.py Thu Aug 4 12:14:03 2011
@@ -94,7 +94,7 @@
if self.explicit == False:
offset = offset + 1;
return self.valobj.CreateValueFromAddress("content",
- offset, self.valobj.GetType().GetBasicType(lldb.eBasicTypeChar));
+ offset, self.valobj.GetType().GetBasicType(lldb.eBasicTypeChar)).AddressOf();
def handle_UTF8_not_inline(self):
offset = self.size_of_cfruntime_base();
Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/CFString.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/CFString.py?rev=136887&r1=136886&r2=136887&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/CFString.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/CFString.py Thu Aug 4 12:14:03 2011
@@ -94,7 +94,7 @@
if self.explicit == False:
offset = offset + 1;
return self.valobj.CreateValueFromAddress("content",
- offset, self.valobj.GetType().GetBasicType(lldb.eBasicTypeChar));
+ offset, self.valobj.GetType().GetBasicType(lldb.eBasicTypeChar)).AddressOf();
def handle_UTF8_not_inline(self):
offset = self.size_of_cfruntime_base();
From johnny.chen at apple.com Thu Aug 4 13:17:16 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Thu, 04 Aug 2011 18:17:16 -0000
Subject: [Lldb-commits] [lldb] r136894 - in /lldb/trunk/test:
api/check_public_api_headers/ api/check_public_api_headers/Makefile
api/check_public_api_headers/TestPublicAPIHeaders.py
api/check_public_api_headers/main.cpp.template dotest.py
make/Makefile.rules
Message-ID: <20110804181716.82F0F2A6C12C@llvm.org>
Author: johnny
Date: Thu Aug 4 13:17:16 2011
New Revision: 136894
URL: http://llvm.org/viewvc/llvm-project?rev=136894&view=rev
Log:
Add a test to check the integrity of the lldb public api directory containing SB*.h headers.
There should be nothing unwanted there and a simpe main.cpp (generated from main.cpp.template)
which includes SB*.h should compile and link with the LLDB framework.
Added:
lldb/trunk/test/api/check_public_api_headers/
lldb/trunk/test/api/check_public_api_headers/Makefile
lldb/trunk/test/api/check_public_api_headers/TestPublicAPIHeaders.py
lldb/trunk/test/api/check_public_api_headers/main.cpp.template
Modified:
lldb/trunk/test/dotest.py
lldb/trunk/test/make/Makefile.rules
Added: lldb/trunk/test/api/check_public_api_headers/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/api/check_public_api_headers/Makefile?rev=136894&view=auto
==============================================================================
--- lldb/trunk/test/api/check_public_api_headers/Makefile (added)
+++ lldb/trunk/test/api/check_public_api_headers/Makefile Thu Aug 4 13:17:16 2011
@@ -0,0 +1,10 @@
+LEVEL = ../../make
+
+CXX_SOURCES := main.cpp
+LD_EXTRAS ?= -framework LLDB
+
+# Example dictionary to pass to the Python build method:
+#
+# FRAMEWORK_INCLUDES=-F/Volumes/data/lldb/svn/trunk/build/Debug
+
+include $(LEVEL)/Makefile.rules
Added: lldb/trunk/test/api/check_public_api_headers/TestPublicAPIHeaders.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/api/check_public_api_headers/TestPublicAPIHeaders.py?rev=136894&view=auto
==============================================================================
--- lldb/trunk/test/api/check_public_api_headers/TestPublicAPIHeaders.py (added)
+++ lldb/trunk/test/api/check_public_api_headers/TestPublicAPIHeaders.py Thu Aug 4 13:17:16 2011
@@ -0,0 +1,94 @@
+"""Test the integrity of the lldb public api directory containing SB*.h headers.
+
+There should be nothing unwanted there and a simpe main.cpp which includes SB*.h
+should compile and link with the LLDB framework."""
+
+import os, re, StringIO
+import unittest2
+from lldbtest import *
+
+class SBDirCheckerCase(TestBase):
+
+ mydir = os.path.join("api", "check_public_api_headers")
+
+ def setUp(self):
+ TestBase.setUp(self)
+ self.build_dir = os.environ["LLDB_BUILD_DIR"]
+ self.template = 'main.cpp.template'
+ self.source = 'main.cpp'
+
+ def test_sb_api_directory(self):
+ """Test the SB API directory and make sure there's no unwanted stuff."""
+
+ if sys.platform.startswith("darwin") and self.getArchitecture() == "i386":
+ self.skipTest("LLDB.framework built 64-bit")
+
+ # Call the program generator to produce main.cpp.
+ self.generate_main_cpp()
+
+ d = {'FRAMEWORK_INCLUDES' : "-F%s" % self.build_dir}
+ self.buildDefault(dictionary=d)
+ self.exe_name = 'a.out'
+ self.sanity_check_executable(self.exe_name)
+
+ def generate_main_cpp(self):
+ """Generate main.cpp from main.cpp.template."""
+ temp = os.path.join(os.getcwd(), self.template)
+ with open(temp, 'r') as f:
+ content = f.read()
+
+ public_api_dir = os.path.join(os.environ["LLDB_SRC"], "include", "lldb", "API")
+
+ # Look under the include/lldb/API directory and add #include statements for
+ # for all the SB API headers.
+ public_headers = os.listdir(public_api_dir)
+ # For different platforms, the include statement can vary.
+ if sys.platform.startswith("darwin"):
+ include_stmt = "'#include <%s>' % os.path.join('LLDB', header)"
+ list = [eval(include_stmt) for header in public_headers if (header.startswith("SB") and
+ header.endswith(".h"))]
+ includes = '\n'.join(list)
+ new_content = content.replace('%include_SB_APIs%', includes)
+ src = os.path.join(os.getcwd(), self.source)
+ with open(src, 'w') as f:
+ f.write(new_content)
+
+ # The main.cpp has been generated, add a teardown hook to remove it.
+ self.addTearDownHook(lambda: os.remove(src))
+
+ def sanity_check_executable(self, exe_name):
+ """Sanity check executable compiled from the auto-generated program."""
+ exe = os.path.join(os.getcwd(), exe_name)
+ self.runCmd("file %s" % exe, CURRENT_EXECUTABLE_SET)
+
+ self.line_to_break = line_number(self.source, '// Set breakpoint here.')
+
+ if sys.platform.startswith("darwin"):
+ env_var = 'DYLD_FRAMEWORK_PATH'
+ env_val = self.build_dir
+
+ env_cmd = "settings set target.process.env-vars %s=%s" %(env_var, env_val)
+ if self.TraceOn():
+ print "Set environment to: ", env_cmd
+ self.runCmd(env_cmd)
+ self.addTearDownHook(lambda: self.runCmd("settings remove target.process.env-vars %s" % env_var))
+
+ self.expect('breakpoint set -f %s -l %d' % (self.source, self.line_to_break),
+ BREAKPOINT_CREATED,
+ startstr = "Breakpoint created: 1: file ='%s', line = %d" %
+ (self.source, self.line_to_break))
+
+ self.runCmd("run", RUN_SUCCEEDED)
+
+ # The stop reason of the thread should be breakpoint.
+ self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+ substrs = ['stopped',
+ 'stop reason = breakpoint'])
+
+ self.runCmd('frame variable')
+
+if __name__ == '__main__':
+ import atexit
+ lldb.SBDebugger.Initialize()
+ atexit.register(lambda: lldb.SBDebugger.Terminate())
+ unittest2.main()
Added: lldb/trunk/test/api/check_public_api_headers/main.cpp.template
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/api/check_public_api_headers/main.cpp.template?rev=136894&view=auto
==============================================================================
--- lldb/trunk/test/api/check_public_api_headers/main.cpp.template (added)
+++ lldb/trunk/test/api/check_public_api_headers/main.cpp.template Thu Aug 4 13:17:16 2011
@@ -0,0 +1,24 @@
+//===-- main.cpp ------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include
+%include_SB_APIs%
+
+using namespace lldb;
+int
+main(int argc, char const *argv[])
+{
+ SBDebugger::Initialize();
+ SBDebugger dbg = SBDebugger::Create();
+
+ printf("Hello SBDebugger %d\n", dbg.GetID()); // Set breakpoint here.
+
+ SBDebugger::Terminate();
+ return 0;
+}
Modified: lldb/trunk/test/dotest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dotest.py?rev=136894&r1=136893&r2=136894&view=diff
==============================================================================
--- lldb/trunk/test/dotest.py (original)
+++ lldb/trunk/test/dotest.py Thu Aug 4 13:17:16 2011
@@ -589,6 +589,10 @@
elif is_exe(baiExec2):
lldbExec = baiExec2
+ if lldbExec:
+ os.environ["LLDB_BUILD_DIR"] = os.path.split(lldbExec)[0]
+ print os.environ["LLDB_BUILD_DIR"]
+
if not lldbExec:
lldbExec = which('lldb')
Modified: lldb/trunk/test/make/Makefile.rules
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/make/Makefile.rules?rev=136894&r1=136893&r2=136894&view=diff
==============================================================================
--- lldb/trunk/test/make/Makefile.rules (original)
+++ lldb/trunk/test/make/Makefile.rules Thu Aug 4 13:17:16 2011
@@ -37,9 +37,11 @@
# Change any build/tool options needed
#----------------------------------------------------------------------
CFLAGS ?= -gdwarf-2 -O0
+CFLAGS += $(FRAMEWORK_INCLUDES)
CXXFLAGS +=$(CFLAGS)
LD = $(CC)
LDFLAGS ?= $(CFLAGS)
+LDFLAGS += $(LD_EXTRAS)
OBJECTS =
EXE ?= a.out
@@ -156,6 +158,7 @@
# the compiler -MM option. The -M option will list all system headers,
# and the -MM option will list all non-system dependencies.
#----------------------------------------------------------------------
+CPPFLAGS ?= $(CFLAGS)
%.d: %.c
@set -e; rm -f $@; \
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
From johnny.chen at apple.com Thu Aug 4 15:44:56 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Thu, 04 Aug 2011 20:44:56 -0000
Subject: [Lldb-commits] [lldb] r136917 - /lldb/trunk/test/make/Makefile.rules
Message-ID: <20110804204456.7A9092A6C12C@llvm.org>
Author: johnny
Date: Thu Aug 4 15:44:56 2011
New Revision: 136917
URL: http://llvm.org/viewvc/llvm-project?rev=136917&view=rev
Log:
Fix makefile rules to prevent CFLAGS from appearing twice in the command line.
Modified:
lldb/trunk/test/make/Makefile.rules
Modified: lldb/trunk/test/make/Makefile.rules
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/make/Makefile.rules?rev=136917&r1=136916&r2=136917&view=diff
==============================================================================
--- lldb/trunk/test/make/Makefile.rules (original)
+++ lldb/trunk/test/make/Makefile.rules Thu Aug 4 15:44:56 2011
@@ -158,28 +158,27 @@
# the compiler -MM option. The -M option will list all system headers,
# and the -MM option will list all non-system dependencies.
#----------------------------------------------------------------------
-CPPFLAGS ?= $(CFLAGS)
%.d: %.c
@set -e; rm -f $@; \
- $(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
+ $(CC) -M $(CFLAGS) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
%.d: %.cpp
@set -e; rm -f $@; \
- $(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
+ $(CC) -M $(CXXFLAGS) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
%.d: %.m
@set -e; rm -f $@; \
- $(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
+ $(CC) -M $(CFLAGS) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
%.d: %.mm
@set -e; rm -f $@; \
- $(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
+ $(CC) -M $(CXXFLAGS) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
From johnny.chen at apple.com Thu Aug 4 15:48:50 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Thu, 04 Aug 2011 20:48:50 -0000
Subject: [Lldb-commits] [lldb] r136918 -
/lldb/trunk/test/api/check_public_api_headers/TestPublicAPIHeaders.py
Message-ID: <20110804204850.E48662A6C12C@llvm.org>
Author: johnny
Date: Thu Aug 4 15:48:50 2011
New Revision: 136918
URL: http://llvm.org/viewvc/llvm-project?rev=136918&view=rev
Log:
Remove an extra 'for' in the comment.
Modified:
lldb/trunk/test/api/check_public_api_headers/TestPublicAPIHeaders.py
Modified: lldb/trunk/test/api/check_public_api_headers/TestPublicAPIHeaders.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/api/check_public_api_headers/TestPublicAPIHeaders.py?rev=136918&r1=136917&r2=136918&view=diff
==============================================================================
--- lldb/trunk/test/api/check_public_api_headers/TestPublicAPIHeaders.py (original)
+++ lldb/trunk/test/api/check_public_api_headers/TestPublicAPIHeaders.py Thu Aug 4 15:48:50 2011
@@ -39,7 +39,7 @@
public_api_dir = os.path.join(os.environ["LLDB_SRC"], "include", "lldb", "API")
- # Look under the include/lldb/API directory and add #include statements for
+ # Look under the include/lldb/API directory and add #include statements
# for all the SB API headers.
public_headers = os.listdir(public_api_dir)
# For different platforms, the include statement can vary.
From johnny.chen at apple.com Thu Aug 4 16:01:05 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Thu, 04 Aug 2011 21:01:05 -0000
Subject: [Lldb-commits] [lldb] r136919 - /lldb/trunk/www/tutorial.html
Message-ID: <20110804210105.282682A6C12C@llvm.org>
Author: johnny
Date: Thu Aug 4 16:01:04 2011
New Revision: 136919
URL: http://llvm.org/viewvc/llvm-project?rev=136919&view=rev
Log:
Fix some typos.
Modified:
lldb/trunk/www/tutorial.html
Modified: lldb/trunk/www/tutorial.html
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/www/tutorial.html?rev=136919&r1=136918&r2=136919&view=diff
==============================================================================
--- lldb/trunk/www/tutorial.html (original)
+++ lldb/trunk/www/tutorial.html Thu Aug 4 16:01:04 2011
@@ -95,14 +95,14 @@
Setting breakpoints by name is even more specialized in LLDB as you can specify
that you want to set a breakpoint at a function by method name. To set a breakpoint
- on all C++ methods named foo you can entier either of:
+ on all C++ methods named foo you can enter either of:
(lldb) breakpoint set --method foo
(lldb) breakpoint set -M foo
- To set a breakpoint Objective C selectors named alignLeftEdges: you can entier either of:
+ To set a breakpoint Objective C selectors named alignLeftEdges: you can enter either of:
(lldb) breakpoint set --selector alignLeftEdges:
From gclayton at apple.com Thu Aug 4 16:02:57 2011
From: gclayton at apple.com (Greg Clayton)
Date: Thu, 04 Aug 2011 21:02:57 -0000
Subject: [Lldb-commits] [lldb] r136920 - in /lldb/trunk:
include/lldb/Symbol/ClangASTContext.h
source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
source/Symbol/ClangASTContext.cpp
Message-ID: <20110804210257.BB05A2A6C12C@llvm.org>
Author: gclayton
Date: Thu Aug 4 16:02:57 2011
New Revision: 136920
URL: http://llvm.org/viewvc/llvm-project?rev=136920&view=rev
Log:
Make sure we track CXX and objc method decls.
Modified:
lldb/trunk/include/lldb/Symbol/ClangASTContext.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Symbol/ClangASTContext.cpp
Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=136920&r1=136919&r2=136920&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Thu Aug 4 16:02:57 2011
@@ -300,6 +300,13 @@
is_explicit);
}
+ static clang::DeclContext *
+ GetAsDeclContext (clang::CXXMethodDecl *cxx_method_decl);
+
+ static clang::DeclContext *
+ GetAsDeclContext (clang::ObjCMethodDecl *objc_method_decl);
+
+
static bool
CheckOverloadedOperatorKindParameterCount (uint32_t op_kind,
uint32_t num_params);
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=136920&r1=136919&r2=136920&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Thu Aug 4 16:02:57 2011
@@ -3645,6 +3645,7 @@
type_name_cstr,
clang_type,
accessibility);
+ LinkDeclContextToDIE(ClangASTContext::GetAsDeclContext(objc_method_decl), die);
type_handled = objc_method_decl != NULL;
}
}
@@ -3683,6 +3684,8 @@
is_static,
is_inline,
is_explicit);
+ LinkDeclContextToDIE(ClangASTContext::GetAsDeclContext(cxx_method_decl), die);
+
type_handled = cxx_method_decl != NULL;
}
}
Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=136920&r1=136919&r2=136920&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Thu Aug 4 16:02:57 2011
@@ -4912,3 +4912,15 @@
}
}
+clang::DeclContext *
+ClangASTContext::GetAsDeclContext (clang::CXXMethodDecl *cxx_method_decl)
+{
+ return clang::dyn_cast(cxx_method_decl);
+}
+
+clang::DeclContext *
+ClangASTContext::GetAsDeclContext (clang::ObjCMethodDecl *objc_method_decl)
+{
+ return clang::dyn_cast(objc_method_decl);
+}
+
From scallanan at apple.com Thu Aug 4 16:37:47 2011
From: scallanan at apple.com (Sean Callanan)
Date: Thu, 04 Aug 2011 21:37:47 -0000
Subject: [Lldb-commits] [lldb] r136928 - in /lldb/trunk:
include/lldb/Expression/IRForTarget.h
source/Expression/ASTResultSynthesizer.cpp
source/Expression/IRForTarget.cpp
Message-ID: <20110804213747.AA7D92A6C12C@llvm.org>
Author: spyffe
Date: Thu Aug 4 16:37:47 2011
New Revision: 136928
URL: http://llvm.org/viewvc/llvm-project?rev=136928&view=rev
Log:
Fixed a problem that caused LLDB to fail to execute
expressions that used function pointers. The problem
was that IRForTarget previously only scanned the IR
for the expression for call instructions; if a function
was used in another context, it was ignored.
Now LLDB scans the Module for functions that are only
declared (not also defined -- so these are externals);
it then constructs function pointers for these
functions and substitutes them wherever the function
is used.
Also made some changes so that "expr main" works just
as well as "expr &main"; they end up being the same
code, but LLDB was generating the result variable in
different ways.
Modified:
lldb/trunk/include/lldb/Expression/IRForTarget.h
lldb/trunk/source/Expression/ASTResultSynthesizer.cpp
lldb/trunk/source/Expression/IRForTarget.cpp
Modified: lldb/trunk/include/lldb/Expression/IRForTarget.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/IRForTarget.h?rev=136928&r1=136927&r2=136928&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/IRForTarget.h (original)
+++ lldb/trunk/include/lldb/Expression/IRForTarget.h Thu Aug 4 16:37:47 2011
@@ -149,11 +149,73 @@
FixFunctionLinkage (llvm::Function &llvm_function);
//------------------------------------------------------------------
+ /// A module-level pass to replace all function pointers with their
+ /// integer equivalents.
+ //------------------------------------------------------------------
+
+ //------------------------------------------------------------------
+ /// The top-level pass implementation
+ ///
+ /// @param[in] llvm_module
+ /// The module currently being processed.
+ ///
+ /// @param[in] llvm_function
+ /// The function currently being processed.
+ ///
+ /// @return
+ /// True on success; false otherwise.
+ //------------------------------------------------------------------
+ bool
+ HasSideEffects (llvm::Function &llvm_function);
+
+ //------------------------------------------------------------------
/// A function-level pass to check whether the function has side
/// effects.
//------------------------------------------------------------------
//------------------------------------------------------------------
+ /// Get the address of a fuction, and a location to put the complete
+ /// Value of the function if one is available.
+ ///
+ /// @param[in] function
+ /// The function to find the location of.
+ ///
+ /// @param[out] ptr
+ /// The location of the function in the target.
+ ///
+ /// @param[out] name
+ /// The resolved name of the function (matters for intrinsics).
+ ///
+ /// @param[out] value_ptr
+ /// A variable to put the function's completed Value* in, or NULL
+ /// if the Value* shouldn't be stored anywhere.
+ ///
+ /// @return
+ /// The pointer.
+ //------------------------------------------------------------------
+ bool
+ GetFunctionAddress (llvm::Function *function,
+ uint64_t &ptr,
+ lldb_private::ConstString &name,
+ llvm::Constant **&value_ptr);
+
+ //------------------------------------------------------------------
+ /// Build a function pointer given a type and a raw pointer.
+ ///
+ /// @param[in] type
+ /// The type of the function pointer to be built.
+ ///
+ /// @param[in] ptr
+ /// The value of the pointer.
+ ///
+ /// @return
+ /// The pointer.
+ //------------------------------------------------------------------
+ llvm::Constant *
+ BuildFunctionPointer (llvm::Type *type,
+ uint64_t ptr);
+
+ //------------------------------------------------------------------
/// The top-level pass implementation
///
/// @param[in] llvm_function
@@ -164,7 +226,8 @@
/// be determined); false otherwise.
//------------------------------------------------------------------
bool
- HasSideEffects (llvm::Function &llvm_function);
+ ResolveFunctionPointers (llvm::Module &llvm_module,
+ llvm::Function &llvm_function);
//------------------------------------------------------------------
/// A function-level pass to take the generated global value
@@ -382,19 +445,7 @@
MaybeHandleCallArguments (llvm::CallInst *call_inst);
//------------------------------------------------------------------
- /// Handle a single external function call
- ///
- /// @param[in] C
- /// The call instruction.
- ///
- /// @return
- /// True on success; false otherwise
- //------------------------------------------------------------------
- bool
- MaybeHandleCall (llvm::CallInst *C);
-
- //------------------------------------------------------------------
- /// Resolve calls to external functions
+ /// Resolve variable references in calls to external functions
///
/// @param[in] basic_block
/// The basic block currently being processed.
Modified: lldb/trunk/source/Expression/ASTResultSynthesizer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ASTResultSynthesizer.cpp?rev=136928&r1=136927&r2=136928&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ASTResultSynthesizer.cpp (original)
+++ lldb/trunk/source/Expression/ASTResultSynthesizer.cpp Thu Aug 4 16:37:47 2011
@@ -311,7 +311,12 @@
if (is_lvalue)
{
- IdentifierInfo &result_ptr_id = Ctx.Idents.get("$__lldb_expr_result_ptr");
+ IdentifierInfo *result_ptr_id;
+
+ if (expr_type->isFunctionType())
+ result_ptr_id = &Ctx.Idents.get("$__lldb_expr_result"); // functions actually should be treated like function pointers
+ else
+ result_ptr_id = &Ctx.Idents.get("$__lldb_expr_result_ptr");
QualType ptr_qual_type = Ctx.getPointerType(expr_qual_type);
@@ -319,7 +324,7 @@
DC,
SourceLocation(),
SourceLocation(),
- &result_ptr_id,
+ result_ptr_id,
ptr_qual_type,
NULL,
SC_Static,
Modified: lldb/trunk/source/Expression/IRForTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRForTarget.cpp?rev=136928&r1=136927&r2=136928&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRForTarget.cpp (original)
+++ lldb/trunk/source/Expression/IRForTarget.cpp Thu Aug 4 16:37:47 2011
@@ -169,6 +169,146 @@
return false;
}
+bool
+IRForTarget::GetFunctionAddress (llvm::Function *fun,
+ uint64_t &fun_addr,
+ lldb_private::ConstString &name,
+ Constant **&value_ptr)
+{
+ lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
+
+ fun_addr = LLDB_INVALID_ADDRESS;
+ name.Clear();
+ value_ptr = NULL;
+
+ if (fun->isIntrinsic())
+ {
+ Intrinsic::ID intrinsic_id = (Intrinsic::ID)fun->getIntrinsicID();
+
+ switch (intrinsic_id)
+ {
+ default:
+ if (log)
+ log->Printf("Unresolved intrinsic \"%s\"", Intrinsic::getName(intrinsic_id).c_str());
+
+ if (m_error_stream)
+ m_error_stream->Printf("Internal error [IRForTarget]: Call to unhandled compiler intrinsic '%s'\n", Intrinsic::getName(intrinsic_id).c_str());
+
+ return false;
+ case Intrinsic::memcpy:
+ {
+ static lldb_private::ConstString g_memcpy_str ("memcpy");
+ name = g_memcpy_str;
+ }
+ break;
+ }
+
+ if (log && name)
+ log->Printf("Resolved intrinsic name \"%s\"", name.GetCString());
+ }
+ else
+ {
+ name.SetCStringWithLength (fun->getName().data(), fun->getName().size());
+ }
+
+ // Find the address of the function.
+
+ clang::NamedDecl *fun_decl = DeclForGlobal (fun);
+ Value **fun_value_ptr = NULL;
+
+ if (fun_decl)
+ {
+ if (!m_decl_map->GetFunctionInfo (fun_decl, fun_value_ptr, fun_addr))
+ {
+ fun_value_ptr = NULL;
+
+ if (!m_decl_map->GetFunctionAddress (name, fun_addr))
+ {
+ if (log)
+ log->Printf("Function \"%s\" had no address", name.GetCString());
+
+ if (m_error_stream)
+ m_error_stream->Printf("Error [IRForTarget]: Call to a function '%s' that is not present in the target\n", name.GetCString());
+
+ return false;
+ }
+ }
+ }
+ else
+ {
+ if (!m_decl_map->GetFunctionAddress (name, fun_addr))
+ {
+ if (log)
+ log->Printf ("Metadataless function \"%s\" had no address", name.GetCString());
+
+ if (m_error_stream)
+ m_error_stream->Printf("Error [IRForTarget]: Call to a symbol-only function '%s' that is not present in the target\n", name.GetCString());
+
+ return false;
+ }
+ }
+
+ if (log)
+ log->Printf("Found \"%s\" at 0x%llx", name.GetCString(), fun_addr);
+
+ return true;
+}
+
+llvm::Constant *
+IRForTarget::BuildFunctionPointer (llvm::Type *type,
+ uint64_t ptr)
+{
+ IntegerType *intptr_ty = Type::getIntNTy(m_module->getContext(),
+ (m_module->getPointerSize() == Module::Pointer64) ? 64 : 32);
+ PointerType *fun_ptr_ty = PointerType::getUnqual(type);
+ Constant *fun_addr_int = ConstantInt::get(intptr_ty, ptr, false);
+ return ConstantExpr::getIntToPtr(fun_addr_int, fun_ptr_ty);
+}
+
+bool
+IRForTarget::ResolveFunctionPointers(llvm::Module &llvm_module,
+ llvm::Function &llvm_function)
+{
+ lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
+
+ for (llvm::Module::iterator fi = llvm_module.begin();
+ fi != llvm_module.end();
+ ++fi)
+ {
+ Function *fun = fi;
+
+ bool is_decl = fun->isDeclaration();
+
+ if (log)
+ log->Printf("Examining %s function %s", (is_decl ? "declaration" : "non-declaration"), fun->getNameStr().c_str());
+
+ if (!is_decl)
+ continue;
+
+ if (fun->hasNUses(0))
+ continue; // ignore
+
+ uint64_t addr = LLDB_INVALID_ADDRESS;
+ lldb_private::ConstString name;
+ Constant **value_ptr = NULL;
+
+ if (!GetFunctionAddress(fun,
+ addr,
+ name,
+ value_ptr))
+ return false; // GetFunctionAddress reports its own errors
+
+ Constant *value = BuildFunctionPointer(fun->getFunctionType(), addr);
+
+ if (value_ptr)
+ *value_ptr = value;
+
+ fun->replaceAllUsesWith(value);
+ }
+
+ return true;
+}
+
clang::NamedDecl *
IRForTarget::DeclForGlobal (GlobalValue *global_val)
{
@@ -1403,193 +1543,6 @@
}
bool
-IRForTarget::MaybeHandleCall (CallInst *llvm_call_inst)
-{
- lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
-
- Function *fun = llvm_call_inst->getCalledFunction();
-
- bool is_bitcast = false;
-
- // If the call is to something other than a plain llvm::Function, resolve which
- // Function is meant or give up.
-
- if (fun == NULL)
- {
- Value *val = llvm_call_inst->getCalledValue();
-
- ConstantExpr *const_expr = dyn_cast(val);
- LoadInst *load_inst = dyn_cast(val);
-
- if (const_expr && const_expr->getOpcode() == Instruction::BitCast)
- {
- fun = dyn_cast(const_expr->getOperand(0));
-
- if (!fun)
- {
- if (m_error_stream)
- m_error_stream->Printf("Internal error [IRForTaget]: Called entity is a cast of something not a function\n");
-
- return false;
- }
-
- is_bitcast = true;
- }
- else if (const_expr && const_expr->getOpcode() == Instruction::IntToPtr)
- {
- return true; // already resolved
- }
- else if (load_inst)
- {
- return true; // virtual method call
- }
- else
- {
- if (m_error_stream)
- m_error_stream->Printf("Internal error [IRForTarget]: Called entity is not a function\n");
-
- return false;
- }
- }
-
- // Determine the name of the called function, which is needed to find the address.
- // Intrinsics are special-cased.
-
- lldb_private::ConstString str;
-
- if (fun->isIntrinsic())
- {
- Intrinsic::ID intrinsic_id = (Intrinsic::ID)fun->getIntrinsicID();
-
- switch (intrinsic_id)
- {
- default:
- if (log)
- log->Printf("Unresolved intrinsic \"%s\"", Intrinsic::getName(intrinsic_id).c_str());
-
- if (m_error_stream)
- m_error_stream->Printf("Internal error [IRForTarget]: Call to unhandled compiler intrinsic '%s'\n", Intrinsic::getName(intrinsic_id).c_str());
-
- return false;
- case Intrinsic::memcpy:
- {
- static lldb_private::ConstString g_memcpy_str ("memcpy");
- str = g_memcpy_str;
- }
- break;
- }
-
- if (log && str)
- log->Printf("Resolved intrinsic name \"%s\"", str.GetCString());
- }
- else
- {
- str.SetCStringWithLength (fun->getName().data(), fun->getName().size());
- }
-
- // Find the address of the function, and the type if possible.
-
- clang::NamedDecl *fun_decl = DeclForGlobal (fun);
- lldb::addr_t fun_addr = LLDB_INVALID_ADDRESS;
- Value **fun_value_ptr = NULL;
-
- if (fun_decl)
- {
- if (!m_decl_map->GetFunctionInfo (fun_decl, fun_value_ptr, fun_addr))
- {
- fun_value_ptr = NULL;
-
- if (!m_decl_map->GetFunctionAddress (str, fun_addr))
- {
- if (log)
- log->Printf("Function \"%s\" had no address", str.GetCString());
-
- if (m_error_stream)
- m_error_stream->Printf("Error [IRForTarget]: Call to a function '%s' that is not present in the target\n", str.GetCString());
-
- return false;
- }
- }
- }
- else
- {
- if (!m_decl_map->GetFunctionAddress (str, fun_addr))
- {
- if (log)
- log->Printf ("Metadataless function \"%s\" had no address", str.GetCString());
-
- if (m_error_stream)
- m_error_stream->Printf("Error [IRForTarget]: Call to a symbol-only function '%s' that is not present in the target\n", str.GetCString());
-
- return false;
- }
- }
-
- if (log)
- log->Printf("Found \"%s\" at 0x%llx", str.GetCString(), fun_addr);
-
- // Construct the typed pointer to the function.
-
- Value *fun_addr_ptr = NULL;
-
- if (!fun_value_ptr || !*fun_value_ptr)
- {
- IntegerType *intptr_ty = Type::getIntNTy(m_module->getContext(),
- (m_module->getPointerSize() == Module::Pointer64) ? 64 : 32);
- FunctionType *fun_ty = fun->getFunctionType();
- PointerType *fun_ptr_ty = PointerType::getUnqual(fun_ty);
- Constant *fun_addr_int = ConstantInt::get(intptr_ty, fun_addr, false);
- fun_addr_ptr = ConstantExpr::getIntToPtr(fun_addr_int, fun_ptr_ty);
-
- if (fun_value_ptr)
- *fun_value_ptr = fun_addr_ptr;
- }
-
- if (fun_value_ptr)
- fun_addr_ptr = *fun_value_ptr;
-
- if (is_bitcast)
- {
- Value *val = llvm_call_inst->getCalledValue();
-
- ConstantExpr *const_expr = dyn_cast(val);
-
- Constant *fun_addr_ptr_cst = dyn_cast(fun_addr_ptr);
-
- if (!fun_addr_ptr_cst)
- {
- if (m_error_stream)
- m_error_stream->Printf("Error [IRForTarget]: Non-constant source function '%s' has a constant BitCast\n", str.GetCString());
-
- return false;
- }
-
- Constant *new_bit_cast = ConstantExpr::getBitCast(fun_addr_ptr_cst, const_expr->getType());
-
- llvm_call_inst->setCalledFunction(new_bit_cast);
- }
- else
- {
- llvm_call_inst->setCalledFunction(fun_addr_ptr);
- }
-
- ConstantArray *func_name = (ConstantArray*)ConstantArray::get(m_module->getContext(), str.GetCString());
-
- Value *values[1];
- values[0] = func_name;
- ArrayRef value_ref(values, 1);
-
- MDNode *func_metadata = MDNode::get(m_module->getContext(), value_ref);
-
- llvm_call_inst->setMetadata("lldb.call.realName", func_metadata);
-
- if (log)
- log->Printf("Set metadata for %p [%d, \"%s\"]", llvm_call_inst, func_name->isString(), func_name->getAsString().c_str());
-
- return true;
-}
-
-bool
IRForTarget::ResolveCalls(BasicBlock &basic_block)
{
/////////////////////////////////////////////////////////////////////////
@@ -1606,10 +1559,6 @@
CallInst *call = dyn_cast(&inst);
- // MaybeHandleCall handles error reporting; we are silent here
- if (call && !MaybeHandleCall(call))
- return false;
-
// MaybeHandleCallArguments handles error reporting; we are silent here
if (call && !MaybeHandleCallArguments(call))
return false;
@@ -2385,6 +2334,20 @@
return false;
}
+ ///////////////////////////////
+ // Resolve function pointers
+ //
+
+ if (!ResolveFunctionPointers(llvm_module, *function))
+ {
+ if (log)
+ log->Printf("ResolveFunctionPointers() failed");
+
+ // ResolveFunctionPointers() reports its own errors, so we don't do so here
+
+ return false;
+ }
+
//////////////////////////////////
// Run basic-block level passes
//
From johnny.chen at apple.com Thu Aug 4 17:01:21 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Thu, 04 Aug 2011 22:01:21 -0000
Subject: [Lldb-commits] [lldb] r136931 - in
/lldb/trunk/test/benchmarks/disassembly: ./ TestDisassembly.py
Message-ID: <20110804220122.21F502A6C12C@llvm.org>
Author: johnny
Date: Thu Aug 4 17:01:21 2011
New Revision: 136931
URL: http://llvm.org/viewvc/llvm-project?rev=136931&view=rev
Log:
Add a benchmark comparing lldb vs. gdb with disassembly on a large function (lldb's Driver::MainLoop()).
Sample run on my OSX Lion (MacBook Pro):
1: test_run_gdb_then_lldb (TestDisassembly.DisassembleDriverMainLoop)
Test disassembly on a large function with lldb vs. gdb. ...
gdb benchmark: Avg: 0.201802 (Laps: 5, Total Elapsed Time: 1.009008)
lldb benchmark: Avg: 0.109569 (Laps: 5, Total Elapsed Time: 0.547843)
lldb_avg/gdb_avg: 0.542952
ok
2: test_run_lldb_then_gdb (TestDisassembly.DisassembleDriverMainLoop)
Test disassembly on a large function with lldb vs. gdb. ...
lldb benchmark: Avg: 0.109580 (Laps: 5, Total Elapsed Time: 0.547902)
gdb benchmark: Avg: 0.201587 (Laps: 5, Total Elapsed Time: 1.007936)
lldb_avg/gdb_avg: 0.543588
ok
Added:
lldb/trunk/test/benchmarks/disassembly/
lldb/trunk/test/benchmarks/disassembly/TestDisassembly.py
Added: lldb/trunk/test/benchmarks/disassembly/TestDisassembly.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/benchmarks/disassembly/TestDisassembly.py?rev=136931&view=auto
==============================================================================
--- lldb/trunk/test/benchmarks/disassembly/TestDisassembly.py (added)
+++ lldb/trunk/test/benchmarks/disassembly/TestDisassembly.py Thu Aug 4 17:01:21 2011
@@ -0,0 +1,127 @@
+"""Disassemble lldb's Driver::MainLoop() functions comparing lldb against gdb."""
+
+import os, sys
+import unittest2
+import lldb
+import pexpect
+from lldbbench import *
+
+class DisassembleDriverMainLoop(BenchBase):
+
+ mydir = os.path.join("benchmarks", "example")
+
+ def setUp(self):
+ BenchBase.setUp(self)
+ self.exe = self.lldbExec
+ self.function = 'Driver::MainLoop()'
+ self.lldb_avg = None
+ self.gdb_avg = None
+
+ @benchmarks_test
+ def test_run_lldb_then_gdb(self):
+ """Test disassembly on a large function with lldb vs. gdb."""
+ print
+ self.run_lldb_disassembly(self.exe, self.function, 5)
+ print "lldb benchmark:", self.stopwatch
+ self.run_gdb_disassembly(self.exe, self.function, 5)
+ print "gdb benchmark:", self.stopwatch
+ print "lldb_avg/gdb_avg: %f" % (self.lldb_avg/self.gdb_avg)
+
+ @benchmarks_test
+ def test_run_gdb_then_lldb(self):
+ """Test disassembly on a large function with lldb vs. gdb."""
+ print
+ self.run_gdb_disassembly(self.exe, self.function, 5)
+ print "gdb benchmark:", self.stopwatch
+ self.run_lldb_disassembly(self.exe, self.function, 5)
+ print "lldb benchmark:", self.stopwatch
+ print "lldb_avg/gdb_avg: %f" % (self.lldb_avg/self.gdb_avg)
+
+ def run_lldb_disassembly(self, exe, function, count):
+ # Set self.child_prompt, which is "(lldb) ".
+ self.child_prompt = '(lldb) '
+ prompt = self.child_prompt
+
+ # So that the child gets torn down after the test.
+ self.child = pexpect.spawn('%s %s' % (self.lldbExec, exe))
+ child = self.child
+
+ # Turn on logging for what the child sends back.
+ if self.TraceOn():
+ child.logfile_read = sys.stdout
+
+ child.expect_exact(prompt)
+ child.sendline('breakpoint set -F %s' % function)
+ child.expect_exact(prompt)
+ child.sendline('run')
+ child.expect_exact(prompt)
+
+ # Reset the stopwatch now.
+ self.stopwatch.reset()
+ for i in range(count):
+ with self.stopwatch:
+ # Disassemble the function.
+ child.sendline('disassemble -f')
+ child.expect_exact(prompt)
+ child.sendline('next')
+ child.expect_exact(prompt)
+
+ child.sendline('quit')
+ try:
+ self.child.expect(pexpect.EOF)
+ except:
+ pass
+
+ self.lldb_avg = self.stopwatch.avg()
+ if self.TraceOn():
+ print "lldb disassembly benchmark:", str(self.stopwatch)
+ self.child = None
+
+ def run_gdb_disassembly(self, exe, function, count):
+ # Set self.child_prompt, which is "(gdb) ".
+ self.child_prompt = '(gdb) '
+ prompt = self.child_prompt
+
+ # So that the child gets torn down after the test.
+ self.child = pexpect.spawn('gdb %s' % exe)
+ child = self.child
+
+ # Turn on logging for what the child sends back.
+ if self.TraceOn():
+ child.logfile_read = sys.stdout
+
+ child.expect_exact(prompt)
+ child.sendline('break %s' % function)
+ child.expect_exact(prompt)
+ child.sendline('run')
+ child.expect_exact(prompt)
+
+ # Reset the stopwatch now.
+ self.stopwatch.reset()
+ for i in range(count):
+ with self.stopwatch:
+ # Disassemble the function.
+ child.sendline('disassemble')
+ child.expect_exact(prompt)
+ child.sendline('next')
+ child.expect_exact(prompt)
+
+ child.sendline('quit')
+ child.expect_exact('The program is running. Exit anyway?')
+ child.sendline('y')
+ try:
+ self.child.expect(pexpect.EOF)
+ except:
+ pass
+
+ self.gdb_avg = self.stopwatch.avg()
+ if self.TraceOn():
+ print "gdb disassembly benchmark:", str(self.stopwatch)
+ self.child = None
+
+
+if __name__ == '__main__':
+ import atexit
+ lldb.SBDebugger.Initialize()
+ atexit.register(lambda: lldb.SBDebugger.Terminate())
+ unittest2.main()
From johnny.chen at apple.com Thu Aug 4 17:05:37 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Thu, 04 Aug 2011 22:05:37 -0000
Subject: [Lldb-commits] [lldb] r136932 -
/lldb/trunk/test/benchmarks/example/TestRepeatedExprs.py
Message-ID: <20110804220537.14DE32A6C12C@llvm.org>
Author: johnny
Date: Thu Aug 4 17:05:36 2011
New Revision: 136932
URL: http://llvm.org/viewvc/llvm-project?rev=136932&view=rev
Log:
Print out the stopwatch (which contains laps, total elapsed time, and average)
instead of just the average.
Modified:
lldb/trunk/test/benchmarks/example/TestRepeatedExprs.py
Modified: lldb/trunk/test/benchmarks/example/TestRepeatedExprs.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/benchmarks/example/TestRepeatedExprs.py?rev=136932&r1=136931&r2=136932&view=diff
==============================================================================
--- lldb/trunk/test/benchmarks/example/TestRepeatedExprs.py (original)
+++ lldb/trunk/test/benchmarks/example/TestRepeatedExprs.py Thu Aug 4 17:05:36 2011
@@ -25,9 +25,9 @@
print
self.run_lldb_repeated_exprs(self.exe_name, 100)
+ print "lldb benchmark:", self.stopwatch
self.run_gdb_repeated_exprs(self.exe_name, 100)
- print "lldb_avg: %f" % self.lldb_avg
- print "gdb_avg: %f" % self.gdb_avg
+ print "gdb benchmark:", self.stopwatch
print "lldb_avg/gdb_avg: %f" % (self.lldb_avg/self.gdb_avg)
def run_lldb_repeated_exprs(self, exe_name, count):
From granata.enrico at gmail.com Thu Aug 4 18:37:19 2011
From: granata.enrico at gmail.com (Enrico Granata)
Date: Thu, 04 Aug 2011 23:37:19 -0000
Subject: [Lldb-commits] [lldb] r136945 - in /lldb/trunk:
include/lldb/Core/FormatManager.h include/lldb/lldb-enumerations.h
source/Core/ValueObject.cpp
Message-ID: <20110804233719.345272A6C12C@llvm.org>
Author: enrico
Date: Thu Aug 4 18:37:18 2011
New Revision: 136945
URL: http://llvm.org/viewvc/llvm-project?rev=136945&view=rev
Log:
fixed a potential memory leak ; small improvement in the formatters lookup algorithm
Modified:
lldb/trunk/include/lldb/Core/FormatManager.h
lldb/trunk/include/lldb/lldb-enumerations.h
lldb/trunk/source/Core/ValueObject.cpp
Modified: lldb/trunk/include/lldb/Core/FormatManager.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/FormatManager.h?rev=136945&r1=136944&r2=136945&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/FormatManager.h (original)
+++ lldb/trunk/include/lldb/Core/FormatManager.h Thu Aug 4 18:37:18 2011
@@ -351,16 +351,28 @@
return false;
}
ConstString name(ClangASTType::GetTypeNameForQualType(type).c_str());
+ const char* typeName = name.GetCString();
if (vobj.GetBitfieldBitSize() > 0)
{
// for bitfields, append size to the typename so one can custom format them
StreamString sstring;
- sstring.Printf("%s:%d",name.AsCString(),vobj.GetBitfieldBitSize());
- name = ConstString(sstring.GetData());
+ sstring.Printf("%s:%d",typeName,vobj.GetBitfieldBitSize());
+ ConstString bitfieldname = ConstString(sstring.GetData());
if (log)
- log->Printf("appended bitfield info, final result is %s", name.GetCString());
+ log->Printf("appended bitfield info, final result is %s", bitfieldname.GetCString());
+ if (Get(bitfieldname.AsCString(), entry))
+ {
+ if (log)
+ log->Printf("bitfield direct match found, returning");
+ return true;
+ }
+ else
+ {
+ reason |= lldb::eFormatterChoiceCriterionStrippedBitField;
+ if (log)
+ log->Printf("no bitfield direct match");
+ }
}
- const char* typeName = name.GetCString();
if (log)
log->Printf("trying to get %s for VO name %s of type %s",
m_name.c_str(),
Modified: lldb/trunk/include/lldb/lldb-enumerations.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-enumerations.h?rev=136945&r1=136944&r2=136945&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-enumerations.h (original)
+++ lldb/trunk/include/lldb/lldb-enumerations.h Thu Aug 4 18:37:18 2011
@@ -507,7 +507,8 @@
eFormatterChoiceCriterionNavigatedBaseClasses = 0x00000004,
eFormatterChoiceCriterionRegularExpressionSummary = 0x00000008,
eFormatterChoiceCriterionRegularExpressionFilter = 0x00000008,
- eFormatterChoiceCriterionDynamicObjCHierarchy = 0x00000010
+ eFormatterChoiceCriterionDynamicObjCHierarchy = 0x00000010,
+ eFormatterChoiceCriterionStrippedBitField = 0x00000020
} FormatterChoiceCriterion;
//----------------------------------------------------------------------
Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=136945&r1=136944&r2=136945&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Thu Aug 4 18:37:18 2011
@@ -953,7 +953,7 @@
SetFormat(custom_format);
const char * return_value;
- std::auto_ptr alloc_mem;
+ std::string alloc_mem;
switch(val_obj_display)
{
@@ -970,12 +970,11 @@
return_value = GetLocationAsCString();
break;
case eDisplayChildrenCount:
- // keep this out of the local scope so it will only get deleted when
- // we exit the function (..and we have a copy of the data into the Stream)
- alloc_mem = std::auto_ptr((char*)(return_value = new char[512]));
{
+ alloc_mem.resize(512);
+ return_value = &alloc_mem[0];
int count = GetNumChildren();
- snprintf(alloc_mem.get(), 512, "%d", count);
+ snprintf((char*)return_value, 512, "%d", count);
break;
}
default:
From johnny.chen at apple.com Thu Aug 4 19:07:41 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Fri, 05 Aug 2011 00:07:41 -0000
Subject: [Lldb-commits] [lldb] r136947 - in
/lldb/trunk/test/python_api/default-constructor:
TestDefaultConstructorForAPIObjects.py sb_typemember.py
Message-ID: <20110805000741.509E92A6C12C@llvm.org>
Author: johnny
Date: Thu Aug 4 19:07:41 2011
New Revision: 136947
URL: http://llvm.org/viewvc/llvm-project?rev=136947&view=rev
Log:
Remove expectedFailure decorator for test_SBType, which does not take an empty constructor after the recent changes.
And remove expectedFailure decorator for test_SBTypeMember, which no longer exists after the recent changes, replace
it with test_SBTypeList.
Removed:
lldb/trunk/test/python_api/default-constructor/sb_typemember.py
Modified:
lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
Modified: lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py?rev=136947&r1=136946&r2=136947&view=diff
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py (original)
+++ lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py Thu Aug 4 19:07:41 2011
@@ -294,26 +294,29 @@
sb_thread.fuzz_obj(obj)
@python_api_test
- @unittest2.expectedFailure
def test_SBType(self):
- obj = lldb.SBType()
- if self.TraceOn():
- print obj
- self.assertFalse(obj)
+ try:
+ obj = lldb.SBType()
+ if self.TraceOn():
+ print obj
+ self.assertFalse(obj)
+ # If we reach here, the test fails.
+ self.fail("lldb.SBType() should fail, not succeed!")
+ except:
+ # Exception is expected.
+ return
+
+ # Unreachable code because lldb.SBType() should fail.
# Do fuzz testing on the invalid obj, it should not crash lldb.
import sb_type
sb_type.fuzz_obj(obj)
@python_api_test
- @unittest2.expectedFailure
- def test_SBTypeMember(self):
- obj = lldb.SBTypeMember()
+ def test_SBTypeList(self):
+ obj = lldb.SBTypeList()
if self.TraceOn():
print obj
- self.assertFalse(obj)
- # Do fuzz testing on the invalid obj, it should not crash lldb.
- import sb_typemember
- sb_typemember.fuzz_obj(obj)
+ self.assertTrue(obj)
@python_api_test
def test_SBValue(self):
Removed: lldb/trunk/test/python_api/default-constructor/sb_typemember.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_typemember.py?rev=136946&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_typemember.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_typemember.py (removed)
@@ -1,18 +0,0 @@
-"""
-Fuzz tests an object after the default construction to make sure it does not crash lldb.
-"""
-
-import sys
-import lldb
-
-def fuzz_obj(obj):
- obj.IsBaseClass()
- obj.IsBitfield()
- obj.GetBitfieldWidth()
- obj.GetBitfieldOffset()
- obj.GetOffset()
- obj.GetName()
- obj.GetType()
- obj.GetParentType()
- obj.SetName("my_type_member_name")
- obj.Clear()
From peter at pcc.me.uk Thu Aug 4 19:35:43 2011
From: peter at pcc.me.uk (Peter Collingbourne)
Date: Fri, 05 Aug 2011 00:35:43 -0000
Subject: [Lldb-commits] [lldb] r136951 -
/lldb/trunk/source/Host/common/Host.cpp
Message-ID: <20110805003543.F18C72A6C12C@llvm.org>
Author: pcc
Date: Thu Aug 4 19:35:43 2011
New Revision: 136951
URL: http://llvm.org/viewvc/llvm-project?rev=136951&view=rev
Log:
Complete Host::Backtrace prototype. Fixes Linux build.
Modified:
lldb/trunk/source/Host/common/Host.cpp
Modified: lldb/trunk/source/Host/common/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=136951&r1=136950&r2=136951&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Host.cpp (original)
+++ lldb/trunk/source/Host/common/Host.cpp Thu Aug 4 19:35:43 2011
@@ -488,6 +488,7 @@
{
}
+void
Host::Backtrace (Stream &strm, uint32_t max_frames)
{
// TODO: Is there a way to backtrace the current process on linux? Other systems?
From granata.enrico at gmail.com Thu Aug 4 20:32:50 2011
From: granata.enrico at gmail.com (Enrico Granata)
Date: Fri, 05 Aug 2011 01:32:50 -0000
Subject: [Lldb-commits] [lldb] r136957 - in /lldb/trunk:
include/lldb/Core/FormatManager.h source/Commands/CommandObjectType.cpp
source/Commands/CommandObjectType.h
test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py
test/functionalities/data-formatter/data-formatter-python-synth/main.cpp
Message-ID: <20110805013250.DD4112A6C12C@llvm.org>
Author: enrico
Date: Thu Aug 4 20:32:50 2011
New Revision: 136957
URL: http://llvm.org/viewvc/llvm-project?rev=136957&view=rev
Log:
Option --regex (-x) now also works for synthetic children:
- Added a test case in python-synth
Minor code improvements in categories, making them ready for adding new element types
Modified:
lldb/trunk/include/lldb/Core/FormatManager.h
lldb/trunk/source/Commands/CommandObjectType.cpp
lldb/trunk/source/Commands/CommandObjectType.h
lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py
lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/main.cpp
Modified: lldb/trunk/include/lldb/Core/FormatManager.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/FormatManager.h?rev=136957&r1=136956&r2=136957&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/FormatManager.h (original)
+++ lldb/trunk/include/lldb/Core/FormatManager.h Thu Aug 4 20:32:50 2011
@@ -632,6 +632,17 @@
public:
+ enum FormatCategoryItem
+ {
+ eSummary = 0x0001,
+ eRegexSummary = 0x1001,
+ eFilter = 0x0002,
+ eRegexFilter = 0x1002,
+ };
+
+ typedef uint16_t FormatCategoryItems;
+ static const uint16_t ALL_ITEM_TYPES = 0xFFFF;
+
typedef SummaryNavigator::SharedPointer SummaryNavigatorSP;
typedef RegexSummaryNavigator::SharedPointer RegexSummaryNavigatorSP;
typedef FilterNavigator::SharedPointer FilterNavigatorSP;
@@ -715,24 +726,59 @@
void
ClearSummaries()
{
- m_summary_nav->Clear();
- m_regex_summary_nav->Clear();
+ Clear(eSummary | eRegexSummary);
}
// just a shortcut for (Summary()->Delete(name) || RegexSummary()->Delete(name))
bool
DeleteSummaries(const char* name)
{
- bool del_sum = m_summary_nav->Delete(name);
- bool del_rex = m_regex_summary_nav->Delete(name);
-
- return (del_sum || del_rex);
+ return Delete(name, (eSummary | eRegexSummary));
+ }
+
+
+ void
+ Clear(FormatCategoryItems items = ALL_ITEM_TYPES)
+ {
+ if ( (items & eSummary) )
+ m_summary_nav->Clear();
+ if ( (items & eRegexSummary) )
+ m_regex_summary_nav->Clear();
+ if ( (items & eFilter) )
+ m_filter_nav->Clear();
+ if ( (items & eRegexFilter) )
+ m_regex_filter_nav->Clear();
+ }
+
+ bool
+ Delete(const char* name,
+ FormatCategoryItems items = ALL_ITEM_TYPES)
+ {
+ bool success = false;
+ if ( (items & eSummary) )
+ success = m_summary_nav->Delete(name) || success;
+ if ( (items & eRegexSummary) )
+ success = m_regex_summary_nav->Delete(name) || success;
+ if ( (items & eFilter) )
+ success = m_filter_nav->Delete(name) || success;
+ if ( (items & eRegexFilter) )
+ success = m_regex_filter_nav->Delete(name) || success;
+ return success;
}
uint32_t
- GetCount()
+ GetCount(FormatCategoryItems items = ALL_ITEM_TYPES)
{
- return Summary()->GetCount() + RegexSummary()->GetCount();
+ uint32_t count = 0;
+ if ( (items & eSummary) )
+ count += m_summary_nav->GetCount();
+ if ( (items & eRegexSummary) )
+ count += m_regex_summary_nav->GetCount();
+ if ( (items & eFilter) )
+ count += m_filter_nav->GetCount();
+ if ( (items & eRegexFilter) )
+ count += m_regex_filter_nav->GetCount();
+ return count;
}
std::string
Modified: lldb/trunk/source/Commands/CommandObjectType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectType.cpp?rev=136957&r1=136956&r2=136957&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectType.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectType.cpp Thu Aug 4 20:32:50 2011
@@ -1168,8 +1168,7 @@
const FormatCategory::SharedPointer& cate)
{
const char* name = (const char*)param;
- cate->Summary()->Delete(name);
- cate->RegexSummary()->Delete(name);
+ cate->Delete(name, FormatCategory::eSummary | FormatCategory::eRegexSummary);
return true;
}
@@ -1892,6 +1891,7 @@
//-------------------------------------------------------------------------
bool CommandObjectTypeSynthList_LoopCallback(void* pt2self, const char* type, const SyntheticFilter::SharedPointer& entry);
+bool CommandObjectTypeSynthRXList_LoopCallback(void* pt2self, lldb::RegularExpressionSP regex, const SyntheticFilter::SharedPointer& entry);
class CommandObjectTypeSynthList;
@@ -2044,6 +2044,12 @@
cate->Filter()->LoopThrough(CommandObjectTypeSynthList_LoopCallback, param_vp);
+ if (cate->RegexFilter()->GetCount() > 0)
+ {
+ result->GetOutputStream().Printf("Regex-based filters (slower):\n");
+ cate->RegexFilter()->LoopThrough(CommandObjectTypeSynthRXList_LoopCallback, param_vp);
+ }
+
return true;
}
@@ -2059,6 +2065,7 @@
}
friend bool CommandObjectTypeSynthList_LoopCallback(void* pt2self, const char* type, const SyntheticFilter::SharedPointer& entry);
+ friend bool CommandObjectTypeSynthRXList_LoopCallback(void* pt2self, lldb::RegularExpressionSP regex, const SyntheticFilter::SharedPointer& entry);
};
bool
@@ -2070,6 +2077,15 @@
return param->self->LoopCallback(type, entry, param->regex, param->result);
}
+bool
+CommandObjectTypeSynthRXList_LoopCallback (void* pt2self,
+ lldb::RegularExpressionSP regex,
+ const SyntheticFilter::SharedPointer& entry)
+{
+ CommandObjectTypeSynthList_LoopCallbackParam* param = (CommandObjectTypeSynthList_LoopCallbackParam*)pt2self;
+ return param->self->LoopCallback(regex->GetText(), entry, param->regex, param->result);
+}
+
OptionDefinition
CommandObjectTypeSynthList::CommandOptions::g_option_table[] =
@@ -2157,8 +2173,7 @@
const FormatCategory::SharedPointer& cate)
{
const char* name = (const char*)param;
- cate->Filter()->Delete(name);
- return true;
+ return cate->Delete(name, FormatCategory::eFilter | FormatCategory::eRegexFilter);
}
public:
@@ -2217,6 +2232,7 @@
Debugger::Formatting::Categories::Get(ConstString(m_options.m_category), category);
bool delete_category = category->Filter()->Delete(typeCS.GetCString());
+ delete_category = category->RegexFilter()->Delete(typeCS.GetCString()) || delete_category;
if (delete_category)
{
@@ -2315,7 +2331,7 @@
const char* cate_name,
const FormatCategory::SharedPointer& cate)
{
- cate->Filter()->Clear();
+ cate->Clear(FormatCategory::eFilter | FormatCategory::eRegexFilter);
return true;
}
@@ -2352,6 +2368,7 @@
else
Debugger::Formatting::Categories::Get(ConstString(NULL), category);
category->Filter()->Clear();
+ category->RegexFilter()->Clear();
}
result.SetStatus(eReturnStatusSuccessFinishResult);
@@ -2506,7 +2523,11 @@
const char *type_name = options->m_target_types.GetStringAtIndex(i);
ConstString typeCS(type_name);
if (typeCS)
- category->Filter()->Add(typeCS.GetCString(), synth_provider);
+ CommandObjectTypeSynthAdd::AddSynth(typeCS,
+ synth_provider,
+ options->m_regex ? CommandObjectTypeSynthAdd::eRegexSynth : CommandObjectTypeSynthAdd::eRegularSynth,
+ options->m_category,
+ NULL);
else
{
out_stream->Printf ("Internal error #6: no script attached.\n");
@@ -2517,319 +2538,242 @@
}
};
-class CommandObjectTypeSynthAdd : public CommandObject
+void
+CommandObjectTypeSynthAdd::CollectPythonScript (SynthAddOptions *options,
+ CommandReturnObject &result)
{
-
-private:
-
- class CommandOptions : public Options
+ InputReaderSP reader_sp (new TypeSynthAddInputReader(m_interpreter.GetDebugger()));
+ if (reader_sp && options)
{
- typedef std::vector option_vector;
- public:
- CommandOptions (CommandInterpreter &interpreter) :
- Options (interpreter)
- {
- }
+ InputReaderEZ::InitializationParameters ipr;
- virtual
- ~CommandOptions (){}
-
- virtual Error
- SetOptionValue (uint32_t option_idx, const char *option_arg)
+ Error err (reader_sp->Initialize (ipr.SetBaton(options).SetPrompt(" ")));
+ if (err.Success())
{
- Error error;
- char short_option = (char) m_getopt_table[option_idx].val;
- bool success;
-
- switch (short_option)
- {
- case 'C':
- m_cascade = Args::StringToBoolean(option_arg, true, &success);
- if (!success)
- error.SetErrorStringWithFormat("Invalid value for cascade: %s.\n", option_arg);
- break;
- case 'c':
- m_expr_paths.push_back(option_arg);
- has_child_list = true;
- break;
- case 'P':
- handwrite_python = true;
- break;
- case 'l':
- m_class_name = std::string(option_arg);
- is_class_based = true;
- break;
- case 'p':
- m_skip_pointers = true;
- break;
- case 'r':
- m_skip_references = true;
- break;
- case 'w':
- m_category = ConstString(option_arg).GetCString();
- break;
- default:
- error.SetErrorStringWithFormat ("Unrecognized option '%c'.\n", short_option);
- break;
- }
-
- return error;
+ m_interpreter.GetDebugger().PushInputReader (reader_sp);
+ result.SetStatus (eReturnStatusSuccessFinishNoResult);
}
-
- void
- OptionParsingStarting ()
+ else
{
- m_cascade = true;
- m_class_name = "";
- m_skip_pointers = false;
- m_skip_references = false;
- m_category = NULL;
- m_expr_paths.clear();
- is_class_based = false;
- handwrite_python = false;
- has_child_list = false;
+ result.AppendError (err.AsCString());
+ result.SetStatus (eReturnStatusFailed);
}
-
- const OptionDefinition*
- GetDefinitions ()
+ }
+ else
+ {
+ result.AppendError("out of memory");
+ result.SetStatus (eReturnStatusFailed);
+ }
+}
+
+bool
+CommandObjectTypeSynthAdd::Execute_HandwritePython (Args& command, CommandReturnObject &result)
+{
+ SynthAddOptions *options = new SynthAddOptions ( m_options.m_skip_pointers,
+ m_options.m_skip_references,
+ m_options.m_cascade,
+ m_options.m_regex,
+ m_options.m_category);
+
+ const size_t argc = command.GetArgumentCount();
+
+ for (size_t i = 0; i < argc; i++) {
+ const char* typeA = command.GetArgumentAtIndex(i);
+ if (typeA && *typeA)
+ options->m_target_types << typeA;
+ else
{
- return g_option_table;
+ result.AppendError("empty typenames not allowed");
+ result.SetStatus(eReturnStatusFailed);
+ return false;
}
-
- // Options table: Required for subclasses of Options.
-
- static OptionDefinition g_option_table[];
-
- // Instance variables to hold the values for command options.
-
- bool m_cascade;
- bool m_skip_references;
- bool m_skip_pointers;
- std::string m_class_name;
- bool m_input_python;
- option_vector m_expr_paths;
- const char* m_category;
-
- bool is_class_based;
-
- bool handwrite_python;
-
- bool has_child_list;
-
- typedef option_vector::iterator ExpressionPathsIterator;
- };
+ }
- CommandOptions m_options;
+ CollectPythonScript(options,result);
+ return result.Succeeded();
+}
- virtual Options *
- GetOptions ()
+bool
+CommandObjectTypeSynthAdd::Execute_ChildrenList (Args& command, CommandReturnObject &result)
+{
+ const size_t argc = command.GetArgumentCount();
+
+ if (argc < 1)
{
- return &m_options;
+ result.AppendErrorWithFormat ("%s takes one or more args.\n", m_cmd_name.c_str());
+ result.SetStatus(eReturnStatusFailed);
+ return false;
}
- void
- CollectPythonScript (SynthAddOptions *options,
- CommandReturnObject &result)
+ if (m_options.m_expr_paths.size() == 0)
{
- InputReaderSP reader_sp (new TypeSynthAddInputReader(m_interpreter.GetDebugger()));
- if (reader_sp && options)
- {
-
- InputReaderEZ::InitializationParameters ipr;
-
- Error err (reader_sp->Initialize (ipr.SetBaton(options).SetPrompt(" ")));
- if (err.Success())
- {
- m_interpreter.GetDebugger().PushInputReader (reader_sp);
- result.SetStatus (eReturnStatusSuccessFinishNoResult);
- }
- else
- {
- result.AppendError (err.AsCString());
- result.SetStatus (eReturnStatusFailed);
- }
- }
+ result.AppendErrorWithFormat ("%s needs one or more children.\n", m_cmd_name.c_str());
+ result.SetStatus(eReturnStatusFailed);
+ return false;
+ }
+
+ SyntheticChildrenSP entry;
+
+ SyntheticFilter* impl = new SyntheticFilter(m_options.m_cascade,
+ m_options.m_skip_pointers,
+ m_options.m_skip_references);
+
+ entry.reset(impl);
+
+ // go through the expression paths
+ CommandOptions::ExpressionPathsIterator begin, end = m_options.m_expr_paths.end();
+
+ for (begin = m_options.m_expr_paths.begin(); begin != end; begin++)
+ impl->AddExpressionPath(*begin);
+
+
+ // now I have a valid provider, let's add it to every type
+
+ lldb::FormatCategorySP category;
+ Debugger::Formatting::Categories::Get(ConstString(m_options.m_category), category);
+
+ for (size_t i = 0; i < argc; i++) {
+ const char* typeA = command.GetArgumentAtIndex(i);
+ ConstString typeCS(typeA);
+ if (typeCS)
+ AddSynth(typeCS,
+ entry,
+ m_options.m_regex ? eRegexSynth : eRegularSynth,
+ m_options.m_category,
+ NULL);
else
{
- result.AppendError("out of memory");
- result.SetStatus (eReturnStatusFailed);
+ result.AppendError("empty typenames not allowed");
+ result.SetStatus(eReturnStatusFailed);
+ return false;
}
}
- bool
- Execute_HandwritePython (Args& command, CommandReturnObject &result)
+ result.SetStatus(eReturnStatusSuccessFinishNoResult);
+ return result.Succeeded();
+}
+
+bool
+CommandObjectTypeSynthAdd::Execute_PythonClass (Args& command, CommandReturnObject &result)
+{
+ const size_t argc = command.GetArgumentCount();
+
+ if (argc < 1)
{
- SynthAddOptions *options = new SynthAddOptions ( m_options.m_skip_pointers,
- m_options.m_skip_references,
- m_options.m_cascade,
- m_options.m_category);
-
- const size_t argc = command.GetArgumentCount();
-
- for (size_t i = 0; i < argc; i++) {
- const char* typeA = command.GetArgumentAtIndex(i);
- if (typeA && *typeA)
- options->m_target_types << typeA;
- else
- {
- result.AppendError("empty typenames not allowed");
- result.SetStatus(eReturnStatusFailed);
- return false;
- }
- }
-
- CollectPythonScript(options,result);
- return result.Succeeded();
+ result.AppendErrorWithFormat ("%s takes one or more args.\n", m_cmd_name.c_str());
+ result.SetStatus(eReturnStatusFailed);
+ return false;
}
- bool
- Execute_ChildrenList (Args& command, CommandReturnObject &result)
+ if (m_options.m_class_name.empty() && !m_options.m_input_python)
{
- const size_t argc = command.GetArgumentCount();
-
- if (argc < 1)
- {
- result.AppendErrorWithFormat ("%s takes one or more args.\n", m_cmd_name.c_str());
- result.SetStatus(eReturnStatusFailed);
- return false;
- }
-
- if (m_options.m_expr_paths.size() == 0)
+ result.AppendErrorWithFormat ("%s needs either a Python class name or -P to directly input Python code.\n", m_cmd_name.c_str());
+ result.SetStatus(eReturnStatusFailed);
+ return false;
+ }
+
+ SyntheticChildrenSP entry;
+
+ SyntheticScriptProvider* impl = new SyntheticScriptProvider(m_options.m_cascade,
+ m_options.m_skip_pointers,
+ m_options.m_skip_references,
+ m_options.m_class_name);
+
+ entry.reset(impl);
+
+ // now I have a valid provider, let's add it to every type
+
+ lldb::FormatCategorySP category;
+ Debugger::Formatting::Categories::Get(ConstString(m_options.m_category), category);
+
+ for (size_t i = 0; i < argc; i++) {
+ const char* typeA = command.GetArgumentAtIndex(i);
+ ConstString typeCS(typeA);
+ if (typeCS)
+ AddSynth(typeCS,
+ entry,
+ m_options.m_regex ? eRegexSynth : eRegularSynth,
+ m_options.m_category,
+ NULL);
+ else
{
- result.AppendErrorWithFormat ("%s needs one or more children.\n", m_cmd_name.c_str());
+ result.AppendError("empty typenames not allowed");
result.SetStatus(eReturnStatusFailed);
return false;
}
-
- SyntheticChildrenSP entry;
-
- SyntheticFilter* impl = new SyntheticFilter(m_options.m_cascade,
- m_options.m_skip_pointers,
- m_options.m_skip_references);
-
- entry.reset(impl);
-
- // go through the expression paths
- CommandOptions::ExpressionPathsIterator begin, end = m_options.m_expr_paths.end();
-
- for (begin = m_options.m_expr_paths.begin(); begin != end; begin++)
- impl->AddExpressionPath(*begin);
-
-
- // now I have a valid provider, let's add it to every type
-
- lldb::FormatCategorySP category;
- Debugger::Formatting::Categories::Get(ConstString(m_options.m_category), category);
-
- for (size_t i = 0; i < argc; i++) {
- const char* typeA = command.GetArgumentAtIndex(i);
- ConstString typeCS(typeA);
- if (typeCS)
- category->Filter()->Add(typeCS.GetCString(), entry);
- else
- {
- result.AppendError("empty typenames not allowed");
- result.SetStatus(eReturnStatusFailed);
- return false;
- }
- }
-
- result.SetStatus(eReturnStatusSuccessFinishNoResult);
- return result.Succeeded();
}
- bool
- Execute_PythonClass (Args& command, CommandReturnObject &result)
+ result.SetStatus(eReturnStatusSuccessFinishNoResult);
+ return result.Succeeded();
+}
+
+CommandObjectTypeSynthAdd::CommandObjectTypeSynthAdd (CommandInterpreter &interpreter) :
+CommandObject (interpreter,
+ "type synth add",
+ "Add a new synthetic provider for a type.",
+ NULL), m_options (interpreter)
+{
+ CommandArgumentEntry type_arg;
+ CommandArgumentData type_style_arg;
+
+ type_style_arg.arg_type = eArgTypeName;
+ type_style_arg.arg_repetition = eArgRepeatPlus;
+
+ type_arg.push_back (type_style_arg);
+
+ m_arguments.push_back (type_arg);
+
+}
+
+bool
+CommandObjectTypeSynthAdd::AddSynth(const ConstString& type_name,
+ SyntheticChildrenSP entry,
+ SynthFormatType type,
+ const char* category_name,
+ Error* error)
+{
+ lldb::FormatCategorySP category;
+ Debugger::Formatting::Categories::Get(ConstString(category_name), category);
+
+ if (type == eRegexSynth)
{
- const size_t argc = command.GetArgumentCount();
-
- if (argc < 1)
+ RegularExpressionSP typeRX(new RegularExpression());
+ if (!typeRX->Compile(type_name.GetCString()))
{
- result.AppendErrorWithFormat ("%s takes one or more args.\n", m_cmd_name.c_str());
- result.SetStatus(eReturnStatusFailed);
+ if (error)
+ error->SetErrorString("regex format error (maybe this is not really a regex?)");
return false;
}
- if (m_options.m_class_name.empty() && !m_options.m_input_python)
- {
- result.AppendErrorWithFormat ("%s needs either a Python class name or -P to directly input Python code.\n", m_cmd_name.c_str());
- result.SetStatus(eReturnStatusFailed);
- return false;
- }
-
- SyntheticChildrenSP entry;
-
- SyntheticScriptProvider* impl = new SyntheticScriptProvider(m_options.m_cascade,
- m_options.m_skip_pointers,
- m_options.m_skip_references,
- m_options.m_class_name);
-
- entry.reset(impl);
-
- // now I have a valid provider, let's add it to every type
-
- lldb::FormatCategorySP category;
- Debugger::Formatting::Categories::Get(ConstString(m_options.m_category), category);
-
- for (size_t i = 0; i < argc; i++) {
- const char* typeA = command.GetArgumentAtIndex(i);
- ConstString typeCS(typeA);
- if (typeCS)
- category->Filter()->Add(typeCS.GetCString(), entry);
- else
- {
- result.AppendError("empty typenames not allowed");
- result.SetStatus(eReturnStatusFailed);
- return false;
- }
- }
-
- result.SetStatus(eReturnStatusSuccessFinishNoResult);
- return result.Succeeded();
- }
-
-public:
-
- CommandObjectTypeSynthAdd (CommandInterpreter &interpreter) :
- CommandObject (interpreter,
- "type synth add",
- "Add a new synthetic provider for a type.",
- NULL), m_options (interpreter)
- {
- CommandArgumentEntry type_arg;
- CommandArgumentData type_style_arg;
-
- type_style_arg.arg_type = eArgTypeName;
- type_style_arg.arg_repetition = eArgRepeatPlus;
-
- type_arg.push_back (type_style_arg);
-
- m_arguments.push_back (type_arg);
+ category->RegexFilter()->Delete(type_name.GetCString());
+ category->RegexFilter()->Add(typeRX, entry);
+ return true;
}
-
- ~CommandObjectTypeSynthAdd ()
+ else
{
+ category->Filter()->Add(type_name.GetCString(), entry);
+ return true;
}
+}
- bool
- Execute (Args& command, CommandReturnObject &result)
- {
- if (m_options.handwrite_python)
- return Execute_HandwritePython(command, result);
- else if (m_options.is_class_based)
- return Execute_PythonClass(command, result);
- else if (m_options.has_child_list)
- return Execute_ChildrenList(command, result);
- else
- {
- result.AppendError("must either provide a children list, a Python class name, or use -P and type a Python class line-by-line");
- result.SetStatus(eReturnStatusFailed);
- return false;
- }
+bool
+CommandObjectTypeSynthAdd::Execute (Args& command, CommandReturnObject &result)
+{
+ if (m_options.handwrite_python)
+ return Execute_HandwritePython(command, result);
+ else if (m_options.is_class_based)
+ return Execute_PythonClass(command, result);
+ else if (m_options.has_child_list)
+ return Execute_ChildrenList(command, result);
+ else
+ {
+ result.AppendError("must either provide a children list, a Python class name, or use -P and type a Python class line-by-line");
+ result.SetStatus(eReturnStatusFailed);
+ return false;
}
-};
+}
OptionDefinition
CommandObjectTypeSynthAdd::CommandOptions::g_option_table[] =
@@ -2841,6 +2785,7 @@
{ LLDB_OPT_SET_1, false, "child", 'c', required_argument, NULL, 0, eArgTypeName, "Include this expression path in the synthetic view."},
{ LLDB_OPT_SET_2, false, "python-class", 'l', required_argument, NULL, 0, eArgTypeName, "Use this Python class to produce synthetic children."},
{ LLDB_OPT_SET_3, false, "input-python", 'P', no_argument, NULL, 0, eArgTypeNone, "Type Python code to generate a class that provides synthetic children."},
+ { LLDB_OPT_SET_ALL, false, "regex", 'x', no_argument, NULL, 0, eArgTypeNone, "Type names are actually regular expressions."},
{ 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
};
Modified: lldb/trunk/source/Commands/CommandObjectType.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectType.h?rev=136957&r1=136956&r2=136957&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectType.h (original)
+++ lldb/trunk/source/Commands/CommandObjectType.h Thu Aug 4 20:32:50 2011
@@ -78,6 +78,7 @@
bool m_skip_pointers;
bool m_skip_references;
bool m_cascade;
+ bool m_regex;
StringList m_user_source;
StringList m_target_types;
@@ -86,10 +87,12 @@
SynthAddOptions(bool sptr,
bool sref,
bool casc,
+ bool regx,
const char* catg) :
m_skip_pointers(sptr),
m_skip_references(sref),
m_cascade(casc),
+ m_regex(regx),
m_user_source(),
m_target_types(),
m_category(catg)
@@ -203,7 +206,157 @@
const char* category,
Error* error = NULL);
};
-
+
+class CommandObjectTypeSynthAdd : public CommandObject
+{
+
+private:
+
+ class CommandOptions : public Options
+ {
+ typedef std::vector option_vector;
+ public:
+
+ CommandOptions (CommandInterpreter &interpreter) :
+ Options (interpreter)
+ {
+ }
+
+ virtual
+ ~CommandOptions (){}
+
+ virtual Error
+ SetOptionValue (uint32_t option_idx, const char *option_arg)
+ {
+ Error error;
+ char short_option = (char) m_getopt_table[option_idx].val;
+ bool success;
+
+ switch (short_option)
+ {
+ case 'C':
+ m_cascade = Args::StringToBoolean(option_arg, true, &success);
+ if (!success)
+ error.SetErrorStringWithFormat("Invalid value for cascade: %s.\n", option_arg);
+ break;
+ case 'c':
+ m_expr_paths.push_back(option_arg);
+ has_child_list = true;
+ break;
+ case 'P':
+ handwrite_python = true;
+ break;
+ case 'l':
+ m_class_name = std::string(option_arg);
+ is_class_based = true;
+ break;
+ case 'p':
+ m_skip_pointers = true;
+ break;
+ case 'r':
+ m_skip_references = true;
+ break;
+ case 'w':
+ m_category = ConstString(option_arg).GetCString();
+ break;
+ case 'x':
+ m_regex = true;
+ break;
+ default:
+ error.SetErrorStringWithFormat ("Unrecognized option '%c'.\n", short_option);
+ break;
+ }
+
+ return error;
+ }
+
+ void
+ OptionParsingStarting ()
+ {
+ m_cascade = true;
+ m_class_name = "";
+ m_skip_pointers = false;
+ m_skip_references = false;
+ m_category = NULL;
+ m_expr_paths.clear();
+ is_class_based = false;
+ handwrite_python = false;
+ has_child_list = false;
+ m_regex = false;
+ }
+
+ const OptionDefinition*
+ GetDefinitions ()
+ {
+ return g_option_table;
+ }
+
+ // Options table: Required for subclasses of Options.
+
+ static OptionDefinition g_option_table[];
+
+ // Instance variables to hold the values for command options.
+
+ bool m_cascade;
+ bool m_skip_references;
+ bool m_skip_pointers;
+ std::string m_class_name;
+ bool m_input_python;
+ option_vector m_expr_paths;
+ const char* m_category;
+
+ bool is_class_based;
+
+ bool handwrite_python;
+
+ bool has_child_list;
+
+ bool m_regex;
+
+ typedef option_vector::iterator ExpressionPathsIterator;
+ };
+
+ CommandOptions m_options;
+
+ virtual Options *
+ GetOptions ()
+ {
+ return &m_options;
+ }
+
+ void
+ CollectPythonScript (SynthAddOptions *options,
+ CommandReturnObject &result);
+ bool
+ Execute_HandwritePython (Args& command, CommandReturnObject &result);
+ bool
+ Execute_ChildrenList (Args& command, CommandReturnObject &result);
+ bool
+ Execute_PythonClass (Args& command, CommandReturnObject &result);
+ bool
+ Execute (Args& command, CommandReturnObject &result);
+
+public:
+
+ enum SynthFormatType
+ {
+ eRegularSynth,
+ eRegexSynth,
+ };
+
+ CommandObjectTypeSynthAdd (CommandInterpreter &interpreter);
+
+ ~CommandObjectTypeSynthAdd ()
+ {
+ }
+
+ static bool
+ AddSynth(const ConstString& type_name,
+ lldb::SyntheticChildrenSP entry,
+ SynthFormatType type,
+ const char* category_name,
+ Error* error);
+};
} // namespace lldb_private
Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py?rev=136957&r1=136956&r2=136957&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py Thu Aug 4 20:32:50 2011
@@ -300,13 +300,14 @@
'[3] = \"!!!\"'])
# now std::map
+ # also take a chance to test regex synth here
self.runCmd("n")
self.runCmd("frame variable ii -T")
self.runCmd("script from StdMapSynthProvider import *")
- self.runCmd("type summary add std::intint_map intint_map -f \"map has ${svar%#} items\" -e")
- self.runCmd("type synth add std::intint_map intint_map -l StdMapSynthProvider")
+ self.runCmd("type summary add -x \"std::map<\" -f \"map has ${svar%#} items\" -e")
+ self.runCmd("type synth add -x \"std::map<\" -l StdMapSynthProvider")
self.expect('frame variable ii',
@@ -356,8 +357,8 @@
self.runCmd("n")
self.runCmd("frame variable si -T")
- self.runCmd("type summary add std::strint_map strint_map -f \"map has ${svar%#} items\" -e")
- self.runCmd("type synth add std::strint_map strint_map -l StdMapSynthProvider")
+ #self.runCmd("type summary add std::strint_map strint_map -f \"map has ${svar%#} items\" -e")
+ #self.runCmd("type synth add std::strint_map strint_map -l StdMapSynthProvider")
self.expect('frame variable si',
substrs = ['map has 0 items',
@@ -400,8 +401,8 @@
self.runCmd("n")
self.runCmd("frame variable is -T")
- self.runCmd("type summary add std::intstr_map intstr_map -f \"map has ${svar%#} items\" -e")
- self.runCmd("type synth add std::intstr_map intstr_map -l StdMapSynthProvider")
+ #self.runCmd("type summary add std::intstr_map intstr_map -f \"map has ${svar%#} items\" -e")
+ #self.runCmd("type synth add std::intstr_map intstr_map -l StdMapSynthProvider")
self.expect('frame variable is',
substrs = ['map has 0 items',
@@ -433,8 +434,8 @@
self.runCmd("n")
self.runCmd("frame variable ss -T")
- self.runCmd("type summary add std::strstr_map strstr_map -f \"map has ${svar%#} items\" -e")
- self.runCmd("type synth add std::strstr_map strstr_map -l StdMapSynthProvider")
+ #self.runCmd("type summary add std::strstr_map strstr_map -f \"map has ${svar%#} items\" -e")
+ #self.runCmd("type synth add std::strstr_map strstr_map -l StdMapSynthProvider")
self.expect('frame variable ss',
substrs = ['map has 0 items',
Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/main.cpp?rev=136957&r1=136956&r2=136957&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/main.cpp (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/main.cpp Thu Aug 4 20:32:50 2011
@@ -8,10 +8,10 @@
typedef std::list int_list;
typedef std::list string_list;
-typedef std::map intint_map;
-typedef std::map strint_map;
-typedef std::map intstr_map;
-typedef std::map strstr_map;
+#define intint_map std::map
+#define strint_map std::map
+#define intstr_map std::map
+#define strstr_map std::map
struct foo
{
From johnny.chen at apple.com Thu Aug 4 20:35:50 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Fri, 05 Aug 2011 01:35:50 -0000
Subject: [Lldb-commits] [lldb] r136958 -
/lldb/trunk/scripts/Python/modify-python-lldb.py
Message-ID: <20110805013550.2847E2A6C12C@llvm.org>
Author: johnny
Date: Thu Aug 4 20:35:49 2011
New Revision: 136958
URL: http://llvm.org/viewvc/llvm-project?rev=136958&view=rev
Log:
The recently introduced SBTypeList is also iterable.
This patch takes some time because the old Python constructor pattern was not a valid one,
and breaks with SBTypeList's __init__ signature. Oops.
Modified:
lldb/trunk/scripts/Python/modify-python-lldb.py
Modified: lldb/trunk/scripts/Python/modify-python-lldb.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/modify-python-lldb.py?rev=136958&r1=136957&r2=136958&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/modify-python-lldb.py (original)
+++ lldb/trunk/scripts/Python/modify-python-lldb.py Thu Aug 4 20:35:49 2011
@@ -171,7 +171,8 @@
'SBInstructionList': ('GetSize', 'GetInstructionAtIndex'),
'SBStringList': ('GetSize', 'GetStringAtIndex',),
'SBSymbolContextList': ('GetSize', 'GetContextAtIndex'),
- 'SBValueList': ('GetSize', 'GetValueAtIndex'),
+ 'SBTypeList': ('GetSize', 'GetTypeAtIndex'),
+ 'SBValueList': ('GetSize', 'GetValueAtIndex'),
'SBType': ('GetNumberChildren', 'GetChildAtIndex'),
'SBValue': ('GetNumChildren', 'GetChildAtIndex'),
@@ -240,7 +241,7 @@
class_pattern = re.compile("^class (SB.*)\(_object\):$")
# The pattern for recognizing the beginning of the __init__ method definition.
-init_pattern = re.compile("^ def __init__\(self, \*args\):")
+init_pattern = re.compile("^ def __init__\(self.*\):")
# The pattern for recognizing the beginning of the IsValid method definition.
isvalid_pattern = re.compile("^ def IsValid\(")
From johnny.chen at apple.com Fri Aug 5 15:17:27 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Fri, 05 Aug 2011 20:17:27 -0000
Subject: [Lldb-commits] [lldb] r136975 - in /lldb/trunk:
scripts/Python/modify-python-lldb.py test/lldbtest.py test/python_api/type/
test/python_api/type/Makefile test/python_api/type/TestTypeList.py
test/python_api/type/main.cpp
Message-ID: <20110805201727.B69352A6C12C@llvm.org>
Author: johnny
Date: Fri Aug 5 15:17:27 2011
New Revision: 136975
URL: http://llvm.org/viewvc/llvm-project?rev=136975&view=rev
Log:
o modify-python-lldb.py:
Add the rich comparison methods (__eq__, __ne__) to SBType, too.
o lldbtest.py:
Add debug utility method TestBase.DebugSBType().
o test/python_api/type:
Add tests for exercising SBType/SBTypeList API, including the SBTarget.FindTypes(type_name)
API which returns a SBTypeList matching the type_name.
Added:
lldb/trunk/test/python_api/type/
lldb/trunk/test/python_api/type/Makefile
lldb/trunk/test/python_api/type/TestTypeList.py
lldb/trunk/test/python_api/type/main.cpp
Modified:
lldb/trunk/scripts/Python/modify-python-lldb.py
lldb/trunk/test/lldbtest.py
Modified: lldb/trunk/scripts/Python/modify-python-lldb.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/modify-python-lldb.py?rev=136975&r1=136974&r2=136975&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/modify-python-lldb.py (original)
+++ lldb/trunk/scripts/Python/modify-python-lldb.py Fri Aug 5 15:17:27 2011
@@ -1,5 +1,5 @@
#
-# modify-lldb-python.py
+# modify-python-lldb.py
#
# This script modifies the lldb module (which was automatically generated via
# running swig) to support iteration and/or equality operations for certain lldb
@@ -189,7 +189,8 @@
e = { 'SBAddress': ['GetFileAddress', 'GetModule'],
'SBBreakpoint': ['GetID'],
'SBFileSpec': ['GetFilename', 'GetDirectory'],
- 'SBModule': ['GetFileSpec', 'GetUUIDString']
+ 'SBModule': ['GetFileSpec', 'GetUUIDString'],
+ 'SBType': ['GetByteSize', 'GetName']
}
def list_to_frag(list):
Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=136975&r1=136974&r2=136975&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Fri Aug 5 15:17:27 2011
@@ -1060,6 +1060,17 @@
err.write('\t' + "IsPointerType -> " + str(val.TypeIsPointerType()) + '\n')
err.write('\t' + "Location -> " + val.GetLocation() + '\n')
+ def DebugSBType(self, type):
+ """Debug print a SBType object, if traceAlways is True."""
+ if not traceAlways:
+ return
+
+ err = sys.stderr
+ err.write(type.GetName() + ":\n")
+ err.write('\t' + "ByteSize -> " + str(type.GetByteSize()) + '\n')
+ err.write('\t' + "IsPointerType -> " + str(type.IsPointerType()) + '\n')
+ err.write('\t' + "IsReferenceType -> " + str(type.IsReferenceType()) + '\n')
+
def DebugPExpect(self, child):
"""Debug the spwaned pexpect object."""
if not traceAlways:
Added: lldb/trunk/test/python_api/type/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/type/Makefile?rev=136975&view=auto
==============================================================================
--- lldb/trunk/test/python_api/type/Makefile (added)
+++ lldb/trunk/test/python_api/type/Makefile Fri Aug 5 15:17:27 2011
@@ -0,0 +1,5 @@
+LEVEL = ../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules
Added: lldb/trunk/test/python_api/type/TestTypeList.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/type/TestTypeList.py?rev=136975&view=auto
==============================================================================
--- lldb/trunk/test/python_api/type/TestTypeList.py (added)
+++ lldb/trunk/test/python_api/type/TestTypeList.py Fri Aug 5 15:17:27 2011
@@ -0,0 +1,108 @@
+"""
+Test SBType and SBTypeList API.
+"""
+
+import os, time
+import re
+import unittest2
+import lldb, lldbutil
+from lldbtest import *
+
+class TypeAndTypeListTestCase(TestBase):
+
+ mydir = os.path.join("python_api", "type")
+
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ @python_api_test
+ def test_with_dsym(self):
+ """Exercise SBType and SBTypeList API."""
+ d = {'EXE': self.exe_name}
+ self.buildDsym(dictionary=d)
+ self.setTearDownCleanup(dictionary=d)
+ self.type_and_typelist_api(self.exe_name)
+
+ @python_api_test
+ def test_with_dwarf(self):
+ """Exercise SBType and SBTypeList API."""
+ d = {'EXE': self.exe_name}
+ self.buildDwarf(dictionary=d)
+ self.setTearDownCleanup(dictionary=d)
+ self.type_and_typelist_api(self.exe_name)
+
+ def setUp(self):
+ # Call super's setUp().
+ TestBase.setUp(self)
+ # We'll use the test method name as the exe_name.
+ self.exe_name = self.testMethodName
+ # Find the line number to break at.
+ self.source = 'main.cpp'
+ self.line = line_number(self.source, '// Break at this line')
+
+ def type_and_typelist_api(self, exe_name):
+ """Exercise SBType and SBTypeList API."""
+ exe = os.path.join(os.getcwd(), exe_name)
+
+ # Create a target by the debugger.
+ target = self.dbg.CreateTarget(exe)
+ self.assertTrue(target, VALID_TARGET)
+
+ # Create the breakpoint inside function 'main'.
+ breakpoint = target.BreakpointCreateByLocation(self.source, self.line)
+ self.assertTrue(breakpoint, VALID_BREAKPOINT)
+
+ # Now launch the process, and do not stop at entry point.
+ process = target.LaunchSimple(None, None, os.getcwd())
+ self.assertTrue(process, PROCESS_IS_VALID)
+
+ # Get Frame #0.
+ self.assertTrue(process.GetState() == lldb.eStateStopped)
+ thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
+ frame0 = thread.GetFrameAtIndex(0)
+
+ # Get the type 'Task'.
+ type_list = target.FindTypes('Task')
+ if self.TraceOn():
+ print "Size of type_list from target.FindTypes('Task') query: %d" % type_list.GetSize()
+ self.assertTrue(len(type_list) == 1)
+ for type in type_list:
+ self.assertTrue(type)
+ self.DebugSBType(type)
+
+ # Now use the SBTarget.FindFirstType() API to find 'Task'.
+ task_type = target.FindFirstType('Task')
+ self.assertTrue(task_type)
+ self.DebugSBType(task_type)
+
+ # Get the reference type of 'Task', just for fun.
+ task_ref_type = task_type.GetReferenceType()
+ self.assertTrue(task_ref_type)
+ self.DebugSBType(task_ref_type)
+
+ # Get the pointer type of 'Task', which is the same as task_head's type.
+ task_pointer_type = task_type.GetPointerType()
+ self.assertTrue(task_pointer_type)
+ self.DebugSBType(task_pointer_type)
+
+ # Get variable 'task_head'.
+ task_head = frame0.FindVariable('task_head')
+ self.assertTrue(task_head, VALID_VARIABLE)
+ self.DebugSBValue(task_head)
+ task_head_type = task_head.GetType()
+ self.DebugSBType(task_head_type)
+ self.assertTrue(task_head_type.IsPointerType())
+
+ self.assertTrue(task_head_type == task_pointer_type)
+
+ # Get the pointee type of 'task_head'.
+ task_head_pointee_type = task_head_type.GetPointeeType()
+ self.DebugSBType(task_head_pointee_type)
+
+ self.assertTrue(task_type == task_head_pointee_type)
+
+
+if __name__ == '__main__':
+ import atexit
+ lldb.SBDebugger.Initialize()
+ atexit.register(lambda: lldb.SBDebugger.Terminate())
+ unittest2.main()
Added: lldb/trunk/test/python_api/type/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/type/main.cpp?rev=136975&view=auto
==============================================================================
--- lldb/trunk/test/python_api/type/main.cpp (added)
+++ lldb/trunk/test/python_api/type/main.cpp Fri Aug 5 15:17:27 2011
@@ -0,0 +1,49 @@
+//===-- main.c --------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+#include
+
+class Task {
+public:
+ int id;
+ Task *next;
+ Task(int i, Task *n):
+ id(i),
+ next(n)
+ {}
+};
+
+
+int main (int argc, char const *argv[])
+{
+ Task *task_head = new Task(-1, NULL);
+ Task *task1 = new Task(1, NULL);
+ Task *task2 = new Task(2, NULL);
+ Task *task3 = new Task(3, NULL); // Orphaned.
+ Task *task4 = new Task(4, NULL);
+ Task *task5 = new Task(5, NULL);
+
+ task_head->next = task1;
+ task1->next = task2;
+ task2->next = task4;
+ task4->next = task5;
+
+ int total = 0;
+ Task *t = task_head;
+ while (t != NULL) {
+ if (t->id >= 0)
+ ++total;
+ t = t->next;
+ }
+ printf("We have a total number of %d tasks\n", total);
+
+ // This corresponds to an empty task list.
+ Task *empty_task_head = new Task(-1, NULL);
+
+ return 0; // Break at this line
+}
From johnny.chen at apple.com Fri Aug 5 15:30:56 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Fri, 05 Aug 2011 20:30:56 -0000
Subject: [Lldb-commits] [lldb] r136976 -
/lldb/trunk/scripts/Python/interface/SBType.i
Message-ID: <20110805203056.3967D2A6C12C@llvm.org>
Author: johnny
Date: Fri Aug 5 15:30:56 2011
New Revision: 136976
URL: http://llvm.org/viewvc/llvm-project?rev=136976&view=rev
Log:
Fix indentation and remove the private section of SBTypeList.
SWIG doesn't care about the private section of class SBTypeList.
Modified:
lldb/trunk/scripts/Python/interface/SBType.i
Modified: lldb/trunk/scripts/Python/interface/SBType.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBType.i?rev=136976&r1=136975&r2=136976&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBType.i (original)
+++ lldb/trunk/scripts/Python/interface/SBType.i Fri Aug 5 15:30:56 2011
@@ -9,63 +9,59 @@
namespace lldb {
- class SBType
- {
- public:
-
- SBType (const SBType &rhs);
-
- ~SBType ();
-
- bool
- IsValid() const;
-
- size_t
- GetByteSize() const;
-
- bool
- IsPointerType() const;
-
- bool
- IsReferenceType() const;
-
- SBType
- GetPointerType() const;
-
- SBType
- GetPointeeType() const;
-
- SBType
- GetReferenceType() const;
-
- SBType
- GetDereferencedType() const;
-
- SBType
- GetBasicType(lldb::BasicType type) const;
-
- const char*
- GetName();
- };
-
- class SBTypeList
- {
- public:
- SBTypeList();
-
- void
- Append(const SBType& type);
-
- SBType
- GetTypeAtIndex(int index);
-
- int
- GetSize();
-
- ~SBTypeList();
-
- private:
- std::auto_ptr m_content;
- };
+class SBType
+{
+public:
+ SBType (const SBType &rhs);
+
+ ~SBType ();
+
+ bool
+ IsValid() const;
+
+ size_t
+ GetByteSize() const;
+
+ bool
+ IsPointerType() const;
+
+ bool
+ IsReferenceType() const;
+
+ SBType
+ GetPointerType() const;
+
+ SBType
+ GetPointeeType() const;
+
+ SBType
+ GetReferenceType() const;
+
+ SBType
+ GetDereferencedType() const;
+
+ SBType
+ GetBasicType(lldb::BasicType type) const;
+
+ const char*
+ GetName();
+};
+
+class SBTypeList
+{
+public:
+ SBTypeList();
+
+ void
+ Append(const SBType& type);
+
+ SBType
+ GetTypeAtIndex(int index);
+
+ int
+ GetSize();
+
+ ~SBTypeList();
+};
} // namespace lldb
From johnny.chen at apple.com Fri Aug 5 15:48:02 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Fri, 05 Aug 2011 20:48:02 -0000
Subject: [Lldb-commits] [lldb] r136979 -
/lldb/trunk/scripts/Python/interface/SBType.i
Message-ID: <20110805204802.568D92A6C12C@llvm.org>
Author: johnny
Date: Fri Aug 5 15:48:02 2011
New Revision: 136979
URL: http://llvm.org/viewvc/llvm-project?rev=136979&view=rev
Log:
Add docstring & example usage for SBTypeList.
Modified:
lldb/trunk/scripts/Python/interface/SBType.i
Modified: lldb/trunk/scripts/Python/interface/SBType.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBType.i?rev=136979&r1=136978&r2=136979&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBType.i (original)
+++ lldb/trunk/scripts/Python/interface/SBType.i Fri Aug 5 15:48:02 2011
@@ -47,6 +47,37 @@
GetName();
};
+%feature("docstring",
+"Represents a list of SBTypes. The FindTypes() method of SBTarget/SBModule
+returns a SBTypeList.
+
+SBTypeList supports SBType iteration. For example,
+
+main.cpp:
+
+class Task {
+public:
+ int id;
+ Task *next;
+ Task(int i, Task *n):
+ id(i),
+ next(n)
+ {}
+};
+
+...
+
+find_type.py:
+
+ # Get the type 'Task'.
+ type_list = target.FindTypes('Task')
+ self.assertTrue(len(type_list) == 1)
+ # To illustrate the SBType iteration.
+ for type in type_list:
+ # do something with type
+
+...
+") SBTypeList;
class SBTypeList
{
public:
From gclayton at apple.com Fri Aug 5 15:48:30 2011
From: gclayton at apple.com (Greg Clayton)
Date: Fri, 05 Aug 2011 20:48:30 -0000
Subject: [Lldb-commits] [lldb] r136980 - in /lldb/trunk:
include/lldb/API/SBType.h source/API/SBType.cpp
source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
source/Symbol/ClangASTContext.cpp
Message-ID: <20110805204830.A70722A6C12C@llvm.org>
Author: gclayton
Date: Fri Aug 5 15:48:30 2011
New Revision: 136980
URL: http://llvm.org/viewvc/llvm-project?rev=136980&view=rev
Log:
Fixed issues for iOS debugging where if a device has
a native architecture that doesn't match the universal
slice that is being used for all executables, we weren't
correctly descending through the platform architectures
and resolving the binaries.
Modified:
lldb/trunk/include/lldb/API/SBType.h
lldb/trunk/source/API/SBType.cpp
lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
lldb/trunk/source/Symbol/ClangASTContext.cpp
Modified: lldb/trunk/include/lldb/API/SBType.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBType.h?rev=136980&r1=136979&r2=136980&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBType.h (original)
+++ lldb/trunk/include/lldb/API/SBType.h Fri Aug 5 15:48:30 2011
@@ -71,6 +71,10 @@
const char*
GetName();
+
+ // DEPRECATED: but needed for Xcode right now
+ static bool
+ IsPointerType (void * clang_type);
protected:
lldb::TypeImplSP m_opaque_sp;
Modified: lldb/trunk/source/API/SBType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBType.cpp?rev=136980&r1=136979&r2=136980&view=diff
==============================================================================
--- lldb/trunk/source/API/SBType.cpp (original)
+++ lldb/trunk/source/API/SBType.cpp Fri Aug 5 15:48:30 2011
@@ -356,4 +356,17 @@
SBTypeList::~SBTypeList()
{
-}
\ No newline at end of file
+}
+
+bool
+SBType::IsPointerType (void *opaque_type)
+{
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+
+ bool ret_value = ClangASTContext::IsPointerType (opaque_type);
+
+ if (log)
+ log->Printf ("SBType::IsPointerType (opaque_type=%p) ==> '%s'", opaque_type, (ret_value ? "true" : "false"));
+
+ return ret_value;
+}
Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp?rev=136980&r1=136979&r2=136980&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp Fri Aug 5 15:48:30 2011
@@ -929,38 +929,39 @@
if (ReadAllImageInfosStructure ())
{
- if (m_dyld_all_image_infos.dylib_info_count > 0)
+ // Nothing to load or unload?
+ if (m_dyld_all_image_infos.dylib_info_count == 0)
+ return true;
+
+ if (m_dyld_all_image_infos.dylib_info_addr == 0)
{
- if (m_dyld_all_image_infos.dylib_info_addr == 0)
+ // DYLD is updating the images now. So we should say we have no images, and then we'll
+ // figure it out when we hit the added breakpoint.
+ return false;
+ }
+ else
+ {
+ if (!AddModulesUsingImageInfosAddress (m_dyld_all_image_infos.dylib_info_addr,
+ m_dyld_all_image_infos.dylib_info_count))
{
- // DYLD is updating the images now. So we should say we have no images, and then we'll
- // figure it out when we hit the added breakpoint.
- return false;
- }
- else
- {
- if (!AddModulesUsingImageInfosAddress (m_dyld_all_image_infos.dylib_info_addr,
- m_dyld_all_image_infos.dylib_info_count))
- {
- DEBUG_PRINTF( "unable to read all data for all_dylib_infos.");
- m_dyld_image_infos.clear();
- }
+ DEBUG_PRINTF( "unable to read all data for all_dylib_infos.");
+ m_dyld_image_infos.clear();
}
}
-
+
// Now we have one more bit of business. If there is a library left in the images for our target that
// doesn't have a load address, then it must be something that we were expecting to load (for instance we
// read a load command for it) but it didn't in fact load - probably because DYLD_*_PATH pointed
// to an equivalent version. We don't want it to stay in the target's module list or it will confuse
// us, so unload it here.
- Target *target = m_process->CalculateTarget();
- ModuleList &modules = target->GetImages();
+ Target &target = m_process->GetTarget();
+ ModuleList &modules = target.GetImages();
ModuleList not_loaded_modules;
size_t num_modules = modules.GetSize();
- for (size_t i = 0; i < num_modules; i++)
+ for (size_t i = 1; i < num_modules; i++)
{
ModuleSP module_sp = modules.GetModuleAtIndex(i);
- if (!module_sp->IsLoadedInTarget (target))
+ if (!module_sp->IsLoadedInTarget (&target))
{
if (log)
{
@@ -974,9 +975,9 @@
if (not_loaded_modules.GetSize() != 0)
{
- target->ModulesDidUnload(not_loaded_modules);
+ target.ModulesDidUnload(not_loaded_modules);
}
-
+
return true;
}
else
@@ -1182,7 +1183,8 @@
if (exe_idx < image_infos.size())
{
- ModuleSP exe_module_sp (FindTargetModuleForDYLDImageInfo (image_infos[exe_idx], false, NULL));
+ const bool can_create = true;
+ ModuleSP exe_module_sp (FindTargetModuleForDYLDImageInfo (image_infos[exe_idx], can_create, NULL));
if (!exe_module_sp)
{
@@ -1198,7 +1200,7 @@
{
// Don't load dependent images since we are in dyld where we will know
// and find out about all images that are loaded
- bool get_dependent_images = false;
+ const bool get_dependent_images = false;
m_process->GetTarget().SetExecutableModule (exe_module_sp,
get_dependent_images);
}
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp?rev=136980&r1=136979&r2=136980&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp Fri Aug 5 15:48:30 2011
@@ -441,8 +441,13 @@
error = GetFile (platform_file, uuid_ptr, local_file);
if (error.Success())
{
+
+ error = ResolveExecutable (local_file, arch, module_sp);
+ }
+ else
+ {
const bool always_create = false;
- error = ModuleList::GetSharedModule (local_file,
+ error = ModuleList::GetSharedModule (platform_file,
arch,
uuid_ptr,
object_name_ptr,
@@ -451,6 +456,7 @@
old_module_sp_ptr,
did_create_ptr,
always_create);
+
}
if (module_sp)
module_sp->SetPlatformFileSpec(platform_file);
Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=136980&r1=136979&r2=136980&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Fri Aug 5 15:48:30 2011
@@ -413,12 +413,6 @@
{
Clear();
m_target_triple.assign(target_triple);
- if (m_target_triple.find("armv7s") == 0)
- m_target_triple.erase(5,1);
- else if (m_target_triple.find("armv7f") == 0)
- m_target_triple.erase(5,1);
- else if (m_target_triple.find("armv7k") == 0)
- m_target_triple.erase(5,1);
}
void
From johnny.chen at apple.com Fri Aug 5 16:35:43 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Fri, 05 Aug 2011 21:35:43 -0000
Subject: [Lldb-commits] [lldb] r136983 - in /lldb/trunk:
scripts/Python/interface/SBType.i test/python_api/type/TestTypeList.py
Message-ID: <20110805213543.790342A6C12C@llvm.org>
Author: johnny
Date: Fri Aug 5 16:35:43 2011
New Revision: 136983
URL: http://llvm.org/viewvc/llvm-project?rev=136983&view=rev
Log:
Add SBType.GetBasicType() to the test scenario.
Add docstring for SBType, too.
Modified:
lldb/trunk/scripts/Python/interface/SBType.i
lldb/trunk/test/python_api/type/TestTypeList.py
Modified: lldb/trunk/scripts/Python/interface/SBType.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBType.i?rev=136983&r1=136982&r2=136983&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBType.i (original)
+++ lldb/trunk/scripts/Python/interface/SBType.i Fri Aug 5 16:35:43 2011
@@ -9,6 +9,79 @@
namespace lldb {
+%feature("docstring",
+"Represents a data type in lldb. The FindFirstType() method of SBTarget/SBModule
+returns a SBType.
+
+SBType supports the eq/ne operator. For example,
+
+main.cpp:
+
+class Task {
+public:
+ int id;
+ Task *next;
+ Task(int i, Task *n):
+ id(i),
+ next(n)
+ {}
+};
+
+int main (int argc, char const *argv[])
+{
+ Task *task_head = new Task(-1, NULL);
+ Task *task1 = new Task(1, NULL);
+ Task *task2 = new Task(2, NULL);
+ Task *task3 = new Task(3, NULL); // Orphaned.
+ Task *task4 = new Task(4, NULL);
+ Task *task5 = new Task(5, NULL);
+
+ task_head->next = task1;
+ task1->next = task2;
+ task2->next = task4;
+ task4->next = task5;
+
+ int total = 0;
+ Task *t = task_head;
+ while (t != NULL) {
+ if (t->id >= 0)
+ ++total;
+ t = t->next;
+ }
+ printf('We have a total number of %d tasks\n', total);
+
+ // This corresponds to an empty task list.
+ Task *empty_task_head = new Task(-1, NULL);
+
+ return 0; // Break at this line
+}
+
+find_type.py:
+
+ # Get the type 'Task'.
+ task_type = target.FindFirstType('Task')
+ self.assertTrue(task_type)
+
+ # Get the variable 'task_head'.
+ frame0.FindVariable('task_head')
+ task_head_type = task_head.GetType()
+ self.assertTrue(task_head_type.IsPointerType())
+
+ # task_head_type is 'Task *'.
+ task_pointer_type = task_type.GetPointerType()
+ self.assertTrue(task_head_type == task_pointer_type)
+
+ # Get the child mmember 'id' from 'task_head'.
+ id = task_head.GetChildMemberWithName('id')
+ id_type = id.GetType()
+
+ # SBType.GetBasicType() takes an enum 'BasicType' (lldb-enumerations.h).
+ int_type = id_type.GetBasicType(lldb.eBasicTypeInt)
+ # id_type and int_type should be the same type!
+ self.assertTrue(id_type == int_type)
+
+...
+") SBType;
class SBType
{
public:
Modified: lldb/trunk/test/python_api/type/TestTypeList.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/type/TestTypeList.py?rev=136983&r1=136982&r2=136983&view=diff
==============================================================================
--- lldb/trunk/test/python_api/type/TestTypeList.py (original)
+++ lldb/trunk/test/python_api/type/TestTypeList.py Fri Aug 5 16:35:43 2011
@@ -100,6 +100,15 @@
self.assertTrue(task_type == task_head_pointee_type)
+ # We'll now get the child member 'id' from 'task_head'.
+ id = task_head.GetChildMemberWithName('id')
+ self.DebugSBValue(id)
+ id_type = id.GetType()
+ self.DebugSBType(id_type)
+
+ # SBType.GetBasicType() takes an enum 'BasicType' (lldb-enumerations.h).
+ int_type = id_type.GetBasicType(lldb.eBasicTypeInt)
+ self.assertTrue(id_type == int_type)
if __name__ == '__main__':
import atexit
From johnny.chen at apple.com Fri Aug 5 16:55:15 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Fri, 05 Aug 2011 21:55:15 -0000
Subject: [Lldb-commits] [lldb] r136985 -
/lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
Message-ID: <20110805215515.D83BB2A6C12C@llvm.org>
Author: johnny
Date: Fri Aug 5 16:55:15 2011
New Revision: 136985
URL: http://llvm.org/viewvc/llvm-project?rev=136985&view=rev
Log:
Fixed test suite failure of test_SBTypeList().
SBTypeList does not have IsValid() method defined. It's always valid in a sense.
So the Python's truth value testing in turn delegates to __len__() method, which
is defined for SBTypeList, and returns 0.
Modified:
lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
Modified: lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py?rev=136985&r1=136984&r2=136985&view=diff
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py (original)
+++ lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py Fri Aug 5 16:55:15 2011
@@ -316,7 +316,10 @@
obj = lldb.SBTypeList()
if self.TraceOn():
print obj
- self.assertTrue(obj)
+ # SBTypeList does not have IsValid() method defined. It's always valid
+ # in a sense. So the Python's truth value testing in turn delegates to
+ # __len__() method, which is defined for SBTypeList, and returns 0.
+ self.assertFalse(obj)
@python_api_test
def test_SBValue(self):
From johnny.chen at apple.com Fri Aug 5 17:23:26 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Fri, 05 Aug 2011 22:23:26 -0000
Subject: [Lldb-commits] [lldb] r136990 - in /lldb/trunk:
include/lldb/API/SBType.h scripts/Python/interface/SBType.i
source/API/SBType.cpp
test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
Message-ID: <20110805222326.40AEC2A6C12C@llvm.org>
Author: johnny
Date: Fri Aug 5 17:23:26 2011
New Revision: 136990
URL: http://llvm.org/viewvc/llvm-project?rev=136990&view=rev
Log:
On second thought, add the IsValid() method to SBTypeList, making it similar to SBSymbolContextList and SBValueList.
Modify the test suite accordingly.
Modified:
lldb/trunk/include/lldb/API/SBType.h
lldb/trunk/scripts/Python/interface/SBType.i
lldb/trunk/source/API/SBType.cpp
lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
Modified: lldb/trunk/include/lldb/API/SBType.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBType.h?rev=136990&r1=136989&r2=136990&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBType.h (original)
+++ lldb/trunk/include/lldb/API/SBType.h Fri Aug 5 17:23:26 2011
@@ -101,6 +101,9 @@
SBTypeList&
operator = (const SBTypeList& rhs);
+ bool
+ IsValid() const;
+
void
Append (const SBType& type);
Modified: lldb/trunk/scripts/Python/interface/SBType.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBType.i?rev=136990&r1=136989&r2=136990&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBType.i (original)
+++ lldb/trunk/scripts/Python/interface/SBType.i Fri Aug 5 17:23:26 2011
@@ -156,6 +156,9 @@
public:
SBTypeList();
+ bool
+ IsValid() const;
+
void
Append(const SBType& type);
Modified: lldb/trunk/source/API/SBType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBType.cpp?rev=136990&r1=136989&r2=136990&view=diff
==============================================================================
--- lldb/trunk/source/API/SBType.cpp (original)
+++ lldb/trunk/source/API/SBType.cpp Fri Aug 5 17:23:26 2011
@@ -323,6 +323,12 @@
Append(rhs.GetTypeAtIndex(i));
}
+bool
+SBTypeList::IsValid () const
+{
+ return (m_opaque_ap.get() != NULL);
+}
+
SBTypeList&
SBTypeList::operator = (const SBTypeList& rhs)
{
Modified: lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py?rev=136990&r1=136989&r2=136990&view=diff
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py (original)
+++ lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py Fri Aug 5 17:23:26 2011
@@ -313,13 +313,11 @@
@python_api_test
def test_SBTypeList(self):
+ """SBTypeList object is valid after default construction."""
obj = lldb.SBTypeList()
if self.TraceOn():
print obj
- # SBTypeList does not have IsValid() method defined. It's always valid
- # in a sense. So the Python's truth value testing in turn delegates to
- # __len__() method, which is defined for SBTypeList, and returns 0.
- self.assertFalse(obj)
+ self.assertTrue(obj)
@python_api_test
def test_SBValue(self):
From scallanan at apple.com Fri Aug 5 18:43:37 2011
From: scallanan at apple.com (Sean Callanan)
Date: Fri, 05 Aug 2011 23:43:37 -0000
Subject: [Lldb-commits] [lldb] r136999 - in /lldb/trunk:
include/lldb/Symbol/ source/Expression/ source/Plugins/SymbolFile/DWARF/
source/Symbol/ test/lang/cpp/this/ test/lang/objc/self/
Message-ID: <20110805234337.B8B3D2A6C12C@llvm.org>
Author: spyffe
Date: Fri Aug 5 18:43:37 2011
New Revision: 136999
URL: http://llvm.org/viewvc/llvm-project?rev=136999&view=rev
Log:
This is an overhaul of the expression parser code
that detects what context the current expression is
meant to execute in. LLDB now properly consults
the method declaration in the debug information
rather than trying to hunt down the "this" or "self"
pointer by name, which can be misleading.
Other fixes include:
- LLDB now properly detects that it is inside
an inlined C++ member function.
- LLDB now allows access to non-const members when
in const code.
- The functions in SymbolFile that locate the
DeclContext containing a DIE have been renamed
to reflect what they actually do. I have added
new functions that find the DeclContext for the
DIE itself.
I have also introduced testcases for C++ and
Objective-C.
Added:
lldb/trunk/test/lang/cpp/this/
lldb/trunk/test/lang/cpp/this/Makefile
lldb/trunk/test/lang/cpp/this/TestCPPThis.py
lldb/trunk/test/lang/cpp/this/main.cpp
lldb/trunk/test/lang/objc/self/
lldb/trunk/test/lang/objc/self/Makefile
lldb/trunk/test/lang/objc/self/TestObjCSelf.py
lldb/trunk/test/lang/objc/self/main.m
Modified:
lldb/trunk/include/lldb/Symbol/Block.h
lldb/trunk/include/lldb/Symbol/Function.h
lldb/trunk/include/lldb/Symbol/SymbolFile.h
lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
lldb/trunk/source/Expression/ClangUserExpression.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/trunk/source/Symbol/Block.cpp
lldb/trunk/source/Symbol/Function.cpp
lldb/trunk/source/Symbol/Type.cpp
Modified: lldb/trunk/include/lldb/Symbol/Block.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Block.h?rev=136999&r1=136998&r2=136999&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/Block.h (original)
+++ lldb/trunk/include/lldb/Symbol/Block.h Fri Aug 5 18:43:37 2011
@@ -336,6 +336,9 @@
{
return m_inlineInfoSP.get();
}
+
+ clang::DeclContext *
+ GetClangDeclContextForInlinedFunction();
//------------------------------------------------------------------
/// Get the memory cost of this object.
Modified: lldb/trunk/include/lldb/Symbol/Function.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Function.h?rev=136999&r1=136998&r2=136999&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/Function.h (original)
+++ lldb/trunk/include/lldb/Symbol/Function.h Fri Aug 5 18:43:37 2011
@@ -10,6 +10,7 @@
#ifndef liblldb_Function_h_
#define liblldb_Function_h_
+#include "lldb/Core/ClangForward.h"
#include "lldb/Core/AddressRange.h"
#include "lldb/Symbol/Block.h"
#include "lldb/Symbol/Declaration.h"
@@ -527,6 +528,15 @@
}
//------------------------------------------------------------------
+ /// Get the DeclContext for this function, if available.
+ ///
+ /// @return
+ /// The DeclContext, or NULL if none exists.
+ //------------------------------------------------------------------
+ clang::DeclContext *
+ GetClangDeclContext();
+
+ //------------------------------------------------------------------
/// Get accessor for the type that describes the function
/// return value type, and paramter types.
///
Modified: lldb/trunk/include/lldb/Symbol/SymbolFile.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolFile.h?rev=136999&r1=136998&r2=136999&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/SymbolFile.h (original)
+++ lldb/trunk/include/lldb/Symbol/SymbolFile.h Fri Aug 5 18:43:37 2011
@@ -113,7 +113,8 @@
virtual size_t ParseVariablesForContext (const SymbolContext& sc) = 0;
virtual Type* ResolveTypeUID (lldb::user_id_t type_uid) = 0;
virtual lldb::clang_type_t ResolveClangOpaqueTypeDefinition (lldb::clang_type_t clang_type) = 0;
- virtual clang::DeclContext* GetClangDeclContextForTypeUID (lldb::user_id_t type_uid) { return NULL; }
+ virtual clang::DeclContext* GetClangDeclContextForTypeUID (const lldb_private::SymbolContext &sc, lldb::user_id_t type_uid) { return NULL; }
+ virtual clang::DeclContext* GetClangDeclContextContainingTypeUID (lldb::user_id_t type_uid) { return NULL; }
virtual uint32_t ResolveSymbolContext (const Address& so_addr, uint32_t resolve_scope, SymbolContext& sc) = 0;
virtual uint32_t ResolveSymbolContext (const FileSpec& file_spec, uint32_t line, bool check_inlines, uint32_t resolve_scope, SymbolContextList& sc_list) = 0;
virtual uint32_t FindGlobalVariables (const ConstString &name, bool append, uint32_t max_matches, VariableList& variables) = 0;
Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=136999&r1=136998&r2=136999&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Fri Aug 5 18:43:37 2011
@@ -1874,7 +1874,12 @@
&pointer_target_type))
return;
- TypeFromUser class_user_type(pointer_target_type,
+ clang::QualType pointer_target_qual_type = QualType::getFromOpaquePtr(pointer_target_type);
+
+ if (pointer_target_qual_type.isConstQualified())
+ pointer_target_qual_type.removeLocalConst();
+
+ TypeFromUser class_user_type(pointer_target_qual_type.getAsOpaquePtr(),
this_type->GetClangAST());
if (log)
Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUserExpression.cpp?rev=136999&r1=136998&r2=136999&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangUserExpression.cpp (original)
+++ lldb/trunk/source/Expression/ClangUserExpression.cpp Fri Aug 5 18:43:37 2011
@@ -37,6 +37,9 @@
#include "lldb/Target/ThreadPlan.h"
#include "lldb/Target/ThreadPlanCallUserExpression.h"
+#include "clang/AST/DeclCXX.h"
+#include "clang/AST/DeclObjC.h"
+
using namespace lldb_private;
ClangUserExpression::ClangUserExpression (const char *expr,
@@ -68,44 +71,46 @@
void
ClangUserExpression::ScanContext(ExecutionContext &exe_ctx)
{
- VariableList *vars = exe_ctx.frame->GetVariableList(false);
+ if (!exe_ctx.frame)
+ return;
+
+ SymbolContext sym_ctx = exe_ctx.frame->GetSymbolContext(lldb::eSymbolContextFunction);
- if (!vars)
+ if (!sym_ctx.function)
return;
- lldb::VariableSP this_var(vars->FindVariable(ConstString("this")));
- lldb::VariableSP self_var(vars->FindVariable(ConstString("self")));
+ clang::DeclContext *decl_context;
- if (this_var.get())
- {
- Type *this_type = this_var->GetType();
+ if (sym_ctx.block && sym_ctx.block->GetInlinedFunctionInfo())
+ decl_context = sym_ctx.block->GetClangDeclContextForInlinedFunction();
+ else
+ decl_context = sym_ctx.function->GetClangDeclContext();
- lldb::clang_type_t pointer_target_type;
+ if (!decl_context)
+ return;
- if (ClangASTContext::IsPointerType(this_type->GetClangForwardType(),
- &pointer_target_type))
+ if (clang::CXXMethodDecl *method_decl = llvm::dyn_cast(decl_context))
+ {
+ if (method_decl->isInstance())
{
- TypeFromUser target_ast_type(pointer_target_type, this_type->GetClangAST());
-
- if (ClangASTContext::IsCXXClassType(target_ast_type.GetOpaqueQualType()))
- {
- m_cplusplus = true;
+ m_cplusplus = true;
- if (target_ast_type.IsConst())
- m_const_object = true;
- }
+ do {
+ clang::QualType this_type = method_decl->getThisType(decl_context->getParentASTContext());
+
+ const clang::PointerType *this_pointer_type = llvm::dyn_cast(this_type.getTypePtr());
+
+ if (!this_pointer_type)
+ break;
+
+ clang::QualType this_pointee_type = this_pointer_type->getPointeeType();
+ } while (0);
}
}
- else if (self_var.get())
+ else if (clang::ObjCMethodDecl *method_decl = llvm::dyn_cast(decl_context))
{
- m_objectivec = true;
-
- Type *self_type = self_var->GetType();
-
- if (self_type->GetClangForwardType() == self_type->GetClangASTContext().GetBuiltInType_objc_id())
- {
- m_objectivec = false;
- }
+ if (method_decl->isInstanceMethod())
+ m_objectivec = true;
}
}
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=136999&r1=136998&r2=136999&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Fri Aug 5 18:43:37 2011
@@ -1355,7 +1355,7 @@
clang::DeclContext*
-SymbolFileDWARF::GetClangDeclContextForTypeUID (lldb::user_id_t type_uid)
+SymbolFileDWARF::GetClangDeclContextContainingTypeUID (lldb::user_id_t type_uid)
{
DWARFDebugInfo* debug_info = DebugInfo();
if (debug_info)
@@ -1363,7 +1363,21 @@
DWARFCompileUnitSP cu_sp;
const DWARFDebugInfoEntry* die = debug_info->GetDIEPtr(type_uid, &cu_sp);
if (die)
- return GetClangDeclContextForDIE (cu_sp.get(), die);
+ return GetClangDeclContextContainingDIE (cu_sp.get(), die);
+ }
+ return NULL;
+}
+
+clang::DeclContext*
+SymbolFileDWARF::GetClangDeclContextForTypeUID (const lldb_private::SymbolContext &sc, lldb::user_id_t type_uid)
+{
+ DWARFDebugInfo* debug_info = DebugInfo();
+ if (debug_info)
+ {
+ DWARFCompileUnitSP cu_sp;
+ const DWARFDebugInfoEntry* die = debug_info->GetDIEPtr(type_uid, &cu_sp);
+ if (die)
+ return GetClangDeclContextForDIE (sc, cu_sp.get(), die);
}
return NULL;
}
@@ -2799,17 +2813,28 @@
}
clang::DeclContext *
-SymbolFileDWARF::GetClangDeclContextForDIEOffset (dw_offset_t die_offset)
+SymbolFileDWARF::GetClangDeclContextContainingDIEOffset (dw_offset_t die_offset)
{
if (die_offset != DW_INVALID_OFFSET)
{
DWARFCompileUnitSP cu_sp;
const DWARFDebugInfoEntry* die = DebugInfo()->GetDIEPtr(die_offset, &cu_sp);
- return GetClangDeclContextForDIE (cu_sp.get(), die);
+ return GetClangDeclContextContainingDIE (cu_sp.get(), die);
}
return NULL;
}
+clang::DeclContext *
+SymbolFileDWARF::GetClangDeclContextForDIEOffset (const SymbolContext &sc, dw_offset_t die_offset)
+{
+ if (die_offset != DW_INVALID_OFFSET)
+ {
+ DWARFCompileUnitSP cu_sp;
+ const DWARFDebugInfoEntry* die = DebugInfo()->GetDIEPtr(die_offset, &cu_sp);
+ return GetClangDeclContextForDIE (sc, cu_sp.get(), die);
+ }
+ return NULL;
+}
clang::NamespaceDecl *
SymbolFileDWARF::ResolveNamespaceDIE (DWARFCompileUnit *curr_cu, const DWARFDebugInfoEntry *die)
@@ -2820,7 +2845,7 @@
if (namespace_name)
{
Declaration decl; // TODO: fill in the decl object
- clang::NamespaceDecl *namespace_decl = GetClangASTContext().GetUniqueNamespaceDeclaration (namespace_name, decl, GetClangDeclContextForDIE (curr_cu, die->GetParent()));
+ clang::NamespaceDecl *namespace_decl = GetClangASTContext().GetUniqueNamespaceDeclaration (namespace_name, decl, GetClangDeclContextContainingDIE (curr_cu, die->GetParent()));
if (namespace_decl)
LinkDeclContextToDIE((clang::DeclContext*)namespace_decl, die);
return namespace_decl;
@@ -2830,12 +2855,36 @@
}
clang::DeclContext *
-SymbolFileDWARF::GetClangDeclContextForDIE (DWARFCompileUnit *curr_cu, const DWARFDebugInfoEntry *die)
+SymbolFileDWARF::GetClangDeclContextForDIE (const SymbolContext &sc, DWARFCompileUnit *curr_cu, const DWARFDebugInfoEntry *die)
+{
+ // If this DIE has a specification, or an abstract origin, then trace to those.
+
+ dw_offset_t die_offset = die->GetAttributeValueAsReference(this, curr_cu, DW_AT_specification, DW_INVALID_OFFSET);
+ if (die_offset != DW_INVALID_OFFSET)
+ return GetClangDeclContextForDIEOffset (sc, die_offset);
+
+ die_offset = die->GetAttributeValueAsReference(this, curr_cu, DW_AT_abstract_origin, DW_INVALID_OFFSET);
+ if (die_offset != DW_INVALID_OFFSET)
+ return GetClangDeclContextForDIEOffset (sc, die_offset);
+
+ // This is the DIE we want. Parse it, then query our map.
+
+ ParseType(sc, curr_cu, die, NULL);
+
+ DIEToDeclContextMap::iterator pos = m_die_to_decl_ctx.find(die);
+ if (pos != m_die_to_decl_ctx.end())
+ return pos->second;
+ else
+ return NULL;
+}
+
+clang::DeclContext *
+SymbolFileDWARF::GetClangDeclContextContainingDIE (DWARFCompileUnit *curr_cu, const DWARFDebugInfoEntry *die)
{
if (m_clang_tu_decl == NULL)
m_clang_tu_decl = GetClangASTContext().getASTContext()->getTranslationUnitDecl();
- //printf ("SymbolFileDWARF::GetClangDeclContextForDIE ( die = 0x%8.8x )\n", die->GetOffset());
+ //printf ("SymbolFileDWARF::GetClangDeclContextContainingDIE ( die = 0x%8.8x )\n", die->GetOffset());
const DWARFDebugInfoEntry * const decl_die = die;
clang::DeclContext *decl_ctx = NULL;
@@ -2849,11 +2898,11 @@
DIEToDeclContextMap::iterator pos = m_die_to_decl_ctx.find(die);
if (pos != m_die_to_decl_ctx.end())
{
- //printf ("SymbolFileDWARF::GetClangDeclContextForDIE ( die = 0x%8.8x ) => 0x%8.8x\n", decl_die->GetOffset(), die->GetOffset());
+ //printf ("SymbolFileDWARF::GetClangDeclContextContainingDIE ( die = 0x%8.8x ) => 0x%8.8x\n", decl_die->GetOffset(), die->GetOffset());
return pos->second;
}
- //printf ("SymbolFileDWARF::GetClangDeclContextForDIE ( die = 0x%8.8x ) checking parent 0x%8.8x\n", decl_die->GetOffset(), die->GetOffset());
+ //printf ("SymbolFileDWARF::GetClangDeclContextContainingDIE ( die = 0x%8.8x ) checking parent 0x%8.8x\n", decl_die->GetOffset(), die->GetOffset());
switch (die->Tag())
{
@@ -2863,10 +2912,10 @@
if (namespace_name)
{
Declaration decl; // TODO: fill in the decl object
- clang::NamespaceDecl *namespace_decl = GetClangASTContext().GetUniqueNamespaceDeclaration (namespace_name, decl, GetClangDeclContextForDIE (curr_cu, die));
+ clang::NamespaceDecl *namespace_decl = GetClangASTContext().GetUniqueNamespaceDeclaration (namespace_name, decl, GetClangDeclContextContainingDIE (curr_cu, die));
if (namespace_decl)
{
- //printf ("SymbolFileDWARF::GetClangDeclContextForDIE ( die = 0x%8.8x ) => 0x%8.8x\n", decl_die->GetOffset(), die->GetOffset());
+ //printf ("SymbolFileDWARF::GetClangDeclContextContainingDIE ( die = 0x%8.8x ) => 0x%8.8x\n", decl_die->GetOffset(), die->GetOffset());
LinkDeclContextToDIE((clang::DeclContext*)namespace_decl, die);
}
return namespace_decl;
@@ -2882,7 +2931,7 @@
pos = m_die_to_decl_ctx.find(die);
if (pos != m_die_to_decl_ctx.end())
{
- //printf ("SymbolFileDWARF::GetClangDeclContextForDIE ( die = 0x%8.8x ) => 0x%8.8x\n", decl_die->GetOffset(), die->GetOffset());
+ //printf ("SymbolFileDWARF::GetClangDeclContextContainingDIE ( die = 0x%8.8x ) => 0x%8.8x\n", decl_die->GetOffset(), die->GetOffset());
return pos->second;
}
else
@@ -2905,8 +2954,8 @@
dw_offset_t die_offset = die->GetAttributeValueAsReference(this, curr_cu, DW_AT_specification, DW_INVALID_OFFSET);
if (die_offset != DW_INVALID_OFFSET)
{
- //printf ("SymbolFileDWARF::GetClangDeclContextForDIE ( die = 0x%8.8x ) check DW_AT_specification 0x%8.8x\n", decl_die->GetOffset(), die_offset);
- decl_ctx = GetClangDeclContextForDIEOffset (die_offset);
+ //printf ("SymbolFileDWARF::GetClangDeclContextContainingDIE ( die = 0x%8.8x ) check DW_AT_specification 0x%8.8x\n", decl_die->GetOffset(), die_offset);
+ decl_ctx = GetClangDeclContextContainingDIEOffset (die_offset);
if (decl_ctx != m_clang_tu_decl)
return decl_ctx;
}
@@ -2914,8 +2963,8 @@
die_offset = die->GetAttributeValueAsReference(this, curr_cu, DW_AT_abstract_origin, DW_INVALID_OFFSET);
if (die_offset != DW_INVALID_OFFSET)
{
- //printf ("SymbolFileDWARF::GetClangDeclContextForDIE ( die = 0x%8.8x ) check DW_AT_abstract_origin 0x%8.8x\n", decl_die->GetOffset(), die_offset);
- decl_ctx = GetClangDeclContextForDIEOffset (die_offset);
+ //printf ("SymbolFileDWARF::GetClangDeclContextContainingDIE ( die = 0x%8.8x ) check DW_AT_abstract_origin 0x%8.8x\n", decl_die->GetOffset(), die_offset);
+ decl_ctx = GetClangDeclContextContainingDIEOffset (die_offset);
if (decl_ctx != m_clang_tu_decl)
return decl_ctx;
}
@@ -2923,7 +2972,7 @@
die = die->GetParent();
}
// Right now we have only one translation unit per module...
- //printf ("SymbolFileDWARF::GetClangDeclContextForDIE ( die = 0x%8.8x ) => 0x%8.8x\n", decl_die->GetOffset(), curr_cu->GetFirstDIEOffset());
+ //printf ("SymbolFileDWARF::GetClangDeclContextContainingDIE ( die = 0x%8.8x ) => 0x%8.8x\n", decl_die->GetOffset(), curr_cu->GetFirstDIEOffset());
return m_clang_tu_decl;
}
@@ -3309,7 +3358,7 @@
clang_type_was_created = true;
clang_type = ast.CreateRecordType (type_name_cstr,
tag_decl_kind,
- GetClangDeclContextForDIE (dwarf_cu, die),
+ GetClangDeclContextContainingDIE (dwarf_cu, die),
class_language);
}
@@ -3417,7 +3466,7 @@
DW_ATE_signed,
byte_size * 8);
clang_type = ast.CreateEnumerationType (type_name_cstr,
- GetClangDeclContextForDIE (dwarf_cu, die),
+ GetClangDeclContextContainingDIE (dwarf_cu, die),
decl,
enumerator_clang_type);
}
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h?rev=136999&r1=136998&r2=136999&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Fri Aug 5 18:43:37 2011
@@ -101,7 +101,8 @@
virtual lldb::clang_type_t ResolveClangOpaqueTypeDefinition (lldb::clang_type_t clang_opaque_type);
virtual lldb_private::Type* ResolveType (DWARFCompileUnit* cu, const DWARFDebugInfoEntry* type_die, bool assert_not_being_parsed = true);
- virtual clang::DeclContext* GetClangDeclContextForTypeUID (lldb::user_id_t type_uid);
+ virtual clang::DeclContext* GetClangDeclContextContainingTypeUID (lldb::user_id_t type_uid);
+ virtual clang::DeclContext* GetClangDeclContextForTypeUID (const lldb_private::SymbolContext &sc, lldb::user_id_t type_uid);
virtual uint32_t ResolveSymbolContext (const lldb_private::Address& so_addr, uint32_t resolve_scope, lldb_private::SymbolContext& sc);
virtual uint32_t ResolveSymbolContext (const lldb_private::FileSpec& file_spec, uint32_t line, bool check_inlines, uint32_t resolve_scope, lldb_private::SymbolContextList& sc_list);
@@ -183,10 +184,16 @@
SupportedVersion(uint16_t version);
clang::DeclContext *
- GetClangDeclContextForDIE (DWARFCompileUnit *cu, const DWARFDebugInfoEntry *die);
+ GetClangDeclContextForDIE (const lldb_private::SymbolContext &sc, DWARFCompileUnit *cu, const DWARFDebugInfoEntry *die);
+
+ clang::DeclContext *
+ GetClangDeclContextForDIEOffset (const lldb_private::SymbolContext &sc, dw_offset_t die_offset);
+
+ clang::DeclContext *
+ GetClangDeclContextContainingDIE (DWARFCompileUnit *cu, const DWARFDebugInfoEntry *die);
clang::DeclContext *
- GetClangDeclContextForDIEOffset (dw_offset_t die_offset);
+ GetClangDeclContextContainingDIEOffset (dw_offset_t die_offset);
void
SearchDeclContext (const clang::DeclContext *decl_context,
Modified: lldb/trunk/source/Symbol/Block.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Block.cpp?rev=136999&r1=136998&r2=136999&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Block.cpp (original)
+++ lldb/trunk/source/Symbol/Block.cpp Fri Aug 5 18:43:37 2011
@@ -11,6 +11,7 @@
#include "lldb/Symbol/Function.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/Section.h"
+#include "lldb/Symbol/SymbolFile.h"
#include "lldb/Symbol/SymbolVendor.h"
#include "lldb/Symbol/VariableList.h"
@@ -535,6 +536,29 @@
return num_variables_added;
}
+clang::DeclContext *
+Block::GetClangDeclContextForInlinedFunction()
+{
+ SymbolContext sc;
+
+ CalculateSymbolContext (&sc);
+
+ if (!sc.module_sp)
+ return NULL;
+
+ SymbolVendor *sym_vendor = sc.module_sp->GetSymbolVendor();
+
+ if (!sym_vendor)
+ return NULL;
+
+ SymbolFile *sym_file = sym_vendor->GetSymbolFile();
+
+ if (!sym_file)
+ return NULL;
+
+ return sym_file->GetClangDeclContextForTypeUID (sc, m_uid);
+}
+
void
Block::SetBlockInfoHasBeenParsed (bool b, bool set_children)
{
Modified: lldb/trunk/source/Symbol/Function.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Function.cpp?rev=136999&r1=136998&r2=136999&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Function.cpp (original)
+++ lldb/trunk/source/Symbol/Function.cpp Fri Aug 5 18:43:37 2011
@@ -14,6 +14,7 @@
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/LineTable.h"
+#include "lldb/Symbol/SymbolFile.h"
#include "lldb/Symbol/SymbolVendor.h"
#include "clang/AST/Type.h"
#include "clang/AST/CanonicalType.h"
@@ -399,6 +400,29 @@
return mem_size;
}
+clang::DeclContext *
+Function::GetClangDeclContext()
+{
+ SymbolContext sc;
+
+ CalculateSymbolContext (&sc);
+
+ if (!sc.module_sp)
+ return NULL;
+
+ SymbolVendor *sym_vendor = sc.module_sp->GetSymbolVendor();
+
+ if (!sym_vendor)
+ return NULL;
+
+ SymbolFile *sym_file = sym_vendor->GetSymbolFile();
+
+ if (!sym_file)
+ return NULL;
+
+ return sym_file->GetClangDeclContextForTypeUID (sc, m_uid);
+}
+
Type*
Function::GetType()
{
Modified: lldb/trunk/source/Symbol/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Type.cpp?rev=136999&r1=136998&r2=136999&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Type.cpp (original)
+++ lldb/trunk/source/Symbol/Type.cpp Fri Aug 5 18:43:37 2011
@@ -640,7 +640,7 @@
assert(typedef_type && base_type);
return GetClangASTContext().CreateTypedefType (typedef_type->GetName().AsCString(),
base_type->GetClangForwardType(),
- typedef_type->GetSymbolFile()->GetClangDeclContextForTypeUID(typedef_type->GetID()));
+ typedef_type->GetSymbolFile()->GetClangDeclContextContainingTypeUID(typedef_type->GetID()));
}
void *
Added: lldb/trunk/test/lang/cpp/this/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/this/Makefile?rev=136999&view=auto
==============================================================================
--- lldb/trunk/test/lang/cpp/this/Makefile (added)
+++ lldb/trunk/test/lang/cpp/this/Makefile Fri Aug 5 18:43:37 2011
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules
Added: lldb/trunk/test/lang/cpp/this/TestCPPThis.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/this/TestCPPThis.py?rev=136999&view=auto
==============================================================================
--- lldb/trunk/test/lang/cpp/this/TestCPPThis.py (added)
+++ lldb/trunk/test/lang/cpp/this/TestCPPThis.py Fri Aug 5 18:43:37 2011
@@ -0,0 +1,67 @@
+"""
+Tests that C++ member and static variables are available where they should be.
+"""
+
+from lldbtest import *
+
+class CPPThisTestCase(TestBase):
+
+ mydir = os.path.join("lang", "cpp", "this")
+
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ def test_with_dsym_and_run_command(self):
+ """Test that the appropriate member variables are available when stopped in C++ static, inline, and const methods"""
+ self.buildDsym()
+ self.static_method_commands()
+
+ def test_with_dwarf_and_run_command(self):
+ """Test that the appropriate member variables are available when stopped in C++ static, inline, and const methods"""
+ self.buildDwarf()
+ self.static_method_commands()
+
+ def setUp(self):
+ TestBase.setUp(self)
+
+ def set_breakpoint(self, line):
+ self.expect("breakpoint set -f main.cpp -l %d" % line,
+ BREAKPOINT_CREATED,
+ startstr = "Breakpoint created")
+
+ def static_method_commands(self):
+ """Test that the appropriate member variables are available when stopped in C++ static, inline, and const methods"""
+ self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
+
+ self.set_breakpoint(line_number('main.cpp', '// breakpoint 1'))
+ self.set_breakpoint(line_number('main.cpp', '// breakpoint 2'))
+ self.set_breakpoint(line_number('main.cpp', '// breakpoint 3'))
+ self.set_breakpoint(line_number('main.cpp', '// breakpoint 4'))
+
+ self.runCmd("process launch", RUN_SUCCEEDED)
+
+ self.expect("expression -- m_a = 2",
+ startstr = "(int) $0 = 2")
+
+ self.runCmd("process continue")
+
+ # This would be disallowed if we enforced const. But we don't.
+ self.expect("expression -- m_a = 2",
+ startstr = "(int) $1 = 2")
+
+ self.expect("expression -- m_a",
+ startstr = "(int) $2 = 2")
+
+ self.runCmd("process continue")
+
+ self.expect("expression -- s_a",
+ startstr = "(int) $3 = 5")
+
+ self.runCmd("process continue")
+
+ self.expect("expression -- m_a",
+ startstr = "(int) $4 = 2")
+
+if __name__ == '__main__':
+ import atexit
+ lldb.SBDebugger.Initialize()
+ atexit.register(lambda: lldb.SBDebugger.Terminate())
+ unittest2.main()
Added: lldb/trunk/test/lang/cpp/this/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/this/main.cpp?rev=136999&view=auto
==============================================================================
--- lldb/trunk/test/lang/cpp/this/main.cpp (added)
+++ lldb/trunk/test/lang/cpp/this/main.cpp Fri Aug 5 18:43:37 2011
@@ -0,0 +1,53 @@
+//===-- main.cpp ------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include
+
+class A
+{
+public:
+ void accessMember(int a);
+ int accessMemberConst() const;
+ static int accessStaticMember();
+
+ int accessMemberInline(int a) __attribute__ ((always_inline))
+ {
+ m_a = a; // breakpoint 4
+ }
+
+ int m_a;
+ static int s_a;
+};
+
+int A::s_a = 5;
+
+void A::accessMember(int a)
+{
+ m_a = a; // breakpoint 1
+}
+
+int A::accessMemberConst() const
+{
+ return m_a; // breakpoint 2
+}
+
+int A::accessStaticMember()
+{
+ return s_a; // breakpoint 3
+}
+
+int main()
+{
+ A my_a;
+
+ my_a.accessMember(3);
+ my_a.accessMemberConst();
+ A::accessStaticMember();
+ my_a.accessMemberInline(5);
+}
Added: lldb/trunk/test/lang/objc/self/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/self/Makefile?rev=136999&view=auto
==============================================================================
--- lldb/trunk/test/lang/objc/self/Makefile (added)
+++ lldb/trunk/test/lang/objc/self/Makefile Fri Aug 5 18:43:37 2011
@@ -0,0 +1,6 @@
+LEVEL = ../../../make
+
+OBJC_SOURCES := main.m
+LDFLAGS := $(CFLAGS) -lobjc -framework Foundation
+
+include $(LEVEL)/Makefile.rules
Added: lldb/trunk/test/lang/objc/self/TestObjCSelf.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/self/TestObjCSelf.py?rev=136999&view=auto
==============================================================================
--- lldb/trunk/test/lang/objc/self/TestObjCSelf.py (added)
+++ lldb/trunk/test/lang/objc/self/TestObjCSelf.py Fri Aug 5 18:43:37 2011
@@ -0,0 +1,55 @@
+"""
+Tests that ObjC member variables are available where they should be.
+"""
+
+from lldbtest import *
+
+class ObjCSelfTestCase(TestBase):
+
+ mydir = os.path.join("lang", "objc", "self")
+
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ def test_with_dsym_and_run_command(self):
+ """Test that the appropriate member variables are available when stopped in Objective-C class and instance methods"""
+ self.buildDsym()
+ self.self_commands()
+
+ def test_with_dwarf_and_run_command(self):
+ """Test that the appropriate member variables are available when stopped in Objective-C class and instance methods"""
+ self.buildDwarf()
+ self.self_commands()
+
+ def setUp(self):
+ TestBase.setUp(self)
+
+ def set_breakpoint(self, line):
+ self.expect("breakpoint set -f main.m -l %d" % line,
+ BREAKPOINT_CREATED,
+ startstr = "Breakpoint created")
+
+ def self_commands(self):
+ """Test that the appropriate member variables are available when stopped in Objective-C class and instance methods"""
+ self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
+
+ self.set_breakpoint(line_number('main.m', '// breakpoint 1'))
+ self.set_breakpoint(line_number('main.m', '// breakpoint 2'))
+
+ self.runCmd("process launch", RUN_SUCCEEDED)
+
+ self.expect("expression -- m_a = 2",
+ startstr = "(int) $0 = 2")
+
+ self.runCmd("process continue")
+
+ # This would be disallowed if we enforced const. But we don't.
+ self.expect("expression -- m_a = 2",
+ error=True)
+
+ self.expect("expression -- s_a",
+ startstr = "(int) $1 = 5")
+
+if __name__ == '__main__':
+ import atexit
+ lldb.SBDebugger.Initialize()
+ atexit.register(lambda: lldb.SBDebugger.Terminate())
+ unittest2.main()
Added: lldb/trunk/test/lang/objc/self/main.m
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/self/main.m?rev=136999&view=auto
==============================================================================
--- lldb/trunk/test/lang/objc/self/main.m (added)
+++ lldb/trunk/test/lang/objc/self/main.m Fri Aug 5 18:43:37 2011
@@ -0,0 +1,52 @@
+//===-- main.m ------------------------------------------*- Objective-C -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#import
+
+ at interface A : NSObject
+{
+ int m_a;
+}
+-(id)init;
+-(void)accessMember:(int)a;
++(int)accessStaticMember:(int)a;
+ at end
+
+static int s_a = 5;
+
+ at implementation A
+-(id)init
+{
+ self = [super init];
+
+ if (self)
+ m_a = 2;
+}
+
+-(void)accessMember:(int)a
+{
+ m_a = a; // breakpoint 1
+}
+
++(int)accessStaticMember:(int)a
+{
+ s_a = a; // breakpoint 2
+}
+ at end
+
+int main()
+{
+ NSAutoreleasePool *pool = [NSAutoreleasePool alloc];
+ A *my_a = [[A alloc] init];
+
+ [my_a accessMember:3];
+ [A accessStaticMember:5];
+
+ [pool release];
+}
\ No newline at end of file
From scallanan at apple.com Fri Aug 5 19:28:14 2011
From: scallanan at apple.com (Sean Callanan)
Date: Sat, 06 Aug 2011 00:28:14 -0000
Subject: [Lldb-commits] [lldb] r137004 - in /lldb/trunk:
source/Expression/ClangExpressionDeclMap.cpp
test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py
Message-ID: <20110806002814.C56F22A6C12C@llvm.org>
Author: spyffe
Date: Fri Aug 5 19:28:14 2011
New Revision: 137004
URL: http://llvm.org/viewvc/llvm-project?rev=137004&view=rev
Log:
Made the expression parser use the StackFrame's
variable search API rather than rolling its own,
fixing one of our testcases.
Modified:
lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
lldb/trunk/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py
Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=137004&r1=137003&r2=137004&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Fri Aug 5 19:28:14 2011
@@ -1572,40 +1572,18 @@
{
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
- VariableList *var_list = frame.GetVariableList(true);
-
- if (!var_list)
- return lldb::VariableSP();
+ ValueObjectSP valobj;
+ VariableSP var_sp;
+ Error err;
- lldb::VariableSP var_sp (var_list->FindVariable(name));
+ valobj = frame.GetValueForVariableExpressionPath(name.GetCString(),
+ eNoDynamicValues,
+ StackFrame::eExpressionPathOptionCheckPtrVsMember,
+ var_sp,
+ err);
- const bool append = true;
- const uint32_t max_matches = 1;
- if (!var_sp)
- {
- // Look for globals elsewhere in the module for the frame
- ModuleSP module_sp (frame.GetSymbolContext(eSymbolContextModule).module_sp);
- if (module_sp)
- {
- VariableList module_globals;
- if (module_sp->FindGlobalVariables (name, append, max_matches, module_globals))
- var_sp = module_globals.GetVariableAtIndex (0);
- }
- }
-
- if (!var_sp)
- {
- // Look for globals elsewhere in the program (all images)
- TargetSP target_sp (frame.GetSymbolContext(eSymbolContextTarget).target_sp);
- if (target_sp)
- {
- VariableList program_globals;
- if (target_sp->GetImages().FindGlobalVariables (name, append, max_matches, program_globals))
- var_sp = program_globals.GetVariableAtIndex (0);
- }
- }
-
- if (!var_sp ||
+ if (!err.Success() ||
+ !var_sp ||
!var_sp->IsInScope(&frame) ||
!var_sp->LocationIsValidForFrame (&frame))
return lldb::VariableSP();
@@ -1745,10 +1723,18 @@
// doesn't start with our phony prefix of '$'
if (name_unique_cstr[0] != '$')
{
- VariableSP var = FindVariableInScope(*m_parser_vars->m_exe_ctx->frame, name);
+ ValueObjectSP valobj;
+ VariableSP var;
+ Error err;
+
+ valobj = m_parser_vars->m_exe_ctx->frame->GetValueForVariableExpressionPath(name_unique_cstr,
+ eNoDynamicValues,
+ StackFrame::eExpressionPathOptionCheckPtrVsMember,
+ var,
+ err);
// If we found a variable in scope, no need to pull up function names
- if (var != NULL)
+ if (err.Success() && var != NULL)
{
AddOneVariable(context, var);
}
Modified: lldb/trunk/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py?rev=137004&r1=137003&r2=137004&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py (original)
+++ lldb/trunk/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py Fri Aug 5 19:28:14 2011
@@ -15,7 +15,6 @@
self.line_to_break = line_number(self.source, '// Set breakpoint here.')
# rdar://problem/9890530
- @unittest2.expectedFailure
def test_eval_index_variable(self):
"""Test expressions of variable 'i' which appears in two for loops."""
self.buildDefault()
From gclayton at apple.com Fri Aug 5 19:50:36 2011
From: gclayton at apple.com (Greg Clayton)
Date: Sat, 06 Aug 2011 00:50:36 -0000
Subject: [Lldb-commits] [lldb] r137008 -
/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
Message-ID: <20110806005036.EFD9E2A6C12C@llvm.org>
Author: gclayton
Date: Fri Aug 5 19:50:36 2011
New Revision: 137008
URL: http://llvm.org/viewvc/llvm-project?rev=137008&view=rev
Log:
Fixed a loop that I was testing changes with and forgot
to revert to zero.
Modified:
lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp?rev=137008&r1=137007&r2=137008&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp Fri Aug 5 19:50:36 2011
@@ -958,7 +958,7 @@
ModuleList &modules = target.GetImages();
ModuleList not_loaded_modules;
size_t num_modules = modules.GetSize();
- for (size_t i = 1; i < num_modules; i++)
+ for (size_t i = 0; i < num_modules; i++)
{
ModuleSP module_sp = modules.GetModuleAtIndex(i);
if (!module_sp->IsLoadedInTarget (&target))