From gclayton at apple.com Mon Nov 7 16:45:39 2011
From: gclayton at apple.com (Greg Clayton)
Date: Mon, 07 Nov 2011 22:45:39 -0000
Subject: [Lldb-commits] [lldb] r144030 - in /lldb/trunk:
lldb.xcodeproj/project.pbxproj
tools/debugserver/debugserver.xcodeproj/project.pbxproj
Message-ID: <20111107224539.8DAD42A6C12C@llvm.org>
Author: gclayton
Date: Mon Nov 7 16:45:39 2011
New Revision: 144030
URL: http://llvm.org/viewvc/llvm-project?rev=144030&view=rev
Log:
Xcode project changes to install "lldb" into "/usr/bin" and have LLDB.framework
in "/System/Library/PrivateFrameworks", and also have "lldb" in the Xcode.app
and the LLDB.framework in Xcode.app as well.
Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj
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=144030&r1=144029&r2=144030&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Mon Nov 7 16:45:39 2011
@@ -2906,6 +2906,7 @@
26680205115FD0ED008E1FE4 /* Frameworks */,
261B5A7511C3FA6F00AABD0A /* Fixup Framework Headers */,
9A19ACE2116563A700E0D453 /* Finish swig wrapper classes (lldb) */,
+ 2613F2F2146880EE00BFE551 /* Copy to Xcode.app */,
);
buildRules = (
);
@@ -2961,6 +2962,7 @@
buildPhases = (
26F5C26710F3D9A4009D5894 /* Sources */,
26F5C26810F3D9A4009D5894 /* Frameworks */,
+ 2613F2F1146880C200BFE551 /* Copy to Xcode.app */,
);
buildRules = (
);
@@ -3032,6 +3034,34 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
+ 2613F2F1146880C200BFE551 /* Copy to Xcode.app */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 8;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "Copy to Xcode.app";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ shellPath = /bin/sh;
+ shellScript = "xcode_dir=\"${DSTROOT}/Applications/Xcode.app/Contents/Developer/usr/bin\"\n\nif [ ! -d \"${xcode_dir}\" ]; then\n mkdir -p \"${xcode_dir}\"\nfi\n\nditto \"$TARGET_BUILD_DIR/$EXECUTABLE_PATH\" \"${xcode_dir}\"\n";
+ };
+ 2613F2F2146880EE00BFE551 /* Copy to Xcode.app */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 8;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "Copy to Xcode.app";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ shellPath = "/bin/sh -x";
+ shellScript = "xcode_dir=\"${DSTROOT}/Applications/Xcode.app/Contents/SharedFrameworks\"\n\nif [ ! -d \"${xcode_dir}\" ]; then\n mkdir -p \"${xcode_dir}\"\nfi\n\nditto \"${TARGET_BUILD_DIR}/${WRAPPER_NAME}\" \"${xcode_dir}/${WRAPPER_NAME}\"\n";
+ };
261B5A7511C3FA6F00AABD0A /* Fixup Framework Headers */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@@ -3660,6 +3690,7 @@
INSTALL_PATH = "$(DEVELOPER_DIR)/usr/bin";
ONLY_ACTIVE_ARCH = NO;
PRODUCT_NAME = "darwin-debug";
+ SKIP_INSTALL = YES;
};
name = Debug;
};
@@ -3672,6 +3703,7 @@
INSTALL_PATH = "$(DEVELOPER_DIR)/usr/bin";
ONLY_ACTIVE_ARCH = NO;
PRODUCT_NAME = "darwin-debug";
+ SKIP_INSTALL = YES;
};
name = Release;
};
@@ -3683,6 +3715,7 @@
INSTALL_PATH = "$(DEVELOPER_DIR)/usr/bin";
ONLY_ACTIVE_ARCH = NO;
PRODUCT_NAME = "darwin-debug";
+ SKIP_INSTALL = YES;
};
name = BuildAndIntegration;
};
@@ -3705,7 +3738,7 @@
GCC_OPTIMIZATION_LEVEL = 0;
HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = "resources/LLDB-Info.plist";
- INSTALL_PATH = "$(DEVELOPER_DIR)/Library/PrivateFrameworks";
+ INSTALL_PATH = /System/Library/PrivateFrameworks;
LD_DYLIB_INSTALL_NAME = "@rpath/LLDB.framework/Versions/A/LLDB";
LIBRARY_SEARCH_PATHS = (
"$(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)",
@@ -3766,7 +3799,7 @@
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = "resources/LLDB-Info.plist";
- INSTALL_PATH = "$(DEVELOPER_DIR)/Library/PrivateFrameworks";
+ INSTALL_PATH = /System/Library/PrivateFrameworks;
LD_DYLIB_INSTALL_NAME = "@rpath/LLDB.framework/Versions/A/LLDB";
LIBRARY_SEARCH_PATHS = (
"$(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)",
@@ -3831,6 +3864,7 @@
);
OTHER_LDFLAGS = "";
PRODUCT_NAME = "lib$(TARGET_NAME)";
+ SKIP_INSTALL = YES;
STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = static;
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/include $(SRCROOT)/source $(LLVM_SOURCE_DIR)/include $(LLVM_SOURCE_DIR)/tools/clang/include $(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/include $(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/tools/clang/include";
VERSIONING_SYSTEM = "apple-generic";
@@ -3860,6 +3894,7 @@
);
OTHER_LDFLAGS = "";
PRODUCT_NAME = "lib$(TARGET_NAME)";
+ SKIP_INSTALL = YES;
STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = static;
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/include $(SRCROOT)/source $(LLVM_SOURCE_DIR)/include $(LLVM_SOURCE_DIR)/tools/clang/include $(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/include $(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/tools/clang/include";
VERSIONING_SYSTEM = "apple-generic";
@@ -3889,6 +3924,7 @@
);
OTHER_LDFLAGS = "";
PRODUCT_NAME = "lib$(TARGET_NAME)";
+ SKIP_INSTALL = YES;
STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = static;
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/include $(SRCROOT)/source $(LLVM_SOURCE_DIR)/include $(LLVM_SOURCE_DIR)/tools/clang/include $(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/include $(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/tools/clang/include";
VERSIONING_SYSTEM = "apple-generic";
@@ -3956,14 +3992,15 @@
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = "lldb-Info.plist";
- INSTALL_PATH = "$(DEVELOPER_DIR)/usr/bin";
+ INSTALL_PATH = /usr/bin;
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = (
"-sectcreate",
__TEXT,
__info_plist,
"$(PROJECT_DIR)/tools/driver/lldb-Info.plist",
- "-Wl,-rpath, at loader_path/../../Library/PrivateFrameworks/",
+ "-Wl,-rpath, at loader_path/../../../SharedFrameworks",
+ "-Wl,-rpath, at loader_path/../../System/Library/PrivateFrameworks",
);
PRODUCT_NAME = lldb;
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/include $(SRCROOT)/source $(LLVM_SOURCE_DIR)/include $(LLVM_SOURCE_DIR)/tools/clang/include $(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/include $(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/tools/clang/include";
@@ -3990,7 +4027,7 @@
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = "resources/LLDB-Info.plist";
- INSTALL_PATH = "$(DEVELOPER_DIR)/Library/PrivateFrameworks";
+ INSTALL_PATH = /System/Library/PrivateFrameworks;
LD_DYLIB_INSTALL_NAME = "@rpath/LLDB.framework/Versions/A/LLDB";
LIBRARY_SEARCH_PATHS = (
"$(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)",
@@ -4092,6 +4129,7 @@
);
PRODUCT_NAME = "lldb-platform";
PROVISIONING_PROFILE = "";
+ SKIP_INSTALL = YES;
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/include $(SRCROOT)/source $(LLVM_SOURCE_DIR)/include $(LLVM_SOURCE_DIR)/tools/clang/include $(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/include $(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/tools/clang/include";
};
name = Debug;
@@ -4154,6 +4192,7 @@
);
PRODUCT_NAME = "lldb-platform";
PROVISIONING_PROFILE = "";
+ SKIP_INSTALL = YES;
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/include $(SRCROOT)/source $(LLVM_SOURCE_DIR)/include $(LLVM_SOURCE_DIR)/tools/clang/include $(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/include $(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/tools/clang/include";
};
name = Release;
@@ -4212,6 +4251,7 @@
UIKit,
);
PRODUCT_NAME = "lldb-platform";
+ SKIP_INSTALL = YES;
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/include $(SRCROOT)/source $(LLVM_SOURCE_DIR)/include $(LLVM_SOURCE_DIR)/tools/clang/include $(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/include $(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/tools/clang/include";
};
name = BuildAndIntegration;
@@ -4231,7 +4271,7 @@
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = "lldb-Info.plist";
- INSTALL_PATH = "$(DEVELOPER_DIR)/usr/bin";
+ INSTALL_PATH = /usr/bin;
LIBRARY_SEARCH_PATHS = "$(inherited)";
LLVM_BUILD_DIR_ARCH = "$(OBJROOT)/llvm";
OTHER_LDFLAGS = (
@@ -4260,7 +4300,7 @@
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = "lldb-Info.plist";
- INSTALL_PATH = "$(DEVELOPER_DIR)/usr/bin";
+ INSTALL_PATH = /usr/bin;
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = (
"-sectcreate",
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=144030&r1=144029&r2=144030&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj Mon Nov 7 16:45:39 2011
@@ -543,9 +543,9 @@
);
"FRAMEWORK_SEARCH_PATHS[sdk=macosx*][arch=*]" = "$(SDKROOT)/System/Library/PrivateFrameworks";
GCC_PREPROCESSOR_DEFINITIONS = LLDB_DEBUGSERVER_BUILDANDINTEGRATION;
- GCC_VERSION = com.apple.compilers.llvmgcc42;
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders;
- INSTALL_PATH = /Developer/usr/bin;
+ INSTALL_PATH = /usr/bin;
LLDB_DEBUGSERVER = 1;
OTHER_CFLAGS = "-Wparentheses";
OTHER_LDFLAGS = (
@@ -563,6 +563,7 @@
);
OTHER_MIGFLAGS = "-I$(DERIVED_FILE_DIR)";
PRODUCT_NAME = debugserver;
+ SKIP_INSTALL = YES;
STRIP_INSTALLED_PRODUCT = YES;
USER_HEADER_SEARCH_PATHS = "./source ../../source $(DERIVED_SOURCES_DIR)";
ZERO_LINK = NO;
@@ -586,8 +587,8 @@
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = LLDB_DEBUGSERVER_DEBUG;
- GCC_VERSION = com.apple.compilers.llvmgcc42;
- INSTALL_PATH = /Developer/usr/bin;
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ INSTALL_PATH = /usr/bin;
LLDB_DEBUGSERVER = 1;
OTHER_CFLAGS = "-Wparentheses";
OTHER_LDFLAGS = (
@@ -606,6 +607,7 @@
OTHER_MIGFLAGS = "-I$(DERIVED_FILE_DIR)";
PRODUCT_NAME = debugserver;
"PROVISIONING_PROFILE[sdk=macosx*]" = "";
+ SKIP_INSTALL = YES;
USER_HEADER_SEARCH_PATHS = "./source ../../source $(DERIVED_SOURCES_DIR)";
ZERO_LINK = NO;
};
@@ -627,9 +629,9 @@
);
"FRAMEWORK_SEARCH_PATHS[sdk=macosx*][arch=*]" = "$(SDKROOT)/System/Library/PrivateFrameworks";
GCC_PREPROCESSOR_DEFINITIONS = LLDB_DEBUGSERVER_RELEASE;
- GCC_VERSION = com.apple.compilers.llvmgcc42;
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders;
- INSTALL_PATH = /Developer/usr/bin;
+ INSTALL_PATH = /usr/bin;
LLDB_DEBUGSERVER = 1;
OTHER_CFLAGS = "-Wparentheses";
OTHER_LDFLAGS = (
@@ -648,6 +650,7 @@
OTHER_MIGFLAGS = "-I$(DERIVED_FILE_DIR)";
PRODUCT_NAME = debugserver;
"PROVISIONING_PROFILE[sdk=macosx*]" = "";
+ SKIP_INSTALL = YES;
USER_HEADER_SEARCH_PATHS = "./source ../../source $(DERIVED_SOURCES_DIR)";
ZERO_LINK = NO;
};
From gclayton at apple.com Mon Nov 7 16:50:17 2011
From: gclayton at apple.com (Greg Clayton)
Date: Mon, 07 Nov 2011 22:50:17 -0000
Subject: [Lldb-commits] [lldb] r144032 - in /lldb/trunk:
lldb.xcodeproj/project.pbxproj resources/LLDB-Info.plist
tools/debugserver/debugserver.xcodeproj/project.pbxproj
Message-ID: <20111107225017.E59EF2A6C12C@llvm.org>
Author: gclayton
Date: Mon Nov 7 16:50:17 2011
New Revision: 144032
URL: http://llvm.org/viewvc/llvm-project?rev=144032&view=rev
Log:
Bumped Xcode project version for lldb-86 and debugserver-151
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=144032&r1=144031&r2=144032&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Mon Nov 7 16:50:17 2011
@@ -3724,9 +3724,9 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 85;
+ CURRENT_PROJECT_VERSION = 86;
DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 85;
+ DYLIB_CURRENT_VERSION = 86;
EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -3785,10 +3785,10 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 85;
+ CURRENT_PROJECT_VERSION = 86;
DEAD_CODE_STRIPPING = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 85;
+ DYLIB_CURRENT_VERSION = 86;
EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -3845,8 +3845,8 @@
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 85;
- DYLIB_CURRENT_VERSION = 85;
+ CURRENT_PROJECT_VERSION = 86;
+ DYLIB_CURRENT_VERSION = 86;
EXECUTABLE_EXTENSION = a;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -3875,8 +3875,8 @@
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 85;
- DYLIB_CURRENT_VERSION = 85;
+ CURRENT_PROJECT_VERSION = 86;
+ DYLIB_CURRENT_VERSION = 86;
EXECUTABLE_EXTENSION = a;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -3905,8 +3905,8 @@
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 85;
- DYLIB_CURRENT_VERSION = 85;
+ CURRENT_PROJECT_VERSION = 86;
+ DYLIB_CURRENT_VERSION = 86;
EXECUTABLE_EXTENSION = a;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -3983,7 +3983,7 @@
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 85;
+ CURRENT_PROJECT_VERSION = 86;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"",
@@ -4013,10 +4013,10 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 85;
+ CURRENT_PROJECT_VERSION = 86;
DEAD_CODE_STRIPPING = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 85;
+ DYLIB_CURRENT_VERSION = 86;
EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -4260,7 +4260,7 @@
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 85;
+ CURRENT_PROJECT_VERSION = 86;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"",
@@ -4291,7 +4291,7 @@
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 85;
+ CURRENT_PROJECT_VERSION = 86;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"",
Modified: lldb/trunk/resources/LLDB-Info.plist
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/resources/LLDB-Info.plist?rev=144032&r1=144031&r2=144032&view=diff
==============================================================================
--- lldb/trunk/resources/LLDB-Info.plist (original)
+++ lldb/trunk/resources/LLDB-Info.plist Mon Nov 7 16:50:17 2011
@@ -17,7 +17,7 @@
CFBundleSignature
????
CFBundleVersion
- 85
+ 86
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=144032&r1=144031&r2=144032&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj Mon Nov 7 16:50:17 2011
@@ -475,7 +475,7 @@
i386,
);
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 150;
+ CURRENT_PROJECT_VERSION = 151;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
SDKROOT = "";
@@ -494,7 +494,7 @@
x86_64,
i386,
);
- CURRENT_PROJECT_VERSION = 150;
+ CURRENT_PROJECT_VERSION = 151;
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 = 150;
+ CURRENT_PROJECT_VERSION = 151;
DEAD_CODE_STRIPPING = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
@@ -534,7 +534,7 @@
"ARCHS[sdk=iphoneos*]" = "$(ARCHS_STANDARD_32_BIT)";
"CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist";
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 150;
+ CURRENT_PROJECT_VERSION = 151;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks;
"FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = (
@@ -577,7 +577,7 @@
"CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = lldb_codesign;
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 150;
+ CURRENT_PROJECT_VERSION = 151;
FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks;
"FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = (
"$(SDKROOT)/System/Library/PrivateFrameworks",
@@ -620,7 +620,7 @@
"CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = lldb_codesign;
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 150;
+ CURRENT_PROJECT_VERSION = 151;
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 Nov 7 16:50:42 2011
From: gclayton at apple.com (Greg Clayton)
Date: Mon, 07 Nov 2011 22:50:42 -0000
Subject: [Lldb-commits] [lldb] r144033 - /lldb/tags/lldb-86/
Message-ID: <20111107225042.892952A6C12C@llvm.org>
Author: gclayton
Date: Mon Nov 7 16:50:42 2011
New Revision: 144033
URL: http://llvm.org/viewvc/llvm-project?rev=144033&view=rev
Log:
lldb-86
Added:
lldb/tags/lldb-86/
- copied from r144032, lldb/trunk/
From granata.enrico at gmail.com Mon Nov 7 16:57:04 2011
From: granata.enrico at gmail.com (Enrico Granata)
Date: Mon, 07 Nov 2011 22:57:04 -0000
Subject: [Lldb-commits] [lldb] r144035 - in /lldb/trunk: include/lldb/
include/lldb/Interpreter/ source/Commands/ source/Interpreter/
test/functionalities/command_script/
test/functionalities/command_script/import/
Message-ID: <20111107225704.B64A33524001@llvm.org>
Author: enrico
Date: Mon Nov 7 16:57:04 2011
New Revision: 144035
URL: http://llvm.org/viewvc/llvm-project?rev=144035&view=rev
Log:
this patch addresses several issues with "command script" subcommands:
a) adds a new --synchronicity (-s) setting for "command script add" that allows the user to decide if scripted commands should run synchronously or asynchronously (which can make a difference in how events are handled)
b) clears up several error messages
c) adds a new --allow-reload (-r) setting for "command script import" that allows the user to reload a module even if it has already been imported before
d) allows filename completion for "command script import" (much like what happens for "target create")
e) prevents "command script add" from replacing built-in commands with scripted commands
f) changes AddUserCommand() to take an std::string instead of a const char* (for performance reasons)
plus, it fixes an issue in "type summary add" command handling which caused several test suite errors
Added:
lldb/trunk/test/functionalities/command_script/mysto.py
Modified:
lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h
lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h
lldb/trunk/include/lldb/lldb-enumerations.h
lldb/trunk/include/lldb/lldb-private-enumerations.h
lldb/trunk/source/Commands/CommandObjectCommands.cpp
lldb/trunk/source/Commands/CommandObjectType.cpp
lldb/trunk/source/Interpreter/CommandInterpreter.cpp
lldb/trunk/source/Interpreter/CommandObject.cpp
lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
lldb/trunk/test/functionalities/command_script/TestCommandScript.py
lldb/trunk/test/functionalities/command_script/import/TestImport.py
lldb/trunk/test/functionalities/command_script/main.cpp
lldb/trunk/test/functionalities/command_script/py_import
lldb/trunk/test/functionalities/command_script/welcome.py
Modified: lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h?rev=144035&r1=144034&r2=144035&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h Mon Nov 7 16:57:04 2011
@@ -72,7 +72,7 @@
bool can_replace);
bool
- AddUserCommand (const char *name,
+ AddUserCommand (std::string name,
const lldb::CommandObjectSP &cmd_sp,
bool can_replace);
Modified: lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h?rev=144035&r1=144034&r2=144035&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h (original)
+++ lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h Mon Nov 7 16:57:04 2011
@@ -73,8 +73,7 @@
eScriptReturnTypeChar,
eScriptReturnTypeCharStrOrNone
} ScriptReturnType;
-
-
+
ScriptInterpreter (CommandInterpreter &interpreter, lldb::ScriptLanguage script_lang);
virtual ~ScriptInterpreter ();
@@ -185,6 +184,7 @@
virtual bool
RunScriptBasedCommand (const char* impl_function,
const char* args,
+ ScriptedCommandSynchronicity synchronicity,
lldb_private::CommandReturnObject& cmd_retobj,
Error& error)
{
@@ -199,6 +199,7 @@
virtual bool
LoadScriptingModule (const char* filename,
+ bool can_reload,
lldb_private::Error& error)
{
error.SetErrorString("loading unimplemented");
Modified: lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h?rev=144035&r1=144034&r2=144035&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h (original)
+++ lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h Mon Nov 7 16:57:04 2011
@@ -87,6 +87,7 @@
virtual bool
RunScriptBasedCommand(const char* impl_function,
const char* args,
+ ScriptedCommandSynchronicity synchronicity,
lldb_private::CommandReturnObject& cmd_retobj,
Error& error);
@@ -118,6 +119,7 @@
virtual bool
LoadScriptingModule (const char* filename,
+ bool can_reload,
lldb_private::Error& error);
void
@@ -170,6 +172,18 @@
private:
+ class SynchronicityHandler
+ {
+ private:
+ lldb::DebuggerSP m_debugger_sp;
+ ScriptedCommandSynchronicity m_synch_wanted;
+ bool m_old_asynch;
+ public:
+ SynchronicityHandler(lldb::DebuggerSP,
+ ScriptedCommandSynchronicity);
+ ~SynchronicityHandler();
+ };
+
class Locker
{
public:
Modified: lldb/trunk/include/lldb/lldb-enumerations.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-enumerations.h?rev=144035&r1=144034&r2=144035&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-enumerations.h (original)
+++ lldb/trunk/include/lldb/lldb-enumerations.h Mon Nov 7 16:57:04 2011
@@ -390,6 +390,7 @@
eArgTypeRegularExpression,
eArgTypeRunArgs,
eArgTypeRunMode,
+ eArgTypeScriptedCommandSynchronicity,
eArgTypeScriptLang,
eArgTypeSearchWord,
eArgTypeSelector,
Modified: lldb/trunk/include/lldb/lldb-private-enumerations.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-private-enumerations.h?rev=144035&r1=144034&r2=144035&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-private-enumerations.h (original)
+++ lldb/trunk/include/lldb/lldb-private-enumerations.h Mon Nov 7 16:57:04 2011
@@ -238,7 +238,17 @@
eFormatterChoiceCriterionStrippedBitField = 0x00000020
} FormatterChoiceCriterion;
-} // namespace lldb
+//----------------------------------------------------------------------
+// Synchronicity behavior of scripted commands
+//----------------------------------------------------------------------
+typedef enum ScriptedCommandSynchronicity
+{
+ eScriptedCommandSynchronicitySynchronous,
+ eScriptedCommandSynchronicityAsynchronous,
+ eScriptedCommandSynchronicityCurrentValue // use whatever the current synchronicity is
+} ScriptedCommandSynchronicity;
+
+} // namespace lldb_private
#endif // LLDB_lldb_private_enumerations_h_
Modified: lldb/trunk/source/Commands/CommandObjectCommands.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCommands.cpp?rev=144035&r1=144034&r2=144035&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectCommands.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectCommands.cpp Mon Nov 7 16:57:04 2011
@@ -1153,17 +1153,20 @@
{
private:
std::string m_function_name;
+ ScriptedCommandSynchronicity m_synchro;
public:
CommandObjectPythonFunction (CommandInterpreter &interpreter,
std::string name,
- std::string funct) :
+ std::string funct,
+ ScriptedCommandSynchronicity synch) :
CommandObject (interpreter,
name.c_str(),
(std::string("Run Python function ") + funct).c_str(),
NULL),
- m_function_name(funct)
+ m_function_name(funct),
+ m_synchro(synch)
{
ScriptInterpreter* scripter = m_interpreter.GetScriptInterpreter();
if (scripter)
@@ -1188,6 +1191,7 @@
if (!scripter || scripter->RunScriptBasedCommand(m_function_name.c_str(),
raw_command_line,
+ m_synchro,
result,
error) == false)
{
@@ -1205,7 +1209,7 @@
{
return true;
}
-
+
bool
Execute (Args& command,
CommandReturnObject &result)
@@ -1214,9 +1218,24 @@
command.GetCommandString(cmd_string);
return ExecuteRawCommandString(cmd_string.c_str(), result);
}
-
+
virtual bool
- IsRemovable() { return true; }
+ IsRemovable ()
+ {
+ return true;
+ }
+
+ const std::string&
+ GetFunctionName ()
+ {
+ return m_function_name;
+ }
+
+ ScriptedCommandSynchronicity
+ GetSynchronicity ()
+ {
+ return m_synchro;
+ }
};
@@ -1226,18 +1245,81 @@
class CommandObjectCommandsScriptImport : public CommandObject
{
+private:
+
+ class CommandOptions : public Options
+ {
+ 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;
+
+ switch (short_option)
+ {
+ case 'r':
+ m_allow_reload = true;
+ break;
+ default:
+ error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option);
+ break;
+ }
+
+ return error;
+ }
+
+ void
+ OptionParsingStarting ()
+ {
+ m_allow_reload = 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_allow_reload;
+ };
+
+ CommandOptions m_options;
+
+ virtual Options *
+ GetOptions ()
+ {
+ return &m_options;
+ }
+
public:
CommandObjectCommandsScriptImport (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"command script import",
"Import a scripting module in LLDB.",
- NULL)
+ NULL),
+ m_options(interpreter)
{
CommandArgumentEntry arg1;
CommandArgumentData cmd_arg;
// Define the first (and only) variant of this arg.
- cmd_arg.arg_type = eArgTypePath;
+ cmd_arg.arg_type = eArgTypeFilename;
cmd_arg.arg_repetition = eArgRepeatPlain;
// There is only one variant this argument could be; put it into the argument entry.
@@ -1279,6 +1361,7 @@
Error error;
if (m_interpreter.GetScriptInterpreter()->LoadScriptingModule(path.c_str(),
+ m_options.m_allow_reload,
error))
{
result.SetStatus (eReturnStatusSuccessFinishNoResult);
@@ -1291,8 +1374,40 @@
return result.Succeeded();
}
+
+ int
+ HandleArgumentCompletion (Args &input,
+ int &cursor_index,
+ int &cursor_char_position,
+ OptionElementVector &opt_element_vector,
+ int match_start_point,
+ int max_return_elements,
+ bool &word_complete,
+ StringList &matches)
+ {
+ std::string completion_str (input.GetArgumentAtIndex(cursor_index));
+ completion_str.erase (cursor_char_position);
+
+ CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter,
+ CommandCompletions::eDiskFileCompletion,
+ completion_str.c_str(),
+ match_start_point,
+ max_return_elements,
+ NULL,
+ word_complete,
+ matches);
+ return matches.GetSize();
+ }
};
+OptionDefinition
+CommandObjectCommandsScriptImport::CommandOptions::g_option_table[] =
+{
+ { LLDB_OPT_SET_1, false, "allow-reload", 'r', no_argument, NULL, 0, eArgTypeNone, "Allow the script to be loaded even if it was already loaded before (for Python, the __lldb_init_module function will be called again, but the module will not be reloaded from disk)."},
+ { 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
+};
+
+
//-------------------------------------------------------------------------
// CommandObjectCommandsScriptAdd
//-------------------------------------------------------------------------
@@ -1324,6 +1439,11 @@
case 'f':
m_funct_name = std::string(option_arg);
break;
+ case 's':
+ m_synchronous = (ScriptedCommandSynchronicity) Args::StringToOptionEnum(option_arg, g_option_table[option_idx].enum_values, 0, error);
+ if (!error.Success())
+ error.SetErrorStringWithFormat ("unrecognized value for synchronicity '%s'", option_arg);
+ break;
default:
error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option);
break;
@@ -1336,6 +1456,7 @@
OptionParsingStarting ()
{
m_funct_name = "";
+ m_synchronous = eScriptedCommandSynchronicitySynchronous;
}
const OptionDefinition*
@@ -1351,6 +1472,7 @@
// Instance variables to hold the values for command options.
std::string m_funct_name;
+ ScriptedCommandSynchronicity m_synchronous;
};
CommandOptions m_options;
@@ -1366,15 +1488,18 @@
private:
CommandInterpreter& m_interpreter;
std::string m_cmd_name;
+ ScriptedCommandSynchronicity m_synchronous;
StringList m_user_input;
DISALLOW_COPY_AND_ASSIGN (PythonAliasReader);
public:
PythonAliasReader(Debugger& debugger,
CommandInterpreter& interpreter,
- std::string cmd_name) :
+ std::string cmd_name,
+ ScriptedCommandSynchronicity synch) :
InputReaderEZ(debugger),
m_interpreter(interpreter),
m_cmd_name(cmd_name),
+ m_synchronous(synch),
m_user_input()
{}
@@ -1427,7 +1552,7 @@
data.reader.SetIsDone (true);
if (!batch_mode)
{
- out_stream->Printf ("Warning: No command attached to breakpoint.\n");
+ out_stream->Printf ("Warning: No script attached.\n");
out_stream->Flush();
}
}
@@ -1442,7 +1567,7 @@
ScriptInterpreter *interpreter = data.reader.GetDebugger().GetCommandInterpreter().GetScriptInterpreter();
if (!interpreter)
{
- out_stream->Printf ("Internal error #1: no script attached.\n");
+ out_stream->Printf ("Script interpreter missing: no script attached.\n");
out_stream->Flush();
return;
}
@@ -1450,20 +1575,20 @@
if (!interpreter->GenerateScriptAliasFunction (m_user_input,
funct_name_sl))
{
- out_stream->Printf ("Internal error #2: no script attached.\n");
+ out_stream->Printf ("Unable to create function: no script attached.\n");
out_stream->Flush();
return;
}
if (funct_name_sl.GetSize() == 0)
{
- out_stream->Printf ("Internal error #3: no script attached.\n");
+ out_stream->Printf ("Unable to obtain a function name: no script attached.\n");
out_stream->Flush();
return;
}
const char *funct_name = funct_name_sl.GetStringAtIndex(0);
if (!funct_name || !funct_name[0])
{
- out_stream->Printf ("Internal error #4: no script attached.\n");
+ out_stream->Printf ("Invalid function name: no script attached.\n");
out_stream->Flush();
return;
}
@@ -1472,11 +1597,12 @@
CommandObjectSP command_obj_sp(new CommandObjectPythonFunction(m_interpreter,
m_cmd_name,
- funct_name));
+ funct_name,
+ m_synchronous));
- if (!m_interpreter.AddUserCommand(m_cmd_name.c_str(), command_obj_sp, true))
+ if (!m_interpreter.AddUserCommand(m_cmd_name, command_obj_sp, true))
{
- out_stream->Printf ("Internal error #5: no script attached.\n");
+ out_stream->Printf ("Unable to add selected command: no script attached.\n");
out_stream->Flush();
return;
}
@@ -1539,7 +1665,8 @@
{
InputReaderSP reader_sp (new PythonAliasReader (m_interpreter.GetDebugger(),
m_interpreter,
- cmd_name));
+ cmd_name,
+ m_options.m_synchronous));
if (reader_sp)
{
@@ -1566,8 +1693,11 @@
}
else
{
- CommandObjectSP new_cmd(new CommandObjectPythonFunction(m_interpreter, cmd_name, m_options.m_funct_name));
- if (m_interpreter.AddUserCommand(cmd_name.c_str(), new_cmd, true))
+ CommandObjectSP new_cmd(new CommandObjectPythonFunction(m_interpreter,
+ cmd_name,
+ m_options.m_funct_name,
+ m_options.m_synchronous));
+ if (m_interpreter.AddUserCommand(cmd_name, new_cmd, true))
{
result.SetStatus (eReturnStatusSuccessFinishNoResult);
}
@@ -1583,10 +1713,19 @@
}
};
+static OptionEnumValueElement g_script_synchro_type[] =
+{
+ { eScriptedCommandSynchronicitySynchronous, "synchronous", "Run synchronous"},
+ { eScriptedCommandSynchronicityAsynchronous, "asynchronous", "Run asynchronous"},
+ { eScriptedCommandSynchronicityCurrentValue, "current", "Do not alter current setting"},
+ { 0, NULL, NULL }
+};
+
OptionDefinition
CommandObjectCommandsScriptAdd::CommandOptions::g_option_table[] =
{
{ LLDB_OPT_SET_1, false, "function", 'f', required_argument, NULL, 0, eArgTypePythonFunction, "Name of the Python function to bind to this command name."},
+ { LLDB_OPT_SET_1, false, "synchronicity", 's', required_argument, g_script_synchro_type, 0, eArgTypeScriptedCommandSynchronicity, "Set the synchronicity of this command's executions with regard to LLDB event system."},
{ 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
};
@@ -1597,7 +1736,7 @@
class CommandObjectCommandsScriptList : public CommandObject
{
private:
-
+
public:
CommandObjectCommandsScriptList(CommandInterpreter &interpreter) :
CommandObject (interpreter,
Modified: lldb/trunk/source/Commands/CommandObjectType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectType.cpp?rev=144035&r1=144034&r2=144035&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectType.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectType.cpp Mon Nov 7 16:57:04 2011
@@ -1189,12 +1189,6 @@
return false;
}
}
- else
- {
- result.AppendError("added to types, but not given a name");
- result.SetStatus(eReturnStatusFailed);
- return false;
- }
return result.Succeeded();
}
@@ -1286,12 +1280,6 @@
return false;
}
}
- else
- {
- result.AppendError("added to types, but not given a name");
- result.SetStatus(eReturnStatusFailed);
- return false;
- }
result.SetStatus(eReturnStatusSuccessFinishNoResult);
return result.Succeeded();
Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=144035&r1=144034&r2=144035&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Mon Nov 7 16:57:04 2011
@@ -516,19 +516,23 @@
}
bool
-CommandInterpreter::AddUserCommand (const char *name,
+CommandInterpreter::AddUserCommand (std::string name,
const lldb::CommandObjectSP &cmd_sp,
bool can_replace)
{
- if (name && name[0])
+ if (!name.empty())
{
- std::string name_sstr(name);
- if (!can_replace)
- {
- if (m_user_dict.find (name_sstr) != m_user_dict.end())
- return false;
- }
- m_user_dict[name_sstr] = cmd_sp;
+
+ const char* name_cstr = name.c_str();
+
+ // do not allow replacement of internal commands
+ if (CommandExists(name_cstr))
+ return false;
+
+ if (can_replace == false && UserCommandExists(name_cstr))
+ return false;
+
+ m_user_dict[name] = cmd_sp;
return true;
}
return false;
Modified: lldb/trunk/source/Interpreter/CommandObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandObject.cpp?rev=144035&r1=144034&r2=144035&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandObject.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandObject.cpp Mon Nov 7 16:57:04 2011
@@ -881,6 +881,7 @@
{ eArgTypeRegularExpression, "regular-expression", CommandCompletions::eNoCompletion, { NULL, false }, "A regular expression." },
{ eArgTypeRunArgs, "run-args", CommandCompletions::eNoCompletion, { NULL, false }, "Arguments to be passed to the target program when it starts executing." },
{ eArgTypeRunMode, "run-mode", CommandCompletions::eNoCompletion, { NULL, false }, "Help text goes here." },
+ { eArgTypeScriptedCommandSynchronicity, "script-cmd-synchronicity", CommandCompletions::eNoCompletion, { NULL, false }, "The synchronicity to use to run scripted commands with regard to LLDB event system." },
{ eArgTypeScriptLang, "script-language", CommandCompletions::eNoCompletion, { NULL, false }, "The scripting language to be used for script-based commands. Currently only Python is valid." },
{ eArgTypeSearchWord, "search-word", CommandCompletions::eNoCompletion, { NULL, false }, "The word for which you wish to search for information about." },
{ eArgTypeSelector, "selector", CommandCompletions::eNoCompletion, { NULL, false }, "An Objective-C selector name." },
Modified: lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp?rev=144035&r1=144034&r2=144035&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp (original)
+++ lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp Mon Nov 7 16:57:04 2011
@@ -1745,6 +1745,7 @@
bool
ScriptInterpreterPython::LoadScriptingModule (const char* pathname,
+ bool can_reload,
lldb_private::Error& error)
{
if (!pathname || !pathname[0])
@@ -1802,8 +1803,9 @@
int refcount = 0;
// this call will fail if the module does not exist (because the parameter to it is not a string
// but an actual Python module object, which is non-existant if the module was not imported before)
- if (ExecuteOneLineWithReturn(command_stream.GetData(),
- ScriptInterpreterPython::eScriptReturnTypeInt, &refcount) && refcount > 0)
+ bool was_imported = (ExecuteOneLineWithReturn(command_stream.GetData(),
+ ScriptInterpreterPython::eScriptReturnTypeInt, &refcount) && refcount > 0);
+ if (was_imported == true && can_reload == false)
{
error.SetErrorString("module already imported");
return false;
@@ -1831,9 +1833,28 @@
}
}
+ScriptInterpreterPython::SynchronicityHandler::SynchronicityHandler (lldb::DebuggerSP debugger_sp,
+ ScriptedCommandSynchronicity synchro) :
+ m_debugger_sp(debugger_sp),
+ m_synch_wanted(synchro),
+ m_old_asynch(debugger_sp->GetAsyncExecution())
+{
+ if (m_synch_wanted == eScriptedCommandSynchronicitySynchronous)
+ m_debugger_sp->SetAsyncExecution(false);
+ else if (m_synch_wanted == eScriptedCommandSynchronicityAsynchronous)
+ m_debugger_sp->SetAsyncExecution(true);
+}
+
+ScriptInterpreterPython::SynchronicityHandler::~SynchronicityHandler()
+{
+ if (m_synch_wanted != eScriptedCommandSynchronicityCurrentValue)
+ m_debugger_sp->SetAsyncExecution(m_old_asynch);
+}
+
bool
ScriptInterpreterPython::RunScriptBasedCommand(const char* impl_function,
const char* args,
+ ScriptedCommandSynchronicity synchronicity,
lldb_private::CommandReturnObject& cmd_retobj,
Error& error)
{
@@ -1850,13 +1871,22 @@
}
lldb::DebuggerSP debugger_sp = m_interpreter.GetDebugger().GetSP();
+
+ if (!debugger_sp.get())
+ {
+ error.SetErrorString("invalid Debugger pointer");
+ return false;
+ }
bool ret_val;
std::string err_msg;
-
+
{
Locker py_lock(this);
+ SynchronicityHandler synch_handler(debugger_sp,
+ synchronicity);
+
ret_val = g_swig_call_command (impl_function,
m_dictionary_name.c_str(),
debugger_sp,
@@ -1864,17 +1894,13 @@
err_msg,
cmd_retobj);
}
-
+
if (!ret_val)
error.SetErrorString(err_msg.c_str());
else
error.Clear();
-
- return ret_val;
-
-
- return true;
+ return ret_val;
}
// in Python, a special attribute __doc__ contains the docstring
Modified: lldb/trunk/test/functionalities/command_script/TestCommandScript.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/command_script/TestCommandScript.py?rev=144035&r1=144034&r2=144035&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/command_script/TestCommandScript.py (original)
+++ lldb/trunk/test/functionalities/command_script/TestCommandScript.py Mon Nov 7 16:57:04 2011
@@ -33,6 +33,10 @@
self.runCmd('command script delete welcome', check=False)
self.runCmd('command script delete targetname', check=False)
self.runCmd('command script delete longwait', check=False)
+ self.runCmd('command script delete mysto', check=False)
+ self.runCmd('command script delete tell_sync', check=False)
+ self.runCmd('command script delete tell_async', check=False)
+ self.runCmd('command script delete tell_curr', check=False)
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
@@ -83,12 +87,34 @@
self.expect("longwait",
substrs = ['Done; if you saw the delays I am doing OK'])
+ self.runCmd("b main")
+ self.runCmd("run")
+ self.runCmd("mysto 3")
+ self.expect("frame variable array",
+ substrs = ['[0] = 79630','[1] = 388785018','[2] = 0'])
+ self.runCmd("mysto 3")
+ self.expect("frame variable array",
+ substrs = ['[0] = 79630','[4] = 388785018','[5] = 0'])
+
+# we cannot use the stepover command to check for async execution mode since LLDB
+# seems to get confused when events start to queue up
+ self.expect("tell_sync",
+ substrs = ['running sync'])
+ self.expect("tell_async",
+ substrs = ['running async'])
+ self.expect("tell_curr",
+ substrs = ['I am running','sync'])
+
+
self.runCmd("command script clear")
self.expect('command script list', matching=False,
substrs = ['targetname',
'longwait'])
+ self.expect('command script add -f foobar frame', error=True,
+ substrs = ['cannot add command'])
+
if __name__ == '__main__':
import atexit
lldb.SBDebugger.Initialize()
Modified: lldb/trunk/test/functionalities/command_script/import/TestImport.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/command_script/import/TestImport.py?rev=144035&r1=144034&r2=144035&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/command_script/import/TestImport.py (original)
+++ lldb/trunk/test/functionalities/command_script/import/TestImport.py Mon Nov 7 16:57:04 2011
@@ -48,6 +48,7 @@
self.runCmd("script import dummymodule")
self.expect("command script import ./dummymodule.py",
error=True, startstr='error: module importing failed')
+ self.runCmd("command script import --allow-reload ./dummymodule.py")
self.runCmd("command script add -f foo.foo_function foocmd")
self.runCmd("command script add -f foobar.foo_function foobarcmd")
Modified: lldb/trunk/test/functionalities/command_script/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/command_script/main.cpp?rev=144035&r1=144034&r2=144035&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/command_script/main.cpp (original)
+++ lldb/trunk/test/functionalities/command_script/main.cpp Mon Nov 7 16:57:04 2011
@@ -52,11 +52,18 @@
main(int argc, char const *argv[])
{
- int array[3];
+ int array[9];
+ memset(array,0,9*sizeof(int));
array[0] = foo (1238, 78392);
array[1] = foo (379265, 23674);
array[2] = foo (872934, 234);
+ array[3] = foo (1238, 78392);
+ array[4] = foo (379265, 23674);
+ array[5] = foo (872934, 234);
+ array[6] = foo (1238, 78392);
+ array[7] = foo (379265, 23674);
+ array[8] = foo (872934, 234);
return 0;
}
Added: lldb/trunk/test/functionalities/command_script/mysto.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/command_script/mysto.py?rev=144035&view=auto
==============================================================================
--- lldb/trunk/test/functionalities/command_script/mysto.py (added)
+++ lldb/trunk/test/functionalities/command_script/mysto.py Mon Nov 7 16:57:04 2011
@@ -0,0 +1,21 @@
+import lldb
+import sys
+import os
+import time
+
+def StepOver(debugger, args, result, dict):
+ """
+ Step over a given number of times instead of only just once
+ """
+ arg_split = args.split(" ")
+ print type(arg_split)
+ count = int(arg_split[0])
+ for i in range(0,count):
+ lldb.thread.StepOver(lldb.eOnlyThisThread)
+ print "step<%d>"%i
+
+def __lldb_init_module(debugger, session_dict):
+ # by default, --synchronicity is set to synchronous
+ debugger.HandleCommand("command script add -f mysto.StepOver mysto")
+ return None
+
Modified: lldb/trunk/test/functionalities/command_script/py_import
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/command_script/py_import?rev=144035&r1=144034&r2=144035&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/command_script/py_import (original)
+++ lldb/trunk/test/functionalities/command_script/py_import Mon Nov 7 16:57:04 2011
@@ -4,3 +4,7 @@
command script add welcome --function welcome.welcome_impl
command script add targetname --function welcome.target_name_impl
command script add longwait --function welcome.print_wait_impl
+command script import mysto.py --allow-reload
+command script add tell_sync --function welcome.check_for_synchro --synchronicity sync
+command script add tell_async --function welcome.check_for_synchro --synchronicity async
+command script add tell_curr --function welcome.check_for_synchro --synchronicity curr
Modified: lldb/trunk/test/functionalities/command_script/welcome.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/command_script/welcome.py?rev=144035&r1=144034&r2=144035&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/command_script/welcome.py (original)
+++ lldb/trunk/test/functionalities/command_script/welcome.py Mon Nov 7 16:57:04 2011
@@ -24,4 +24,11 @@
print 'Still doing long task..';
time.sleep(1)
result.PutCString('Done; if you saw the delays I am doing OK')
- return None
\ No newline at end of file
+ return None
+
+def check_for_synchro(debugger, args, result, dict):
+ if debugger.GetAsync() == True:
+ result.PutCString('I am running async')
+ if debugger.GetAsync() == False:
+ result.PutCString('I am running sync')
+ return None
From johnny.chen at apple.com Mon Nov 7 17:26:13 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Mon, 07 Nov 2011 23:26:13 -0000
Subject: [Lldb-commits] [lldb] r144039 -
/lldb/trunk/test/functionalities/alias/TestAliases.py
Message-ID: <20111107232613.111362A6C12C@llvm.org>
Author: johnny
Date: Mon Nov 7 17:26:12 2011
New Revision: 144039
URL: http://llvm.org/viewvc/llvm-project?rev=144039&view=rev
Log:
Fix the test suite failure. The particular line in the test case was there since the initial version
dated 2010-21-15. The test started failure recently probably due to work done on the command parsing.
Anyway, the specific test sequence is invalid and is fixed now.
Modified:
lldb/trunk/test/functionalities/alias/TestAliases.py
Modified: lldb/trunk/test/functionalities/alias/TestAliases.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/alias/TestAliases.py?rev=144039&r1=144038&r2=144039&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/alias/TestAliases.py (original)
+++ lldb/trunk/test/functionalities/alias/TestAliases.py Mon Nov 7 17:26:12 2011
@@ -51,7 +51,7 @@
self.runCmd ("command alias alias command alias")
self.runCmd ("command alias unalias command unalias")
- self.runCmd ("alias myrun process launch -t%1 --")
+ self.runCmd ("alias myrun process launch -t %1 --")
self.runCmd ("alias bp breakpoint")
self.expect ("alias bpa bp add",
From echristo at apple.com Mon Nov 7 17:29:56 2011
From: echristo at apple.com (Eric Christopher)
Date: Mon, 07 Nov 2011 23:29:56 -0000
Subject: [Lldb-commits] [lldb] r144040 -
/lldb/trunk/include/lldb/lldb-forward.h
Message-ID: <20111107232956.DB2A32A6C12C@llvm.org>
Author: echristo
Date: Mon Nov 7 17:29:56 2011
New Revision: 144040
URL: http://llvm.org/viewvc/llvm-project?rev=144040&view=rev
Log:
Remove duplicate and contradictory forward declaration.
Modified:
lldb/trunk/include/lldb/lldb-forward.h
Modified: lldb/trunk/include/lldb/lldb-forward.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-forward.h?rev=144040&r1=144039&r2=144040&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-forward.h (original)
+++ lldb/trunk/include/lldb/lldb-forward.h Mon Nov 7 17:29:56 2011
@@ -128,7 +128,6 @@
class ScriptInterpreter;
#ifndef LLDB_DISABLE_PYTHON
class ScriptInterpreterPython;
-class ScriptSummaryFormat;
#endif // #ifndef LLDB_DISABLE_PYTHON
class SearchFilter;
class Section;
From scallanan at apple.com Mon Nov 7 17:32:52 2011
From: scallanan at apple.com (Sean Callanan)
Date: Mon, 07 Nov 2011 23:32:52 -0000
Subject: [Lldb-commits] [lldb] r144041 -
/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
Message-ID: <20111107233252.A05DC2A6C12C@llvm.org>
Author: spyffe
Date: Mon Nov 7 17:32:52 2011
New Revision: 144041
URL: http://llvm.org/viewvc/llvm-project?rev=144041&view=rev
Log:
Additional logging to track original versions of
imported variables.
Modified:
lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=144041&r1=144040&r2=144041&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Mon Nov 7 17:32:52 2011
@@ -2735,8 +2735,9 @@
if (log)
{
+ ASTDumper orig_dumper(ut.GetOpaqueQualType());
ASTDumper ast_dumper(var_decl);
- log->Printf(" CEDM::FEVD[%u] Found variable %s, returned %s", current_id, decl_name.c_str(), ast_dumper.GetCString());
+ log->Printf(" CEDM::FEVD[%u] Found variable %s, returned %s (original %s)", current_id, decl_name.c_str(), ast_dumper.GetCString(), orig_dumper.GetCString());
}
}
From scallanan at apple.com Mon Nov 7 17:35:40 2011
From: scallanan at apple.com (Sean Callanan)
Date: Mon, 07 Nov 2011 23:35:40 -0000
Subject: [Lldb-commits] [lldb] r144042 - in /lldb/trunk:
include/lldb/Expression/ClangExpression.h
include/lldb/Expression/ClangUserExpression.h
source/Breakpoint/BreakpointOptions.cpp source/Breakpoint/Watchpoint.cpp
source/Expression/ClangExpressionParser.cpp
source/Expression/ClangUserExpression.cpp source/Target/Process.cpp
source/Target/StopInfo.cpp source/Target/Target.cpp
Message-ID: <20111107233540.F00573524001@llvm.org>
Author: spyffe
Date: Mon Nov 7 17:35:40 2011
New Revision: 144042
URL: http://llvm.org/viewvc/llvm-project?rev=144042&view=rev
Log:
Added a language parameter to the expression parser,
which will in the future allow expressions to be
compiled as C, C++, and Objective-C instead of the
current default Objective-C++. This feature requires
some additional support from Clang -- specifically, it
requires reference types in the parser regardless of
language -- so it is not yet exposed to the user.
Modified:
lldb/trunk/include/lldb/Expression/ClangExpression.h
lldb/trunk/include/lldb/Expression/ClangUserExpression.h
lldb/trunk/source/Breakpoint/BreakpointOptions.cpp
lldb/trunk/source/Breakpoint/Watchpoint.cpp
lldb/trunk/source/Expression/ClangExpressionParser.cpp
lldb/trunk/source/Expression/ClangUserExpression.cpp
lldb/trunk/source/Target/Process.cpp
lldb/trunk/source/Target/StopInfo.cpp
lldb/trunk/source/Target/Target.cpp
Modified: lldb/trunk/include/lldb/Expression/ClangExpression.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangExpression.h?rev=144042&r1=144041&r2=144042&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/ClangExpression.h (original)
+++ lldb/trunk/include/lldb/Expression/ClangExpression.h Mon Nov 7 17:35:40 2011
@@ -73,6 +73,16 @@
FunctionName () = 0;
//------------------------------------------------------------------
+ /// Return the language that should be used when parsing. To use
+ /// the default, return eLanguageTypeUnknown.
+ //------------------------------------------------------------------
+ virtual lldb::LanguageType
+ Language ()
+ {
+ return lldb::eLanguageTypeUnknown;
+ }
+
+ //------------------------------------------------------------------
/// Return the object that the parser should use when resolving external
/// values. May be NULL if everything should be self-contained.
//------------------------------------------------------------------
Modified: lldb/trunk/include/lldb/Expression/ClangUserExpression.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangUserExpression.h?rev=144042&r1=144041&r2=144042&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/ClangUserExpression.h (original)
+++ lldb/trunk/include/lldb/Expression/ClangUserExpression.h Mon Nov 7 17:35:40 2011
@@ -58,9 +58,15 @@
/// @param[in] expr_prefix
/// If non-NULL, a C string containing translation-unit level
/// definitions to be included when the expression is parsed.
+ ///
+ /// @param[in] language
+ /// If not eLanguageTypeUnknown, a language to use when parsing
+ /// the expression. Currently restricted to those languages
+ /// supported by Clang.
//------------------------------------------------------------------
ClangUserExpression (const char *expr,
- const char *expr_prefix);
+ const char *expr_prefix,
+ lldb::LanguageType language);
//------------------------------------------------------------------
/// Destructor
@@ -200,6 +206,16 @@
}
//------------------------------------------------------------------
+ /// Return the language that should be used when parsing. To use
+ /// the default, return eLanguageTypeUnknown.
+ //------------------------------------------------------------------
+ virtual lldb::LanguageType
+ Language ()
+ {
+ return m_language;
+ }
+
+ //------------------------------------------------------------------
/// Return the object that the parser should use when resolving external
/// values. May be NULL if everything should be self-contained.
//------------------------------------------------------------------
@@ -260,6 +276,11 @@
/// Determines whether or not to try using the IR interpreter to
/// avoid running the expression on the parser.
///
+ /// @param[in] language
+ /// If not eLanguageTypeUnknown, a language to use when parsing
+ /// the expression. Currently restricted to those languages
+ /// supported by Clang.
+ ///
/// @param[in] discard_on_error
/// True if the thread's state should be restored in the case
/// of an error.
@@ -280,6 +301,7 @@
static ExecutionResults
Evaluate (ExecutionContext &exe_ctx,
lldb_private::ExecutionPolicy execution_policy,
+ lldb::LanguageType language,
bool discard_on_error,
const char *expr_cstr,
const char *expr_prefix,
@@ -288,6 +310,7 @@
static ExecutionResults
EvaluateWithError (ExecutionContext &exe_ctx,
lldb_private::ExecutionPolicy execution_policy,
+ lldb::LanguageType language,
bool discard_on_error,
const char *expr_cstr,
const char *expr_prefix,
@@ -319,6 +342,9 @@
std::string m_expr_text; ///< The text of the expression, as typed by the user
std::string m_expr_prefix; ///< The text of the translation-level definitions, as provided by the user
+ lldb::LanguageType m_language; ///< The language to use when parsing (eLanguageTypeUnknown means use defaults)
+ bool m_allow_cxx; ///< True if the language allows C++.
+ bool m_allow_objc; ///< True if the language allows Objective-C.
std::string m_transformed_text; ///< The text of the expression, as send to the parser
TypeFromUser m_desired_type; ///< The type to coerce the expression's result to. If NULL, inferred from the expression.
Modified: lldb/trunk/source/Breakpoint/BreakpointOptions.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointOptions.cpp?rev=144042&r1=144041&r2=144042&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointOptions.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointOptions.cpp Mon Nov 7 17:35:40 2011
@@ -60,7 +60,7 @@
if (rhs.m_thread_spec_ap.get() != NULL)
m_thread_spec_ap.reset (new ThreadSpec(*rhs.m_thread_spec_ap.get()));
if (rhs.m_condition_ap.get())
- m_condition_ap.reset (new ClangUserExpression (rhs.m_condition_ap->GetUserText(), NULL));
+ m_condition_ap.reset (new ClangUserExpression (rhs.m_condition_ap->GetUserText(), NULL, lldb::eLanguageTypeUnknown));
}
//----------------------------------------------------------------------
@@ -77,7 +77,7 @@
if (rhs.m_thread_spec_ap.get() != NULL)
m_thread_spec_ap.reset(new ThreadSpec(*rhs.m_thread_spec_ap.get()));
if (rhs.m_condition_ap.get())
- m_condition_ap.reset (new ClangUserExpression (rhs.m_condition_ap->GetUserText(), NULL));
+ m_condition_ap.reset (new ClangUserExpression (rhs.m_condition_ap->GetUserText(), NULL, lldb::eLanguageTypeUnknown));
return *this;
}
@@ -166,7 +166,7 @@
}
else
{
- m_condition_ap.reset(new ClangUserExpression (condition, NULL));
+ m_condition_ap.reset(new ClangUserExpression (condition, NULL, lldb::eLanguageTypeUnknown));
}
}
Modified: lldb/trunk/source/Breakpoint/Watchpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/Watchpoint.cpp?rev=144042&r1=144041&r2=144042&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/Watchpoint.cpp (original)
+++ lldb/trunk/source/Breakpoint/Watchpoint.cpp Mon Nov 7 17:35:40 2011
@@ -212,7 +212,7 @@
else
{
// Pass NULL for expr_prefix (no translation-unit level definitions).
- m_condition_ap.reset(new ClangUserExpression (condition, NULL));
+ m_condition_ap.reset(new ClangUserExpression (condition, NULL, lldb::eLanguageTypeUnknown));
}
}
Modified: lldb/trunk/source/Expression/ClangExpressionParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionParser.cpp?rev=144042&r1=144041&r2=144042&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionParser.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionParser.cpp Mon Nov 7 17:35:40 2011
@@ -204,19 +204,32 @@
// 2. Set options.
- // Parse expressions as Objective C++ regardless of context.
- // Our hook into Clang's lookup mechanism only works in C++.
- m_compiler->getLangOpts().CPlusPlus = true;
-
- // Setup objective C
- m_compiler->getLangOpts().ObjC1 = true;
- m_compiler->getLangOpts().ObjC2 = true;
+ lldb::LanguageType language = expr.Language();
+
+ switch (language)
+ {
+ case lldb::eLanguageTypeC:
+ break;
+ case lldb::eLanguageTypeObjC:
+ m_compiler->getLangOpts().ObjC1 = true;
+ m_compiler->getLangOpts().ObjC2 = true;
+ break;
+ case lldb::eLanguageTypeC_plus_plus:
+ m_compiler->getLangOpts().CPlusPlus = true;
+ break;
+ case lldb::eLanguageTypeObjC_plus_plus:
+ default:
+ m_compiler->getLangOpts().ObjC1 = true;
+ m_compiler->getLangOpts().ObjC2 = true;
+ m_compiler->getLangOpts().CPlusPlus = true;
+ break;
+ }
Process *process = NULL;
if (exe_scope)
process = exe_scope->CalculateProcess();
- if (process)
+ if (process && m_compiler->getLangOpts().ObjC1)
{
if (process->GetObjCLanguageRuntime())
{
Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUserExpression.cpp?rev=144042&r1=144041&r2=144042&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangUserExpression.cpp (original)
+++ lldb/trunk/source/Expression/ClangUserExpression.cpp Mon Nov 7 17:35:40 2011
@@ -44,10 +44,12 @@
using namespace lldb_private;
ClangUserExpression::ClangUserExpression (const char *expr,
- const char *expr_prefix) :
+ const char *expr_prefix,
+ lldb::LanguageType language) :
ClangExpression (),
m_expr_text (expr),
m_expr_prefix (expr_prefix ? expr_prefix : ""),
+ m_language (language),
m_transformed_text (),
m_desired_type (NULL, NULL),
m_cplusplus (false),
@@ -58,6 +60,20 @@
m_evaluated_statically (false),
m_const_result ()
{
+ switch (m_language)
+ {
+ case lldb::eLanguageTypeC_plus_plus:
+ m_allow_cxx = true;
+ break;
+ case lldb::eLanguageTypeObjC:
+ m_allow_objc = true;
+ break;
+ case lldb::eLanguageTypeObjC_plus_plus:
+ default:
+ m_allow_cxx = true;
+ m_allow_objc = true;
+ break;
+ }
}
ClangUserExpression::~ClangUserExpression ()
@@ -86,6 +102,9 @@
{
m_target = exe_ctx.GetTargetPtr();
+ if (!(m_allow_cxx || m_allow_objc))
+ return;
+
StackFrame *frame = exe_ctx.GetFramePtr();
if (frame == NULL)
return;
@@ -107,7 +126,7 @@
if (clang::CXXMethodDecl *method_decl = llvm::dyn_cast(decl_context))
{
- if (method_decl->isInstance())
+ if (m_allow_cxx && method_decl->isInstance())
{
VariableList *vars = frame->GetVariableList(false);
@@ -148,7 +167,7 @@
}
else if (clang::ObjCMethodDecl *method_decl = llvm::dyn_cast(decl_context))
{
- if (method_decl->isInstanceMethod())
+ if (m_allow_objc && method_decl->isInstanceMethod())
{
VariableList *vars = frame->GetVariableList(false);
@@ -602,18 +621,20 @@
ExecutionResults
ClangUserExpression::Evaluate (ExecutionContext &exe_ctx,
lldb_private::ExecutionPolicy execution_policy,
+ lldb::LanguageType language,
bool discard_on_error,
const char *expr_cstr,
const char *expr_prefix,
lldb::ValueObjectSP &result_valobj_sp)
{
Error error;
- return EvaluateWithError (exe_ctx, execution_policy, discard_on_error, expr_cstr, expr_prefix, result_valobj_sp, error);
+ return EvaluateWithError (exe_ctx, execution_policy, language, discard_on_error, expr_cstr, expr_prefix, result_valobj_sp, error);
}
ExecutionResults
ClangUserExpression::EvaluateWithError (ExecutionContext &exe_ctx,
lldb_private::ExecutionPolicy execution_policy,
+ lldb::LanguageType language,
bool discard_on_error,
const char *expr_cstr,
const char *expr_prefix,
@@ -642,7 +663,7 @@
if (process == NULL || !process->CanJIT())
execution_policy = eExecutionPolicyNever;
- ClangUserExpressionSP user_expression_sp (new ClangUserExpression (expr_cstr, expr_prefix));
+ ClangUserExpressionSP user_expression_sp (new ClangUserExpression (expr_cstr, expr_prefix, language));
StreamString error_stream;
Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=144042&r1=144041&r2=144042&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Mon Nov 7 17:35:40 2011
@@ -1190,7 +1190,7 @@
expr.Printf("dlopen (\"%s\", 2)", path);
const char *prefix = "extern \"C\" void* dlopen (const char *path, int mode);\n";
lldb::ValueObjectSP result_valobj_sp;
- ClangUserExpression::Evaluate (exe_ctx, eExecutionPolicyAlways, unwind_on_error, expr.GetData(), prefix, result_valobj_sp);
+ ClangUserExpression::Evaluate (exe_ctx, eExecutionPolicyAlways, lldb::eLanguageTypeUnknown, unwind_on_error, expr.GetData(), prefix, result_valobj_sp);
error = result_valobj_sp->GetError();
if (error.Success())
{
@@ -1254,7 +1254,7 @@
expr.Printf("dlclose ((void *)0x%llx)", image_addr);
const char *prefix = "extern \"C\" int dlclose(void* handle);\n";
lldb::ValueObjectSP result_valobj_sp;
- ClangUserExpression::Evaluate (exe_ctx, eExecutionPolicyAlways, unwind_on_error, expr.GetData(), prefix, result_valobj_sp);
+ ClangUserExpression::Evaluate (exe_ctx, eExecutionPolicyAlways, lldb::eLanguageTypeUnknown, unwind_on_error, expr.GetData(), prefix, result_valobj_sp);
if (result_valobj_sp->GetError().Success())
{
Scalar scalar;
Modified: lldb/trunk/source/Target/StopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StopInfo.cpp?rev=144042&r1=144041&r2=144042&view=diff
==============================================================================
--- lldb/trunk/source/Target/StopInfo.cpp (original)
+++ lldb/trunk/source/Target/StopInfo.cpp Mon Nov 7 17:35:40 2011
@@ -208,6 +208,7 @@
Error error;
result_code = ClangUserExpression::EvaluateWithError (context.exe_ctx,
eExecutionPolicyAlways,
+ lldb::eLanguageTypeUnknown,
discard_on_error,
bp_loc_sp->GetConditionText(),
NULL,
@@ -446,6 +447,7 @@
Error error;
result_code = ClangUserExpression::EvaluateWithError (context.exe_ctx,
eExecutionPolicyAlways,
+ lldb::eLanguageTypeUnknown,
discard_on_error,
wp_sp->GetConditionText(),
NULL,
Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=144042&r1=144041&r2=144042&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Mon Nov 7 17:35:40 2011
@@ -1544,6 +1544,7 @@
execution_results = ClangUserExpression::Evaluate (exe_ctx,
execution_policy,
+ lldb::eLanguageTypeUnknown,
unwind_on_error,
expr_cstr,
prefix,
From gclayton at apple.com Mon Nov 7 17:54:13 2011
From: gclayton at apple.com (Greg Clayton)
Date: Mon, 07 Nov 2011 23:54:13 -0000
Subject: [Lldb-commits] [lldb] r144045 -
/lldb/trunk/include/lldb/lldb-forward.h
Message-ID: <20111107235413.D77E22A6C12C@llvm.org>
Author: gclayton
Date: Mon Nov 7 17:54:13 2011
New Revision: 144045
URL: http://llvm.org/viewvc/llvm-project?rev=144045&view=rev
Log:
Moved the fixed ScriptSummaryFormat forward declaration into the #ifndef LLDB_DISABLE_PYTHON so it doesn't show up in builds where it is supposed to be disabled.
Modified:
lldb/trunk/include/lldb/lldb-forward.h
Modified: lldb/trunk/include/lldb/lldb-forward.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-forward.h?rev=144045&r1=144044&r2=144045&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-forward.h (original)
+++ lldb/trunk/include/lldb/lldb-forward.h Mon Nov 7 17:54:13 2011
@@ -124,10 +124,10 @@
class RegisterValue;
class RegularExpression;
class Scalar;
-struct ScriptSummaryFormat;
class ScriptInterpreter;
#ifndef LLDB_DISABLE_PYTHON
class ScriptInterpreterPython;
+struct ScriptSummaryFormat;
#endif // #ifndef LLDB_DISABLE_PYTHON
class SearchFilter;
class Section;
From echristo at apple.com Mon Nov 7 17:57:39 2011
From: echristo at apple.com (Eric Christopher)
Date: Mon, 07 Nov 2011 15:57:39 -0800
Subject: [Lldb-commits] [lldb] r144045
- /lldb/trunk/include/lldb/lldb-forward.h
In-Reply-To: <20111107235413.D77E22A6C12C@llvm.org>
References: <20111107235413.D77E22A6C12C@llvm.org>
Message-ID: <176B5AB7-5058-4BC8-8E97-121114117155@apple.com>
On Nov 7, 2011, at 3:54 PM, Greg Clayton wrote:
> Author: gclayton
> Date: Mon Nov 7 17:54:13 2011
> New Revision: 144045
>
> URL: http://llvm.org/viewvc/llvm-project?rev=144045&view=rev
> Log:
> Moved the fixed ScriptSummaryFormat forward declaration into the #ifndef LLDB_DISABLE_PYTHON so it doesn't show up in builds where it is supposed to be disabled.
Aha. Thanks :)
-eric
From gclayton at apple.com Mon Nov 7 20:43:14 2011
From: gclayton at apple.com (Greg Clayton)
Date: Tue, 08 Nov 2011 02:43:14 -0000
Subject: [Lldb-commits] [lldb] r144061 - in /lldb/trunk:
include/lldb/Target/Process.h include/lldb/Target/Target.h
source/Commands/CommandObjectPlatform.cpp
source/Commands/CommandObjectProcess.cpp
source/Commands/CommandObjectSettings.cpp source/Host/macosx/Host.mm
source/Target/Process.cpp source/Target/Target.cpp
test/api/check_public_api_headers/TestPublicAPIHeaders.py
test/functionalities/load_unload/TestLoadUnload.py
test/settings/TestSettings.py tools/driver/Driver.cpp
Message-ID: <20111108024314.715093524001@llvm.org>
Author: gclayton
Date: Mon Nov 7 20:43:13 2011
New Revision: 144061
URL: http://llvm.org/viewvc/llvm-project?rev=144061&view=rev
Log:
Moved many of the "settings" that used to be in "target.process.*" to just
be in the target. All of the environment, args, stdin/out/err files, etc have
all been moved. Also re-enabled the ability to launch a process in a separate
terminal on MacOSX.
Modified:
lldb/trunk/include/lldb/Target/Process.h
lldb/trunk/include/lldb/Target/Target.h
lldb/trunk/source/Commands/CommandObjectPlatform.cpp
lldb/trunk/source/Commands/CommandObjectProcess.cpp
lldb/trunk/source/Commands/CommandObjectSettings.cpp
lldb/trunk/source/Host/macosx/Host.mm
lldb/trunk/source/Target/Process.cpp
lldb/trunk/source/Target/Target.cpp
lldb/trunk/test/api/check_public_api_headers/TestPublicAPIHeaders.py
lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py
lldb/trunk/test/settings/TestSettings.py
lldb/trunk/tools/driver/Driver.cpp
Modified: lldb/trunk/include/lldb/Target/Process.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=144061&r1=144060&r2=144061&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Mon Nov 7 20:43:13 2011
@@ -79,111 +79,6 @@
Error *err);
- const Args &
- GetRunArguments () const
- {
- return m_run_args;
- }
-
- void
- SetRunArguments (const Args &args)
- {
- m_run_args = args;
- }
-
- void
- GetHostEnvironmentIfNeeded ();
-
- size_t
- GetEnvironmentAsArgs (Args &env);
-
- const char *
- GetStandardInputPath () const
- {
- if (m_input_path.empty())
- return NULL;
- return m_input_path.c_str();
- }
-
- void
- SetStandardInputPath (const char *path)
- {
- if (path && path[0])
- m_input_path.assign (path);
- else
- {
- // Make sure we deallocate memory in string...
- std::string tmp;
- tmp.swap (m_input_path);
- }
- }
-
- const char *
- GetStandardOutputPath () const
- {
- if (m_output_path.empty())
- return NULL;
- return m_output_path.c_str();
- }
-
- void
- SetStandardOutputPath (const char *path)
- {
- if (path && path[0])
- m_output_path.assign (path);
- else
- {
- // Make sure we deallocate memory in string...
- std::string tmp;
- tmp.swap (m_output_path);
- }
- }
-
- const char *
- GetStandardErrorPath () const
- {
- if (m_error_path.empty())
- return NULL;
- return m_error_path.c_str();
- }
-
- void
- SetStandardErrorPath (const char *path)
- {
- if (path && path[0])
- m_error_path.assign (path);
- else
- {
- // Make sure we deallocate memory in string...
- std::string tmp;
- tmp.swap (m_error_path);
- }
- }
-
- bool
- GetDisableASLR () const
- {
- return m_disable_aslr;
- }
-
- void
- SetDisableASLR (bool b)
- {
- m_disable_aslr = b;
- }
-
- bool
- GetDisableSTDIO () const
- {
- return m_disable_stdio;
- }
-
- void
- SetDisableSTDIO (bool b)
- {
- m_disable_stdio = b;
- }
-
protected:
void
@@ -192,43 +87,6 @@
const ConstString
CreateInstanceName ();
-
- static const ConstString &
- RunArgsVarName ();
-
- static const ConstString &
- EnvVarsVarName ();
-
- static const ConstString &
- InheritHostEnvVarName ();
-
- static const ConstString &
- InputPathVarName ();
-
- static const ConstString &
- OutputPathVarName ();
-
- static const ConstString &
- ErrorPathVarName ();
-
- static const ConstString &
- DisableASLRVarName();
-
- static const ConstString &
- DisableSTDIOVarName ();
-
-private:
-
- typedef std::map dictionary;
- Args m_run_args;
- dictionary m_env_vars;
- std::string m_input_path;
- std::string m_output_path;
- std::string m_error_path;
- bool m_disable_aslr;
- bool m_disable_stdio;
- bool m_inherit_host_env;
- bool m_got_host_env;
};
//----------------------------------------------------------------------
@@ -677,43 +535,63 @@
if (working_directory)
SetWorkingDirectory(working_directory);
}
+
void
AppendFileAction (const FileAction &info)
{
m_file_actions.push_back(info);
}
- void
+ bool
AppendCloseFileAction (int fd)
{
FileAction file_action;
- file_action.Close (fd);
- AppendFileAction (file_action);
+ if (file_action.Close (fd))
+ {
+ AppendFileAction (file_action);
+ return true;
+ }
+ return false;
}
- void
+ bool
AppendDuplciateFileAction (int fd, int dup_fd)
{
FileAction file_action;
- file_action.Duplicate (fd, dup_fd);
- AppendFileAction (file_action);
+ if (file_action.Duplicate (fd, dup_fd))
+ {
+ AppendFileAction (file_action);
+ return true;
+ }
+ return false;
}
- void
+ bool
AppendOpenFileAction (int fd, const char *path, bool read, bool write)
{
FileAction file_action;
- file_action.Open (fd, path, read, write);
- AppendFileAction (file_action);
+ if (file_action.Open (fd, path, read, write))
+ {
+ AppendFileAction (file_action);
+ return true;
+ }
+ return false;
}
- void
+ bool
AppendSuppressFileAction (int fd, bool read, bool write)
{
FileAction file_action;
- file_action.Open (fd, "/dev/null", read, write);
- AppendFileAction (file_action);
+ if (file_action.Open (fd, "/dev/null", read, write))
+ {
+ AppendFileAction (file_action);
+ return true;
+ }
+ return false;
}
+
+ void
+ FinalizeFileActions (Target *target, Process *process);
size_t
GetNumFileActions () const
Modified: lldb/trunk/include/lldb/Target/Target.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=144061&r1=144060&r2=144061&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Target.h (original)
+++ lldb/trunk/include/lldb/Target/Target.h Mon Nov 7 20:43:13 2011
@@ -25,6 +25,7 @@
#include "lldb/Core/UserSettingsController.h"
#include "lldb/Core/SourceManager.h"
#include "lldb/Expression/ClangPersistentVariables.h"
+#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/NamedOptionValue.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Target/ABI.h"
@@ -102,6 +103,113 @@
{
return m_breakpoints_use_platform_avoid;
}
+
+
+ const Args &
+ GetRunArguments () const
+ {
+ return m_run_args;
+ }
+
+ void
+ SetRunArguments (const Args &args)
+ {
+ m_run_args = args;
+ }
+
+ void
+ GetHostEnvironmentIfNeeded ();
+
+ size_t
+ GetEnvironmentAsArgs (Args &env);
+
+ const char *
+ GetStandardInputPath () const
+ {
+ if (m_input_path.empty())
+ return NULL;
+ return m_input_path.c_str();
+ }
+
+ void
+ SetStandardInputPath (const char *path)
+ {
+ if (path && path[0])
+ m_input_path.assign (path);
+ else
+ {
+ // Make sure we deallocate memory in string...
+ std::string tmp;
+ tmp.swap (m_input_path);
+ }
+ }
+
+ const char *
+ GetStandardOutputPath () const
+ {
+ if (m_output_path.empty())
+ return NULL;
+ return m_output_path.c_str();
+ }
+
+ void
+ SetStandardOutputPath (const char *path)
+ {
+ if (path && path[0])
+ m_output_path.assign (path);
+ else
+ {
+ // Make sure we deallocate memory in string...
+ std::string tmp;
+ tmp.swap (m_output_path);
+ }
+ }
+
+ const char *
+ GetStandardErrorPath () const
+ {
+ if (m_error_path.empty())
+ return NULL;
+ return m_error_path.c_str();
+ }
+
+ void
+ SetStandardErrorPath (const char *path)
+ {
+ if (path && path[0])
+ m_error_path.assign (path);
+ else
+ {
+ // Make sure we deallocate memory in string...
+ std::string tmp;
+ tmp.swap (m_error_path);
+ }
+ }
+
+ bool
+ GetDisableASLR () const
+ {
+ return m_disable_aslr;
+ }
+
+ void
+ SetDisableASLR (bool b)
+ {
+ m_disable_aslr = b;
+ }
+
+ bool
+ GetDisableSTDIO () const
+ {
+ return m_disable_stdio;
+ }
+
+ void
+ SetDisableSTDIO (bool b)
+ {
+ m_disable_stdio = b;
+ }
+
protected:
@@ -114,13 +222,23 @@
OptionValueFileSpec m_expr_prefix_file;
lldb::DataBufferSP m_expr_prefix_contents_sp;
- int m_prefer_dynamic_value;
+ int m_prefer_dynamic_value;
OptionValueBoolean m_skip_prologue;
PathMappingList m_source_map;
uint32_t m_max_children_display;
uint32_t m_max_strlen_length;
OptionValueBoolean m_breakpoints_use_platform_avoid;
-
+ typedef std::map dictionary;
+ Args m_run_args;
+ dictionary m_env_vars;
+ std::string m_input_path;
+ std::string m_output_path;
+ std::string m_error_path;
+ bool m_disable_aslr;
+ bool m_disable_stdio;
+ bool m_inherit_host_env;
+ bool m_got_host_env;
+
};
Modified: lldb/trunk/source/Commands/CommandObjectPlatform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectPlatform.cpp?rev=144061&r1=144060&r2=144061&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectPlatform.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectPlatform.cpp Mon Nov 7 20:43:13 2011
@@ -374,17 +374,21 @@
Error error;
const uint32_t argc = args.GetArgumentCount();
Target *target = m_interpreter.GetExecutionContext().GetTargetPtr();
- if (target)
+ if (target == NULL)
{
- Module *exe_module = target->GetExecutableModulePointer();
- if (exe_module)
- {
- m_options.launch_info.GetExecutableFile () = exe_module->GetFileSpec();
- char exe_path[PATH_MAX];
- if (m_options.launch_info.GetExecutableFile ().GetPath (exe_path, sizeof(exe_path)))
- m_options.launch_info.GetArguments().AppendArgument (exe_path);
- m_options.launch_info.GetArchitecture() = exe_module->GetArchitecture();
- }
+ result.AppendError ("invalid target, create a debug target using the 'target create' command");
+ result.SetStatus (eReturnStatusFailed);
+ return false;
+ }
+
+ Module *exe_module = target->GetExecutableModulePointer();
+ if (exe_module)
+ {
+ m_options.launch_info.GetExecutableFile () = exe_module->GetFileSpec();
+ char exe_path[PATH_MAX];
+ if (m_options.launch_info.GetExecutableFile ().GetPath (exe_path, sizeof(exe_path)))
+ m_options.launch_info.GetArguments().AppendArgument (exe_path);
+ m_options.launch_info.GetArchitecture() = exe_module->GetArchitecture();
}
if (argc > 0)
@@ -412,21 +416,9 @@
if (argc == 0)
{
- lldb::UserSettingsControllerSP process_usc_sp (Process::GetSettingsController ());
- if (process_usc_sp)
- {
- SettableVariableType type;
- StringList settings_args (process_usc_sp->GetVariable ("process.run-args",
- type,
- m_interpreter.GetDebugger().GetInstanceName().GetCString(),
- error));
- if (error.Success())
- {
- const size_t num_settings_args = settings_args.GetSize();
- for (size_t i=0; iGetRunArguments();
+ if (target_settings_args.GetArgumentCount())
+ m_options.launch_info.GetArguments() = target_settings_args;
}
ProcessSP process_sp (platform_sp->DebugProcess (m_options.launch_info,
Modified: lldb/trunk/source/Commands/CommandObjectProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectProcess.cpp?rev=144061&r1=144060&r2=144061&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectProcess.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectProcess.cpp Mon Nov 7 20:43:13 2011
@@ -151,7 +151,9 @@
bool
Execute (Args& launch_args, CommandReturnObject &result)
{
- Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
+ Debugger &debugger = m_interpreter.GetDebugger();
+ Target *target = debugger.GetSelectedTarget().get();
+ Error error;
if (target == NULL)
{
@@ -159,7 +161,6 @@
result.SetStatus (eReturnStatusFailed);
return false;
}
-
// If our listener is NULL, users aren't allows to launch
char filename[PATH_MAX];
const Module *exe_module = target->GetExecutableModulePointer();
@@ -197,102 +198,110 @@
}
else
{
- Error error (process->Destroy());
- if (error.Success())
+ Error destroy_error (process->Destroy());
+ if (destroy_error.Success())
{
result.SetStatus (eReturnStatusSuccessFinishResult);
}
else
{
- result.AppendErrorWithFormat ("Failed to kill process: %s\n", error.AsCString());
+ result.AppendErrorWithFormat ("Failed to kill process: %s\n", destroy_error.AsCString());
result.SetStatus (eReturnStatusFailed);
}
}
}
}
- if (state != eStateConnected)
- {
- const char *plugin_name = m_options.launch_info.GetProcessPluginName();
-
- process = target->CreateProcess (m_interpreter.GetDebugger().GetListener(), plugin_name).get();
- if (process == NULL)
- {
- result.AppendErrorWithFormat ("Failed to find a process plugin for executable.\n");
- result.SetStatus (eReturnStatusFailed);
- return false;
- }
- }
-
if (launch_args.GetArgumentCount() > 0)
{
m_options.launch_info.GetArguments().AppendArguments (launch_args);
}
- else
- {
- const Args &process_args = process->GetRunArguments();
- if (process_args.GetArgumentCount() > 0)
- m_options.launch_info.GetArguments().AppendArguments (process_args);
- }
-
- if (m_options.launch_info.GetFlags().Test (eLaunchFlagLaunchInTTY))
+
+ if (state == eStateConnected)
{
- if (state == eStateConnected)
+ if (m_options.launch_info.GetFlags().Test (eLaunchFlagLaunchInTTY))
{
- result.AppendWarning("launch in tty option is ignored when launching through a remote connection");
+ result.AppendWarning("can't launch in tty when launching through a remote connection");
m_options.launch_info.GetFlags().Clear (eLaunchFlagLaunchInTTY);
}
}
+ else
+ {
+ const char *plugin_name = m_options.launch_info.GetProcessPluginName();
- Args environment;
- process->GetEnvironmentAsArgs (environment);
- m_options.launch_info.GetEnvironmentEntries ().AppendArguments (environment);
-
- if (process->GetDisableASLR())
- m_options.launch_info.GetFlags().Set (eLaunchFlagDisableASLR);
-
- if (m_options.launch_info.GetFlags().Test (eLaunchFlagLaunchInTTY) == false &&
- m_options.launch_info.GetNumFileActions() == 0)
- {
- // Only use the settings value if the user hasn't specified any options that would override it.
- if (process->GetDisableSTDIO())
- m_options.launch_info.GetFlags().Set (eLaunchFlagDisableSTDIO);
-
- const char *path;
- path = process->GetStandardErrorPath();
- if (path)
- {
- ProcessLaunchInfo::FileAction file_action;
- const bool read = true;
- const bool write = true;
- if (file_action.Open(STDERR_FILENO, path, read, write))
- m_options.launch_info.AppendFileAction (file_action);
- }
- path = process->GetStandardInputPath();
- if (path)
- {
- ProcessLaunchInfo::FileAction file_action;
- const bool read = true;
- const bool write = false;
- if (file_action.Open(STDIN_FILENO, path, read, write))
- m_options.launch_info.AppendFileAction (file_action);
- }
-
- path = process->GetStandardOutputPath();
- if (path)
- {
- ProcessLaunchInfo::FileAction file_action;
- const bool read = false;
- const bool write = true;
- if (file_action.Open(STDOUT_FILENO, path, read, write))
- m_options.launch_info.AppendFileAction (file_action);
+ if (m_options.launch_info.GetFlags().Test (eLaunchFlagLaunchInTTY))
+ {
+ process = target->GetPlatform()->DebugProcess (m_options.launch_info,
+ debugger,
+ target,
+ debugger.GetListener(),
+ error).get();
}
- }
- Error error;
+ else
+ {
+ process = target->CreateProcess (debugger.GetListener(), plugin_name).get();
+
+ if (launch_args.GetArgumentCount() == 0)
+ {
+ const Args &process_args = target->GetRunArguments();
+ if (process_args.GetArgumentCount() > 0)
+ m_options.launch_info.GetArguments().AppendArguments (process_args);
+ }
+
+ Args environment;
+ target->GetEnvironmentAsArgs (environment);
+ m_options.launch_info.GetEnvironmentEntries ().AppendArguments (environment);
+
+ if (target->GetDisableASLR())
+ m_options.launch_info.GetFlags().Set (eLaunchFlagDisableASLR);
+
+ if (m_options.launch_info.GetNumFileActions() == 0)
+ {
+ // Only use the settings value if the user hasn't specified any options that would override it.
+ if (target->GetDisableSTDIO())
+ m_options.launch_info.GetFlags().Set (eLaunchFlagDisableSTDIO);
+
+ const char *path;
+ path = target->GetStandardErrorPath();
+ if (path)
+ {
+ ProcessLaunchInfo::FileAction file_action;
+ const bool read = true;
+ const bool write = true;
+ if (file_action.Open(STDERR_FILENO, path, read, write))
+ m_options.launch_info.AppendFileAction (file_action);
+ }
+ path = target->GetStandardInputPath();
+ if (path)
+ {
+ ProcessLaunchInfo::FileAction file_action;
+ const bool read = true;
+ const bool write = false;
+ if (file_action.Open(STDIN_FILENO, path, read, write))
+ m_options.launch_info.AppendFileAction (file_action);
+ }
- error = process->Launch (m_options.launch_info);
-
+ path = target->GetStandardOutputPath();
+ if (path)
+ {
+ ProcessLaunchInfo::FileAction file_action;
+ const bool read = false;
+ const bool write = true;
+ if (file_action.Open(STDOUT_FILENO, path, read, write))
+ m_options.launch_info.AppendFileAction (file_action);
+ }
+ }
+ error = process->Launch (m_options.launch_info);
+ }
+ if (process == NULL)
+ {
+ result.AppendErrorWithFormat ("Failed to find a process plugin for executable.\n");
+ result.SetStatus (eReturnStatusFailed);
+ return false;
+ }
+ }
+
if (error.Success())
{
const char *archname = exe_module->GetArchitecture().GetArchitectureName();
Modified: lldb/trunk/source/Commands/CommandObjectSettings.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSettings.cpp?rev=144061&r1=144060&r2=144061&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectSettings.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectSettings.cpp Mon Nov 7 20:43:13 2011
@@ -83,14 +83,14 @@
"When setting a dictionary or array variable, you can set multiple entries \n\
at once by giving the values to the set command. For example: \n\
\n\
-(lldb) settings set target.process.run-args value1 value2 value3 \n\
-(lldb) settings set target.process.env-vars [\"MYPATH\"]=~/.:/usr/bin [\"SOME_ENV_VAR\"]=12345 \n\
+(lldb) settings set target.run-args value1 value2 value3 \n\
+(lldb) settings set target.env-vars [\"MYPATH\"]=~/.:/usr/bin [\"SOME_ENV_VAR\"]=12345 \n\
\n\
-(lldb) settings show target.process.run-args \n\
+(lldb) settings show target.run-args \n\
[0]: 'value1' \n\
[1]: 'value2' \n\
[3]: 'value3' \n\
-(lldb) settings show target.process.env-vars \n\
+(lldb) settings show target.env-vars \n\
'MYPATH=~/.:/usr/bin'\n\
'SOME_ENV_VAR=12345' \n\
\n\
Modified: lldb/trunk/source/Host/macosx/Host.mm
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/Host.mm?rev=144061&r1=144060&r2=144061&view=diff
==============================================================================
--- lldb/trunk/source/Host/macosx/Host.mm (original)
+++ lldb/trunk/source/Host/macosx/Host.mm Mon Nov 7 20:43:13 2011
@@ -431,17 +431,30 @@
do script the_shell_script\n\
end tell\n";
+static const char *
+GetShellSafeArgument (const char *unsafe_arg, std::string &safe_arg)
+{
+ safe_arg.assign (unsafe_arg);
+ size_t prev_pos = 0;
+ while (prev_pos < safe_arg.size())
+ {
+ // Escape spaces and quotes
+ size_t pos = safe_arg.find_first_of(" '\"", prev_pos);
+ if (pos != std::string::npos)
+ {
+ safe_arg.insert (pos, 1, '\\');
+ prev_pos = pos + 2;
+ }
+ else
+ break;
+ }
+ return safe_arg.c_str();
+}
+
static Error
-LaunchInNewTerminalWithAppleScript (const char *exe_path,
- ProcessLaunchInfo &launch_info)
+LaunchInNewTerminalWithAppleScript (const char *exe_path, ProcessLaunchInfo &launch_info)
{
Error error;
- if (exe_path == NULL || exe_path[0] == '\0')
- {
- error.SetErrorString ("invalid executable path");
- return error;
- }
-
char unix_socket_name[PATH_MAX] = "/tmp/XXXXXX";
if (::mktemp (unix_socket_name) == NULL)
{
@@ -485,15 +498,41 @@
if (launch_info.GetFlags().Test (eLaunchFlagDisableASLR))
command.PutCString(" --disable-aslr");
-
- command.Printf(" -- '%s'", exe_path);
-
- const char **argv = launch_info.GetArguments().GetConstArgumentVector ();
- if (argv)
+
+ if (launch_info.GetFlags().Test (eLaunchFlagLaunchInShell))
{
- for (size_t i=0; argv[i] != NULL; ++i)
+ const char *shell_executable = getenv("SHELL");
+ std::string safe_arg;
+ command.Printf(" -- %s -c '", shell_executable);
+ const char **argv = launch_info.GetArguments().GetConstArgumentVector ();
+ if (argv)
+ {
+ for (size_t i=0; argv[i] != NULL; ++i)
+ {
+ const char *arg = GetShellSafeArgument (i == 0 ? exe_path : argv[i], safe_arg);
+ command.Printf(" %s", arg);
+ }
+ }
+ command.PutChar('\'');
+ }
+ else
+ {
+ command.PutCString(" -- ");
+
+ const char **argv = launch_info.GetArguments().GetConstArgumentVector ();
+ if (argv)
+ {
+ for (size_t i=0; argv[i] != NULL; ++i)
+ {
+ if (i==0)
+ command.Printf(" '%s'", exe_path);
+ else
+ command.Printf(" '%s'", argv[i]);
+ }
+ }
+ else
{
- command.Printf(" '%s'", argv[i]);
+ command.Printf(" '%s'", exe_path);
}
}
command.PutCString (" ; echo Process exited with status $?");
Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=144061&r1=144060&r2=144061&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Mon Nov 7 20:43:13 2011
@@ -250,6 +250,60 @@
}
}
+void
+ProcessLaunchInfo::FinalizeFileActions (Target *target, Process *process)
+{
+ // If notthing was specified, then check the process for any default
+ // settings that were set with "settings set"
+ if (m_file_actions.empty())
+ {
+ const char *path;
+ if (m_flags.Test(eLaunchFlagDisableSTDIO))
+ {
+ AppendSuppressFileAction (STDERR_FILENO, true , true );
+ AppendSuppressFileAction (STDIN_FILENO , true , false);
+ AppendSuppressFileAction (STDOUT_FILENO, false, true );
+ }
+ else
+ {
+ // Check for any values that might have gotten set with any of:
+ // (lldb) settings set target.input-path
+ // (lldb) settings set target.output-path
+ // (lldb) settings set target.error-path
+ if (target)
+ {
+ path = target->GetStandardErrorPath();
+ if (path)
+ {
+ const bool read = true;
+ const bool write = true;
+ AppendOpenFileAction(STDERR_FILENO, path, read, write);
+ }
+ path = target->GetStandardInputPath();
+ if (path)
+ {
+ const bool read = true;
+ const bool write = false;
+ AppendOpenFileAction(STDIN_FILENO, path, read, write);
+ }
+
+ path = target->GetStandardOutputPath();
+ if (path)
+ {
+ const bool read = false;
+ const bool write = true;
+ AppendOpenFileAction(STDOUT_FILENO, path, read, write);
+ }
+ }
+
+ // If we still don't have any actions...
+ if (m_file_actions.empty())
+ {
+ }
+ }
+ }
+}
+
bool
ProcessLaunchInfo::FileAction::Open (int fd, const char *path, bool read, bool write)
{
@@ -466,6 +520,7 @@
{ LLDB_OPT_SET_ALL, false, "working-dir", 'w', required_argument, NULL, 0, eArgTypePath, "Set the current working directory to when running the inferior."},
{ LLDB_OPT_SET_ALL, false, "arch", 'a', required_argument, NULL, 0, eArgTypeArchitecture, "Set the architecture for the process to launch when ambiguous."},
{ LLDB_OPT_SET_ALL, false, "environment", 'v', required_argument, NULL, 0, eArgTypeNone, "Specify an environment variable name/value stirng (--environement NAME=VALUE). Can be specified multiple times for subsequent environment entries."},
+{ LLDB_OPT_SET_ALL, false, "shell", 'c', no_argument, NULL, 0, eArgTypeNone, "Run the process in a shell (not supported on all platforms)."},
{ LLDB_OPT_SET_1 , false, "stdin", 'i', required_argument, NULL, 0, eArgTypePath, "Redirect stdin for the process to ."},
{ LLDB_OPT_SET_1 , false, "stdout", 'o', required_argument, NULL, 0, eArgTypePath, "Redirect stdout for the process to ."},
@@ -475,7 +530,6 @@
{ LLDB_OPT_SET_3 , false, "no-stdio", 'n', no_argument, NULL, 0, eArgTypeNone, "Do not set up for terminal I/O to go to running process."},
-{ LLDB_OPT_SET_4 , false, "shell", 'c', no_argument, NULL, 0, eArgTypeNone, "Run the process in a shell (not supported on all platforms)."},
{ 0 , false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
};
@@ -949,50 +1003,6 @@
}
-void
-Process::ProcessInstanceSettings::GetHostEnvironmentIfNeeded ()
-{
- if (m_inherit_host_env && !m_got_host_env)
- {
- m_got_host_env = true;
- StringList host_env;
- const size_t host_env_count = Host::GetEnvironment (host_env);
- for (size_t idx=0; idxfirst);
- env_var_equal_value.append(1, '=');
- env_var_equal_value.append (pos->second);
- env.AppendArgument (env_var_equal_value.c_str());
- }
- return env.GetArgumentCount();
-}
-
-
const char *
Process::GetExitDescription ()
{
@@ -4044,28 +4054,19 @@
bool live_instance,
const char *name
) :
- InstanceSettings (owner, name ? name : InstanceSettings::InvalidName().AsCString(), live_instance),
- m_run_args (),
- m_env_vars (),
- m_input_path (),
- m_output_path (),
- m_error_path (),
- m_disable_aslr (true),
- m_disable_stdio (false),
- m_inherit_host_env (true),
- m_got_host_env (false)
+ InstanceSettings (owner, name ? name : InstanceSettings::InvalidName().AsCString(), live_instance)
{
// CopyInstanceSettings is a pure virtual function in InstanceSettings; it therefore cannot be called
// until the vtables for ProcessInstanceSettings are properly set up, i.e. AFTER all the initializers.
// For this reason it has to be called here, rather than in the initializer or in the parent constructor.
// This is true for CreateInstanceName() too.
-
+
if (GetInstanceName () == InstanceSettings::InvalidName())
{
ChangeInstanceName (std::string (CreateInstanceName().AsCString()));
m_owner.RegisterInstanceSettings (this);
}
-
+
if (live_instance)
{
const lldb::InstanceSettingsSP &pending_settings = m_owner.FindPendingSettings (m_instance_name);
@@ -4075,14 +4076,7 @@
}
ProcessInstanceSettings::ProcessInstanceSettings (const ProcessInstanceSettings &rhs) :
- InstanceSettings (*Process::GetSettingsController(), CreateInstanceName().AsCString()),
- m_run_args (rhs.m_run_args),
- m_env_vars (rhs.m_env_vars),
- m_input_path (rhs.m_input_path),
- m_output_path (rhs.m_output_path),
- m_error_path (rhs.m_error_path),
- m_disable_aslr (rhs.m_disable_aslr),
- m_disable_stdio (rhs.m_disable_stdio)
+ InstanceSettings (*Process::GetSettingsController(), CreateInstanceName().AsCString())
{
if (m_instance_name != InstanceSettings::GetDefaultName())
{
@@ -4101,14 +4095,6 @@
{
if (this != &rhs)
{
- m_run_args = rhs.m_run_args;
- m_env_vars = rhs.m_env_vars;
- m_input_path = rhs.m_input_path;
- m_output_path = rhs.m_output_path;
- m_error_path = rhs.m_error_path;
- m_disable_aslr = rhs.m_disable_aslr;
- m_disable_stdio = rhs.m_disable_stdio;
- m_inherit_host_env = rhs.m_inherit_host_env;
}
return *this;
@@ -4125,45 +4111,16 @@
Error &err,
bool pending)
{
- if (var_name == RunArgsVarName())
- UserSettingsController::UpdateStringArrayVariable (op, index_value, m_run_args, value, err);
- else if (var_name == EnvVarsVarName())
- {
- // This is nice for local debugging, but it is isn't correct for
- // remote debugging. We need to stop process.env-vars from being
- // populated with the host environment and add this as a launch option
- // and get the correct environment from the Target's platform.
- // GetHostEnvironmentIfNeeded ();
- UserSettingsController::UpdateDictionaryVariable (op, index_value, m_env_vars, value, err);
- }
- else if (var_name == InputPathVarName())
- UserSettingsController::UpdateStringVariable (op, m_input_path, value, err);
- else if (var_name == OutputPathVarName())
- UserSettingsController::UpdateStringVariable (op, m_output_path, value, err);
- else if (var_name == ErrorPathVarName())
- UserSettingsController::UpdateStringVariable (op, m_error_path, value, err);
- else if (var_name == DisableASLRVarName())
- UserSettingsController::UpdateBooleanVariable (op, m_disable_aslr, value, true, err);
- else if (var_name == DisableSTDIOVarName ())
- UserSettingsController::UpdateBooleanVariable (op, m_disable_stdio, value, false, err);
}
void
ProcessInstanceSettings::CopyInstanceSettings (const lldb::InstanceSettingsSP &new_settings,
bool pending)
{
- if (new_settings.get() == NULL)
- return;
-
- ProcessInstanceSettings *new_process_settings = (ProcessInstanceSettings *) new_settings.get();
-
- m_run_args = new_process_settings->m_run_args;
- m_env_vars = new_process_settings->m_env_vars;
- m_input_path = new_process_settings->m_input_path;
- m_output_path = new_process_settings->m_output_path;
- m_error_path = new_process_settings->m_error_path;
- m_disable_aslr = new_process_settings->m_disable_aslr;
- m_disable_stdio = new_process_settings->m_disable_stdio;
+// if (new_settings.get() == NULL)
+// return;
+//
+// ProcessInstanceSettings *new_process_settings = (ProcessInstanceSettings *) new_settings.get();
}
bool
@@ -4172,69 +4129,9 @@
StringList &value,
Error *err)
{
- if (var_name == RunArgsVarName())
- {
- if (m_run_args.GetArgumentCount() > 0)
- {
- for (int i = 0; i < m_run_args.GetArgumentCount(); ++i)
- value.AppendString (m_run_args.GetArgumentAtIndex (i));
- }
- }
- else if (var_name == EnvVarsVarName())
- {
- GetHostEnvironmentIfNeeded ();
-
- if (m_env_vars.size() > 0)
- {
- std::map::iterator pos;
- for (pos = m_env_vars.begin(); pos != m_env_vars.end(); ++pos)
- {
- StreamString value_str;
- value_str.Printf ("%s=%s", pos->first.c_str(), pos->second.c_str());
- value.AppendString (value_str.GetData());
- }
- }
- }
- else if (var_name == InputPathVarName())
- {
- value.AppendString (m_input_path.c_str());
- }
- else if (var_name == OutputPathVarName())
- {
- value.AppendString (m_output_path.c_str());
- }
- else if (var_name == ErrorPathVarName())
- {
- value.AppendString (m_error_path.c_str());
- }
- else if (var_name == InheritHostEnvVarName())
- {
- if (m_inherit_host_env)
- value.AppendString ("true");
- else
- value.AppendString ("false");
- }
- else if (var_name == DisableASLRVarName())
- {
- if (m_disable_aslr)
- value.AppendString ("true");
- else
- value.AppendString ("false");
- }
- else if (var_name == DisableSTDIOVarName())
- {
- if (m_disable_stdio)
- value.AppendString ("true");
- else
- value.AppendString ("false");
- }
- else
- {
- if (err)
- err->SetErrorStringWithFormat ("unrecognized variable name '%s'", var_name.AsCString());
- return false;
- }
- return true;
+ if (err)
+ err->SetErrorStringWithFormat ("unrecognized variable name '%s'", var_name.AsCString());
+ return false;
}
const ConstString
@@ -4250,70 +4147,6 @@
return ret_val;
}
-const ConstString &
-ProcessInstanceSettings::RunArgsVarName ()
-{
- static ConstString run_args_var_name ("run-args");
-
- return run_args_var_name;
-}
-
-const ConstString &
-ProcessInstanceSettings::EnvVarsVarName ()
-{
- static ConstString env_vars_var_name ("env-vars");
-
- return env_vars_var_name;
-}
-
-const ConstString &
-ProcessInstanceSettings::InheritHostEnvVarName ()
-{
- static ConstString g_name ("inherit-env");
-
- return g_name;
-}
-
-const ConstString &
-ProcessInstanceSettings::InputPathVarName ()
-{
- static ConstString input_path_var_name ("input-path");
-
- return input_path_var_name;
-}
-
-const ConstString &
-ProcessInstanceSettings::OutputPathVarName ()
-{
- static ConstString output_path_var_name ("output-path");
-
- return output_path_var_name;
-}
-
-const ConstString &
-ProcessInstanceSettings::ErrorPathVarName ()
-{
- static ConstString error_path_var_name ("error-path");
-
- return error_path_var_name;
-}
-
-const ConstString &
-ProcessInstanceSettings::DisableASLRVarName ()
-{
- static ConstString disable_aslr_var_name ("disable-aslr");
-
- return disable_aslr_var_name;
-}
-
-const ConstString &
-ProcessInstanceSettings::DisableSTDIOVarName ()
-{
- static ConstString disable_stdio_var_name ("disable-stdio");
-
- return disable_stdio_var_name;
-}
-
//--------------------------------------------------
// SettingsController Variable Tables
//--------------------------------------------------
@@ -4330,17 +4163,9 @@
Process::SettingsController::instance_settings_table[] =
{
//{ "var-name", var-type, "default", enum-table, init'd, hidden, "help-text"},
- { "run-args", eSetVarTypeArray, NULL, NULL, false, false, "A list containing all the arguments to be passed to the executable when it is run." },
- { "env-vars", eSetVarTypeDictionary, NULL, NULL, false, false, "A list of all the environment variables to be passed to the executable's environment, and their values." },
- { "inherit-env", eSetVarTypeBoolean, "true", NULL, false, false, "Inherit the environment from the process that is running LLDB." },
- { "input-path", eSetVarTypeString, NULL, NULL, false, false, "The file/path to be used by the executable program for reading its input." },
- { "output-path", eSetVarTypeString, NULL, NULL, false, false, "The file/path to be used by the executable program for writing its output." },
- { "error-path", eSetVarTypeString, NULL, NULL, false, false, "The file/path to be used by the executable program for writings its error messages." },
- { "plugin", eSetVarTypeEnum, NULL, NULL, false, false, "The plugin to be used to run the process." },
- { "disable-aslr", eSetVarTypeBoolean, "true", NULL, false, false, "Disable Address Space Layout Randomization (ASLR)" },
- { "disable-stdio", eSetVarTypeBoolean, "false", NULL, false, false, "Disable stdin/stdout for process (e.g. for a GUI application)" },
{ NULL, eSetVarTypeNone, NULL, NULL, false, false, NULL }
};
+
Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=144061&r1=144060&r2=144061&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Mon Nov 7 20:43:13 2011
@@ -1973,14 +1973,22 @@
}
-#define TSC_DEFAULT_ARCH "default-arch"
-#define TSC_EXPR_PREFIX "expr-prefix"
-#define TSC_PREFER_DYNAMIC "prefer-dynamic-value"
-#define TSC_SKIP_PROLOGUE "skip-prologue"
-#define TSC_SOURCE_MAP "source-map"
-#define TSC_MAX_CHILDREN "max-children-count"
-#define TSC_MAX_STRLENSUMMARY "max-string-summary-length"
-#define TSC_PLATFORM_AVOID "breakpoints-use-platform-avoid-list"
+#define TSC_DEFAULT_ARCH "default-arch"
+#define TSC_EXPR_PREFIX "expr-prefix"
+#define TSC_PREFER_DYNAMIC "prefer-dynamic-value"
+#define TSC_SKIP_PROLOGUE "skip-prologue"
+#define TSC_SOURCE_MAP "source-map"
+#define TSC_MAX_CHILDREN "max-children-count"
+#define TSC_MAX_STRLENSUMMARY "max-string-summary-length"
+#define TSC_PLATFORM_AVOID "breakpoints-use-platform-avoid-list"
+#define TSC_RUN_ARGS "run-args"
+#define TSC_ENV_VARS "env-vars"
+#define TSC_INHERIT_ENV "inherit-env"
+#define TSC_STDIN_PATH "input-path"
+#define TSC_STDOUT_PATH "output-path"
+#define TSC_STDERR_PATH "error-path"
+#define TSC_DISABLE_ASLR "disable-aslr"
+#define TSC_DISABLE_STDIO "disable-stdio"
static const ConstString &
@@ -2039,6 +2047,61 @@
return g_const_string;
}
+const ConstString &
+GetSettingNameForRunArgs ()
+{
+ static ConstString g_const_string (TSC_RUN_ARGS);
+ return g_const_string;
+}
+
+const ConstString &
+GetSettingNameForEnvVars ()
+{
+ static ConstString g_const_string (TSC_ENV_VARS);
+ return g_const_string;
+}
+
+const ConstString &
+GetSettingNameForInheritHostEnv ()
+{
+ static ConstString g_const_string (TSC_INHERIT_ENV);
+ return g_const_string;
+}
+
+const ConstString &
+GetSettingNameForInputPath ()
+{
+ static ConstString g_const_string (TSC_STDIN_PATH);
+ return g_const_string;
+}
+
+const ConstString &
+GetSettingNameForOutputPath ()
+{
+ static ConstString g_const_string (TSC_STDOUT_PATH);
+ return g_const_string;
+}
+
+const ConstString &
+GetSettingNameForErrorPath ()
+{
+ static ConstString g_const_string (TSC_STDERR_PATH);
+ return g_const_string;
+}
+
+const ConstString &
+GetSettingNameForDisableASLR ()
+{
+ static ConstString g_const_string (TSC_DISABLE_ASLR);
+ return g_const_string;
+}
+
+const ConstString &
+GetSettingNameForDisableSTDIO ()
+{
+ static ConstString g_const_string (TSC_DISABLE_STDIO);
+ return g_const_string;
+}
bool
Target::SettingsController::SetGlobalVariable (const ConstString &var_name,
@@ -2094,7 +2157,16 @@
m_source_map (NULL, NULL),
m_max_children_display(256),
m_max_strlen_length(1024),
- m_breakpoints_use_platform_avoid (true, true)
+ m_breakpoints_use_platform_avoid (true, true),
+ m_run_args (),
+ m_env_vars (),
+ m_input_path (),
+ m_output_path (),
+ m_error_path (),
+ m_disable_aslr (true),
+ m_disable_stdio (false),
+ m_inherit_host_env (true),
+ m_got_host_env (false)
{
// CopyInstanceSettings is a pure virtual function in InstanceSettings; it therefore cannot be called
// until the vtables for TargetInstanceSettings are properly set up, i.e. AFTER all the initializers.
@@ -2121,9 +2193,17 @@
m_prefer_dynamic_value (rhs.m_prefer_dynamic_value),
m_skip_prologue (rhs.m_skip_prologue),
m_source_map (rhs.m_source_map),
- m_max_children_display(rhs.m_max_children_display),
- m_max_strlen_length(rhs.m_max_strlen_length),
- m_breakpoints_use_platform_avoid (rhs.m_breakpoints_use_platform_avoid)
+ m_max_children_display (rhs.m_max_children_display),
+ m_max_strlen_length (rhs.m_max_strlen_length),
+ m_breakpoints_use_platform_avoid (rhs.m_breakpoints_use_platform_avoid),
+ m_run_args (rhs.m_run_args),
+ m_env_vars (rhs.m_env_vars),
+ m_input_path (rhs.m_input_path),
+ m_output_path (rhs.m_output_path),
+ m_error_path (rhs.m_error_path),
+ m_disable_aslr (rhs.m_disable_aslr),
+ m_disable_stdio (rhs.m_disable_stdio),
+ m_inherit_host_env (rhs.m_inherit_host_env)
{
if (m_instance_name != InstanceSettings::GetDefaultName())
{
@@ -2141,6 +2221,22 @@
{
if (this != &rhs)
{
+ m_expr_prefix_file = rhs.m_expr_prefix_file;
+ m_expr_prefix_contents_sp = rhs.m_expr_prefix_contents_sp;
+ m_prefer_dynamic_value = rhs.m_prefer_dynamic_value;
+ m_skip_prologue = rhs.m_skip_prologue;
+ m_source_map = rhs.m_source_map;
+ m_max_children_display = rhs.m_max_children_display;
+ m_max_strlen_length = rhs.m_max_strlen_length;
+ m_breakpoints_use_platform_avoid = rhs.m_breakpoints_use_platform_avoid;
+ m_run_args = rhs.m_run_args;
+ m_env_vars = rhs.m_env_vars;
+ m_input_path = rhs.m_input_path;
+ m_output_path = rhs.m_output_path;
+ m_error_path = rhs.m_error_path;
+ m_disable_aslr = rhs.m_disable_aslr;
+ m_disable_stdio = rhs.m_disable_stdio;
+ m_inherit_host_env = rhs.m_inherit_host_env;
}
return *this;
@@ -2274,6 +2370,39 @@
{
err = UserSettingsController::UpdateBooleanOptionValue (value, op, m_breakpoints_use_platform_avoid);
}
+ else if (var_name == GetSettingNameForRunArgs())
+ {
+ UserSettingsController::UpdateStringArrayVariable (op, index_value, m_run_args, value, err);
+ }
+ else if (var_name == GetSettingNameForEnvVars())
+ {
+ // This is nice for local debugging, but it is isn't correct for
+ // remote debugging. We need to stop process.env-vars from being
+ // populated with the host environment and add this as a launch option
+ // and get the correct environment from the Target's platform.
+ // GetHostEnvironmentIfNeeded ();
+ UserSettingsController::UpdateDictionaryVariable (op, index_value, m_env_vars, value, err);
+ }
+ else if (var_name == GetSettingNameForInputPath())
+ {
+ UserSettingsController::UpdateStringVariable (op, m_input_path, value, err);
+ }
+ else if (var_name == GetSettingNameForOutputPath())
+ {
+ UserSettingsController::UpdateStringVariable (op, m_output_path, value, err);
+ }
+ else if (var_name == GetSettingNameForErrorPath())
+ {
+ UserSettingsController::UpdateStringVariable (op, m_error_path, value, err);
+ }
+ else if (var_name == GetSettingNameForDisableASLR())
+ {
+ UserSettingsController::UpdateBooleanVariable (op, m_disable_aslr, value, true, err);
+ }
+ else if (var_name == GetSettingNameForDisableSTDIO ())
+ {
+ UserSettingsController::UpdateBooleanVariable (op, m_disable_stdio, value, false, err);
+ }
}
void
@@ -2284,13 +2413,7 @@
if (!new_settings_ptr)
return;
- m_expr_prefix_file = new_settings_ptr->m_expr_prefix_file;
- m_expr_prefix_contents_sp = new_settings_ptr->m_expr_prefix_contents_sp;
- m_prefer_dynamic_value = new_settings_ptr->m_prefer_dynamic_value;
- m_skip_prologue = new_settings_ptr->m_skip_prologue;
- m_max_children_display = new_settings_ptr->m_max_children_display;
- m_max_strlen_length = new_settings_ptr->m_max_strlen_length;
- m_breakpoints_use_platform_avoid = new_settings_ptr->m_breakpoints_use_platform_avoid;
+ *this = *new_settings_ptr;
}
bool
@@ -2339,16 +2462,115 @@
else
value.AppendString ("false");
}
+ else if (var_name == GetSettingNameForRunArgs())
+ {
+ if (m_run_args.GetArgumentCount() > 0)
+ {
+ for (int i = 0; i < m_run_args.GetArgumentCount(); ++i)
+ value.AppendString (m_run_args.GetArgumentAtIndex (i));
+ }
+ }
+ else if (var_name == GetSettingNameForEnvVars())
+ {
+ GetHostEnvironmentIfNeeded ();
+
+ if (m_env_vars.size() > 0)
+ {
+ std::map::iterator pos;
+ for (pos = m_env_vars.begin(); pos != m_env_vars.end(); ++pos)
+ {
+ StreamString value_str;
+ value_str.Printf ("%s=%s", pos->first.c_str(), pos->second.c_str());
+ value.AppendString (value_str.GetData());
+ }
+ }
+ }
+ else if (var_name == GetSettingNameForInputPath())
+ {
+ value.AppendString (m_input_path.c_str());
+ }
+ else if (var_name == GetSettingNameForOutputPath())
+ {
+ value.AppendString (m_output_path.c_str());
+ }
+ else if (var_name == GetSettingNameForErrorPath())
+ {
+ value.AppendString (m_error_path.c_str());
+ }
+ else if (var_name == GetSettingNameForInheritHostEnv())
+ {
+ if (m_inherit_host_env)
+ value.AppendString ("true");
+ else
+ value.AppendString ("false");
+ }
+ else if (var_name == GetSettingNameForDisableASLR())
+ {
+ if (m_disable_aslr)
+ value.AppendString ("true");
+ else
+ value.AppendString ("false");
+ }
+ else if (var_name == GetSettingNameForDisableSTDIO())
+ {
+ if (m_disable_stdio)
+ value.AppendString ("true");
+ else
+ value.AppendString ("false");
+ }
else
{
if (err)
err->SetErrorStringWithFormat ("unrecognized variable name '%s'", var_name.AsCString());
return false;
}
-
return true;
}
+void
+Target::TargetInstanceSettings::GetHostEnvironmentIfNeeded ()
+{
+ if (m_inherit_host_env && !m_got_host_env)
+ {
+ m_got_host_env = true;
+ StringList host_env;
+ const size_t host_env_count = Host::GetEnvironment (host_env);
+ for (size_t idx=0; idxfirst);
+ env_var_equal_value.append(1, '=');
+ env_var_equal_value.append (pos->second);
+ env.AppendArgument (env_var_equal_value.c_str());
+ }
+ return env.GetArgumentCount();
+}
+
+
const ConstString
TargetInstanceSettings::CreateInstanceName ()
{
@@ -2395,5 +2617,14 @@
{ TSC_MAX_CHILDREN , eSetVarTypeInt , "256" , NULL, true, false, "Maximum number of children to expand in any level of depth." },
{ TSC_MAX_STRLENSUMMARY , eSetVarTypeInt , "1024" , NULL, true, false, "Maximum number of characters to show when using %s in summary strings." },
{ TSC_PLATFORM_AVOID , eSetVarTypeBoolean, "true" , NULL, false, false, "Consult the platform module avoid list when setting non-module specific breakpoints." },
+ { TSC_RUN_ARGS , eSetVarTypeArray , NULL , NULL, false, false, "A list containing all the arguments to be passed to the executable when it is run." },
+ { TSC_ENV_VARS , eSetVarTypeDictionary, NULL , NULL, false, false, "A list of all the environment variables to be passed to the executable's environment, and their values." },
+ { TSC_INHERIT_ENV , eSetVarTypeBoolean, "true" , NULL, false, false, "Inherit the environment from the process that is running LLDB." },
+ { TSC_STDIN_PATH , eSetVarTypeString , NULL , NULL, false, false, "The file/path to be used by the executable program for reading its standard input." },
+ { TSC_STDOUT_PATH , eSetVarTypeString , NULL , NULL, false, false, "The file/path to be used by the executable program for writing its standard output." },
+ { TSC_STDERR_PATH , eSetVarTypeString , NULL , NULL, false, false, "The file/path to be used by the executable program for writing its standard error." },
+// { "plugin", eSetVarTypeEnum, NULL, NULL, false, false, "The plugin to be used to run the process." },
+ { TSC_DISABLE_ASLR , eSetVarTypeBoolean, "true" , NULL, false, false, "Disable Address Space Layout Randomization (ASLR)" },
+ { TSC_DISABLE_STDIO , eSetVarTypeBoolean, "false" , NULL, false, false, "Disable stdin/stdout for process (e.g. for a GUI application)" },
{ NULL , eSetVarTypeNone , NULL , NULL, false, false, NULL }
};
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=144061&r1=144060&r2=144061&view=diff
==============================================================================
--- lldb/trunk/test/api/check_public_api_headers/TestPublicAPIHeaders.py (original)
+++ lldb/trunk/test/api/check_public_api_headers/TestPublicAPIHeaders.py Mon Nov 7 20:43:13 2011
@@ -67,11 +67,11 @@
env_var = 'DYLD_FRAMEWORK_PATH'
env_val = self.build_dir
- env_cmd = "settings set target.process.env-vars %s=%s" %(env_var, env_val)
+ env_cmd = "settings set target.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.addTearDownHook(lambda: self.runCmd("settings remove target.env-vars %s" % env_var))
self.expect('breakpoint set -f %s -l %d' % (self.source, self.line_to_break),
BREAKPOINT_CREATED,
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=144061&r1=144060&r2=144061&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py (original)
+++ lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py Mon Nov 7 20:43:13 2011
@@ -82,13 +82,13 @@
# Try running with the DYLD_LIBRARY_PATH environment variable set, make sure
# we pick up the hidden dylib.
- env_cmd_string = "settings set target.process.env-vars " + dylibPath + "=" + new_dir
+ env_cmd_string = "settings set target.env-vars " + dylibPath + "=" + new_dir
if self.TraceOn():
print "Set environment to: ", env_cmd_string
self.runCmd(env_cmd_string)
- self.runCmd("settings show target.process.env-vars")
+ self.runCmd("settings show target.env-vars")
- remove_dyld_path_cmd = "settings remove target.process.env-vars " + dylibPath
+ remove_dyld_path_cmd = "settings remove target.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,
Modified: lldb/trunk/test/settings/TestSettings.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/settings/TestSettings.py?rev=144061&r1=144060&r2=144061&view=diff
==============================================================================
--- lldb/trunk/test/settings/TestSettings.py (original)
+++ lldb/trunk/test/settings/TestSettings.py Mon Nov 7 20:43:13 2011
@@ -23,7 +23,7 @@
"""Test that 'apropos' command should also search descriptions for the settings variables."""
self.expect("apropos 'environment variable'",
- substrs = ["target.process.env-vars",
+ substrs = ["target.env-vars",
"environment variables",
"executable's environment"])
@@ -99,12 +99,12 @@
# Set the run-args and the env-vars.
# And add hooks to restore the settings during tearDown().
- self.runCmd('settings set target.process.run-args A B C')
+ self.runCmd('settings set target.run-args A B C')
self.addTearDownHook(
- lambda: self.runCmd("settings set -r target.process.run-args"))
- self.runCmd('settings set target.process.env-vars ["MY_ENV_VAR"]=YES')
+ lambda: self.runCmd("settings set -r target.run-args"))
+ self.runCmd('settings set target.env-vars ["MY_ENV_VAR"]=YES')
self.addTearDownHook(
- lambda: self.runCmd("settings set -r target.process.env-vars"))
+ lambda: self.runCmd("settings set -r target.env-vars"))
self.runCmd("run", RUN_SUCCEEDED)
@@ -126,8 +126,8 @@
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# By default, inherit-env is 'true'.
- self.expect('settings show target.process.inherit-env', "Default inherit-env is 'true'",
- startstr = "target.process.inherit-env (boolean) = true")
+ self.expect('settings show target.inherit-env', "Default inherit-env is 'true'",
+ startstr = "target.inherit-env (boolean) = true")
# Set some host environment variables now.
os.environ["MY_HOST_ENV_VAR1"] = "VAR1"
@@ -150,34 +150,34 @@
"The host environment variable 'MY_HOST_ENV_VAR2' successfully passed."])
def test_set_error_output_path(self):
- """Test that setting target.process.error/output-path for the launched process works."""
+ """Test that setting target.error/output-path for the launched process works."""
self.buildDefault()
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Set the error-path and output-path and verify both are set.
- self.runCmd("settings set target.process.error-path stderr.txt")
- self.runCmd("settings set target.process.output-path stdout.txt")
+ self.runCmd("settings set target.error-path stderr.txt")
+ self.runCmd("settings set target.output-path stdout.txt")
# And add hooks to restore the original settings during tearDown().
self.addTearDownHook(
- lambda: self.runCmd("settings set -r target.process.output-path"))
+ lambda: self.runCmd("settings set -r target.output-path"))
self.addTearDownHook(
- lambda: self.runCmd("settings set -r target.process.error-path"))
+ lambda: self.runCmd("settings set -r target.error-path"))
- self.expect("settings show target.process.error-path",
- SETTING_MSG("target.process.error-path"),
- startstr = 'target.process.error-path (string) = "stderr.txt"')
-
- self.expect("settings show target.process.output-path",
- SETTING_MSG("target.process.output-path"),
- startstr = 'target.process.output-path (string) = "stdout.txt"')
+ self.expect("settings show target.error-path",
+ SETTING_MSG("target.error-path"),
+ startstr = 'target.error-path (string) = "stderr.txt"')
+
+ self.expect("settings show target.output-path",
+ SETTING_MSG("target.output-path"),
+ startstr = 'target.output-path (string) = "stdout.txt"')
self.runCmd("run", RUN_SUCCEEDED)
# The 'stderr.txt' file should now exist.
self.assertTrue(os.path.isfile("stderr.txt"),
- "'stderr.txt' exists due to target.process.error-path.")
+ "'stderr.txt' exists due to target.error-path.")
# Read the output file produced by running the program.
with open('stderr.txt', 'r') as f:
@@ -188,7 +188,7 @@
# The 'stdout.txt' file should now exist.
self.assertTrue(os.path.isfile("stdout.txt"),
- "'stdout.txt' exists due to target.process.output-path.")
+ "'stdout.txt' exists due to target.output-path.")
# Read the output file produced by running the program.
with open('stdout.txt', 'r') as f:
@@ -198,35 +198,35 @@
startstr = "This message should go to standard out.")
def test_print_dictionary_setting(self):
- self.runCmd ("settings set -r target.process.env-vars")
- self.runCmd ("settings set target.process.env-vars [\"MY_VAR\"]=some-value")
- self.expect ("settings show target.process.env-vars",
+ self.runCmd ("settings set -r target.env-vars")
+ self.runCmd ("settings set target.env-vars [\"MY_VAR\"]=some-value")
+ self.expect ("settings show target.env-vars",
substrs = [ "MY_VAR=some-value" ])
- self.runCmd ("settings set -r target.process.env-vars")
+ self.runCmd ("settings set -r target.env-vars")
def test_print_array_setting(self):
- self.runCmd ("settings set -r target.process.run-args")
- self.runCmd ("settings set target.process.run-args gobbledy-gook")
- self.expect ("settings show target.process.run-args",
+ self.runCmd ("settings set -r target.run-args")
+ self.runCmd ("settings set target.run-args gobbledy-gook")
+ self.expect ("settings show target.run-args",
substrs = [ '[0]: "gobbledy-gook"' ])
- self.runCmd ("settings set -r target.process.run-args")
+ self.runCmd ("settings set -r target.run-args")
def test_settings_with_quotes (self):
- self.runCmd ("settings set -r target.process.run-args")
- self.runCmd ("settings set target.process.run-args a b c")
- self.expect ("settings show target.process.run-args",
+ self.runCmd ("settings set -r target.run-args")
+ self.runCmd ("settings set target.run-args a b c")
+ self.expect ("settings show target.run-args",
substrs = [ '[0]: "a"',
'[1]: "b"',
'[2]: "c"' ])
- self.runCmd ("settings set target.process.run-args 'a b c'")
- self.expect ("settings show target.process.run-args",
+ self.runCmd ("settings set target.run-args 'a b c'")
+ self.expect ("settings show target.run-args",
substrs = [ '[0]: "a b c"' ])
- self.runCmd ("settings set -r target.process.run-args")
- self.runCmd ("settings set -r target.process.env-vars")
- self.runCmd ('settings set target.process.env-vars ["MY_FILE"]="this is a file name with spaces.txt"')
- self.expect ("settings show target.process.env-vars",
+ self.runCmd ("settings set -r target.run-args")
+ self.runCmd ("settings set -r target.env-vars")
+ self.runCmd ('settings set target.env-vars ["MY_FILE"]="this is a file name with spaces.txt"')
+ self.expect ("settings show target.env-vars",
substrs = [ 'MY_FILE=this is a file name with spaces.txt' ])
- self.runCmd ("settings set -r target.process.env-vars")
+ self.runCmd ("settings set -r target.env-vars")
def test_all_settings_exist (self):
@@ -240,15 +240,14 @@
"auto-confirm (boolean) = ",
"target.default-arch (string) =",
"target.expr-prefix (string) = ",
- "target.process.run-args (array) =",
- "target.process.env-vars (dictionary) =",
- "target.process.inherit-env (boolean) = ",
- "target.process.input-path (string) = ",
- "target.process.output-path (string) = ",
- "target.process.error-path (string) = ",
- "target.process.plugin (enum) =",
- "target.process.disable-aslr (boolean) = ",
- "target.process.disable-stdio (boolean) = ",
+ "target.run-args (array) =",
+ "target.env-vars (dictionary) =",
+ "target.inherit-env (boolean) = ",
+ "target.input-path (string) = ",
+ "target.output-path (string) = ",
+ "target.error-path (string) = ",
+ "target.disable-aslr (boolean) = ",
+ "target.disable-stdio (boolean) = ",
"target.process.thread.step-avoid-regexp (string) =",
"target.process.thread.trace-thread (boolean) =" ])
Modified: lldb/trunk/tools/driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=144061&r1=144060&r2=144061&view=diff
==============================================================================
--- lldb/trunk/tools/driver/Driver.cpp (original)
+++ lldb/trunk/tools/driver/Driver.cpp Mon Nov 7 20:43:13 2011
@@ -1251,13 +1251,13 @@
if (num_args > 1)
{
- m_debugger.HandleCommand ("settings clear target.process.run-args");
+ m_debugger.HandleCommand ("settings clear target.run-args");
char arg_cstr[1024];
for (size_t arg_idx = 1; arg_idx < num_args; ++arg_idx)
{
::snprintf (arg_cstr,
sizeof(arg_cstr),
- "settings append target.process.run-args \"%s\"",
+ "settings append target.run-args \"%s\"",
m_option_data.m_args[arg_idx].c_str());
m_debugger.HandleCommand (arg_cstr);
}
From jingham at apple.com Mon Nov 7 21:00:12 2011
From: jingham at apple.com (Jim Ingham)
Date: Tue, 08 Nov 2011 03:00:12 -0000
Subject: [Lldb-commits] [lldb] r144064 - in /lldb/trunk:
include/lldb/Target/Process.h include/lldb/Target/StopInfo.h
source/Expression/ClangUserExpression.cpp source/Target/Process.cpp
source/Target/StopInfo.cpp
test/functionalities/conditional_break/TestConditionalBreak.py
test/functionalities/conditional_break/conditional_break.py
Message-ID: <20111108030012.574B63524001@llvm.org>
Author: jingham
Date: Mon Nov 7 21:00:11 2011
New Revision: 144064
URL: http://llvm.org/viewvc/llvm-project?rev=144064&view=rev
Log:
Do a better job of detecting when a breakpoint command has set the target running again (except you have to ignore
cases where the breakpoint runs expressions, those don't count as really "running again").
Modified:
lldb/trunk/include/lldb/Target/Process.h
lldb/trunk/include/lldb/Target/StopInfo.h
lldb/trunk/source/Expression/ClangUserExpression.cpp
lldb/trunk/source/Target/Process.cpp
lldb/trunk/source/Target/StopInfo.cpp
lldb/trunk/test/functionalities/conditional_break/TestConditionalBreak.py
lldb/trunk/test/functionalities/conditional_break/conditional_break.py
Modified: lldb/trunk/include/lldb/Target/Process.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=144064&r1=144063&r2=144064&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Mon Nov 7 21:00:11 2011
@@ -890,8 +890,11 @@
friend bool operator== (const ProcessModID &lhs, const ProcessModID &rhs);
public:
ProcessModID () :
- m_stop_id (0),
- m_memory_id (0)
+ m_stop_id (0),
+ m_resume_id (0),
+ m_memory_id (0),
+ m_last_user_expression_resume (0),
+ m_running_user_expression (false)
{}
ProcessModID (const ProcessModID &rhs) :
@@ -911,11 +914,22 @@
~ProcessModID () {}
- void BumpStopID () { m_stop_id++; }
+ void BumpStopID () {
+ m_stop_id++;
+ }
+
void BumpMemoryID () { m_memory_id++; }
+ void BumpResumeID () {
+ m_resume_id++;
+ if (m_running_user_expression > 0)
+ m_last_user_expression_resume = m_resume_id;
+ }
+
uint32_t GetStopID() const { return m_stop_id; }
uint32_t GetMemoryID () const { return m_memory_id; }
+ uint32_t GetResumeID () const { return m_resume_id; }
+ uint32_t GetLastUserExpressionResumeID () const { return m_last_user_expression_resume; }
bool MemoryIDEqual (const ProcessModID &compare) const
{
@@ -936,9 +950,23 @@
{
return m_stop_id != UINT32_MAX;
}
+
+ void
+ SetRunningUserExpression (bool on)
+ {
+ // REMOVEME printf ("Setting running user expression %s at resume id %d - value: %d.\n", on ? "on" : "off", m_resume_id, m_running_user_expression);
+ if (on)
+ m_running_user_expression++;
+ else
+ m_running_user_expression--;
+ }
+
private:
uint32_t m_stop_id;
+ uint32_t m_resume_id;
uint32_t m_memory_id;
+ uint32_t m_last_user_expression_resume;
+ uint32_t m_running_user_expression;
};
inline bool operator== (const ProcessModID &lhs, const ProcessModID &rhs)
{
@@ -1957,12 +1985,30 @@
return m_mod_id;
}
+ const ProcessModID &
+ GetModIDRef () const
+ {
+ return m_mod_id;
+ }
+
uint32_t
GetStopID () const
{
return m_mod_id.GetStopID();
}
+ uint32_t
+ GetResumeID () const
+ {
+ return m_mod_id.GetResumeID();
+ }
+
+ uint32_t
+ GetLastUserExpressionResumeID () const
+ {
+ return m_mod_id.GetLastUserExpressionResumeID();
+ }
+
//------------------------------------------------------------------
/// Set accessor for the process exit status (return code).
///
@@ -2608,6 +2654,9 @@
return true;
}
+ void
+ SetRunningUserExpression (bool on);
+
//------------------------------------------------------------------
// lldb::ExecutionContextScope pure virtual functions
//------------------------------------------------------------------
Modified: lldb/trunk/include/lldb/Target/StopInfo.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/StopInfo.h?rev=144064&r1=144063&r2=144064&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/StopInfo.h (original)
+++ lldb/trunk/include/lldb/Target/StopInfo.h Mon Nov 7 21:00:11 2011
@@ -22,6 +22,7 @@
class StopInfo
{
+ friend class Process;
public:
//------------------------------------------------------------------
// Constructors and Destructors
@@ -136,13 +137,13 @@
//------------------------------------------------------------------
Thread & m_thread; // The thread corresponding to the stop reason.
uint32_t m_stop_id; // The process stop ID for which this stop info is valid
+ uint32_t m_resume_id; // This is the resume ID when we made this stop ID.
uint64_t m_value; // A generic value that can be used for things pertaining to this stop info
std::string m_description; // A textual description describing this stop.
- // This provides an accessor to the PrivateEventState of the process for StopInfo's w/o having to make each
- // StopInfo subclass a friend of Process.
- lldb::StateType
- GetPrivateState ();
+ // This determines whether the target has run since this stop info.
+ // N.B. running to evaluate a user expression does not count.
+ bool HasTargetRunSinceMe ();
private:
friend class Thread;
Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUserExpression.cpp?rev=144064&r1=144063&r2=144064&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangUserExpression.cpp (original)
+++ lldb/trunk/source/Expression/ClangUserExpression.cpp Mon Nov 7 21:00:11 2011
@@ -567,6 +567,9 @@
if (log)
log->Printf("-- [ClangUserExpression::Execute] Execution of expression begins --");
+ if (exe_ctx.GetProcessPtr())
+ exe_ctx.GetProcessPtr()->SetRunningUserExpression(true);
+
ExecutionResults execution_result = exe_ctx.GetProcessRef().RunThreadPlan (exe_ctx,
call_plan_sp,
stop_others,
@@ -575,6 +578,9 @@
single_thread_timeout_usec,
error_stream);
+ if (exe_ctx.GetProcessPtr())
+ exe_ctx.GetProcessPtr()->SetRunningUserExpression(false);
+
if (log)
log->Printf("-- [ClangUserExpression::Execute] Execution of expression completed --");
Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=144064&r1=144063&r2=144064&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Mon Nov 7 21:00:11 2011
@@ -1156,6 +1156,12 @@
}
}
+void
+Process::SetRunningUserExpression (bool on)
+{
+ m_mod_id.SetRunningUserExpression (on);
+}
+
addr_t
Process::GetImageInfoAddress()
{
@@ -2425,6 +2431,7 @@
// to see if they are suppoed to start back up with a signal.
if (m_thread_list.WillResume())
{
+ m_mod_id.BumpResumeID();
error = DoResume();
if (error.Success())
{
@@ -2986,18 +2993,47 @@
// If we're stopped and haven't restarted, then do the breakpoint commands here:
if (m_state == eStateStopped && ! m_restarted)
- {
- int num_threads = m_process_sp->GetThreadList().GetSize();
+ {
+ ThreadList &curr_thread_list = m_process_sp->GetThreadList();
+ int num_threads = curr_thread_list.GetSize();
int idx;
// The actions might change one of the thread's stop_info's opinions about whether we should
// stop the process, so we need to query that as we go.
+
+ // One other complication here, is that we try to catch any case where the target has run (except for expressions)
+ // and immediately exit, but if we get that wrong (which is possible) then the thread list might have changed, and
+ // that would cause our iteration here to crash. We could make a copy of the thread list, but we'd really like
+ // to also know if it has changed at all, so we make up a vector of the thread ID's and check what we get back
+ // against this list & bag out if anything differs.
+ std::vector thread_index_array(num_threads);
+ for (idx = 0; idx < num_threads; ++idx)
+ thread_index_array[idx] = curr_thread_list.GetThreadAtIndex(idx)->GetIndexID();
+
bool still_should_stop = true;
for (idx = 0; idx < num_threads; ++idx)
{
- lldb::ThreadSP thread_sp = m_process_sp->GetThreadList().GetThreadAtIndex(idx);
-
+ curr_thread_list = m_process_sp->GetThreadList();
+ if (curr_thread_list.GetSize() != num_threads)
+ {
+ lldb::LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP | LIBLLDB_LOG_PROCESS));
+ log->Printf("Number of threads changed from %d to %d while processing event.", num_threads, curr_thread_list.GetSize());
+ break;
+ }
+
+ lldb::ThreadSP thread_sp = curr_thread_list.GetThreadAtIndex(idx);
+
+ if (thread_sp->GetIndexID() != thread_index_array[idx])
+ {
+ lldb::LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP | LIBLLDB_LOG_PROCESS));
+ log->Printf("The thread at position %d changed from %d to %d while processing event.",
+ idx,
+ thread_index_array[idx],
+ thread_sp->GetIndexID());
+ break;
+ }
+
StopInfoSP stop_info_sp = thread_sp->GetStopInfo ();
if (stop_info_sp)
{
@@ -3006,7 +3042,9 @@
// event so that whoever is receiving it will know to wait for the running event and reflect
// that state appropriately.
// We also need to stop processing actions, since they aren't expecting the target to be running.
- if (m_process_sp->GetPrivateState() == eStateRunning)
+
+ // FIXME: we might have run.
+ if (stop_info_sp->HasTargetRunSinceMe())
{
SetRestarted (true);
break;
Modified: lldb/trunk/source/Target/StopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StopInfo.cpp?rev=144064&r1=144063&r2=144064&view=diff
==============================================================================
--- lldb/trunk/source/Target/StopInfo.cpp (original)
+++ lldb/trunk/source/Target/StopInfo.cpp Mon Nov 7 21:00:11 2011
@@ -35,6 +35,7 @@
StopInfo::StopInfo (Thread &thread, uint64_t value) :
m_thread (thread),
m_stop_id (thread.GetProcess().GetStopID()),
+ m_resume_id (thread.GetProcess().GetResumeID()),
m_value (value)
{
}
@@ -49,12 +50,37 @@
StopInfo::MakeStopInfoValid ()
{
m_stop_id = m_thread.GetProcess().GetStopID();
+ m_resume_id = m_thread.GetProcess().GetResumeID();
}
-lldb::StateType
-StopInfo::GetPrivateState ()
+bool
+StopInfo::HasTargetRunSinceMe ()
{
- return m_thread.GetProcess().GetPrivateState();
+ lldb::StateType ret_type = m_thread.GetProcess().GetPrivateState();
+ if (ret_type == eStateRunning)
+ {
+ return true;
+ }
+ else if (ret_type == eStateStopped)
+ {
+ // This is a little tricky. We want to count "run and stopped again before you could
+ // ask this question as a "TRUE" answer to HasTargetRunSinceMe. But we don't want to
+ // include any running of the target done for expressions. So we track both resumes,
+ // and resumes caused by expressions, and check if there are any resumes NOT caused
+ // by expressions.
+
+ uint32_t curr_resume_id = m_thread.GetProcess().GetResumeID();
+ uint32_t last_user_expression_id = m_thread.GetProcess().GetLastUserExpressionResumeID ();
+ if (curr_resume_id == m_resume_id)
+ {
+ return false;
+ }
+ else if (curr_resume_id > last_user_expression_id)
+ {
+ return true;
+ }
+ }
+ return false;
}
//----------------------------------------------------------------------
@@ -161,7 +187,7 @@
// However we want to run all the callbacks, except of course if one of them actually
// resumes the target.
// So we use stop_requested to track what we're were asked to do.
- bool stop_requested = true;
+ bool stop_requested = false;
for (size_t j = 0; j < num_owners; j++)
{
lldb::BreakpointLocationSP bp_loc_sp = bp_site_sp->GetOwnerAtIndex(j);
@@ -170,11 +196,30 @@
&m_thread,
m_thread.GetStackFrameAtIndex(0).get(),
false);
- stop_requested = bp_loc_sp->InvokeCallback (&context);
+ bool callback_return;
+
+ // FIXME: For now the callbacks have to run in async mode - the first time we restart we need
+ // to get out of there. So set it here.
+ // When we figure out how to stack breakpoint hits then this will change.
+
+ Debugger &debugger = m_thread.GetProcess().GetTarget().GetDebugger();
+ bool old_async = debugger.GetAsyncExecution();
+ debugger.SetAsyncExecution (true);
+
+ callback_return = bp_loc_sp->InvokeCallback (&context);
+
+ debugger.SetAsyncExecution (old_async);
+
+ if (callback_return)
+ stop_requested = true;
+
// Also make sure that the callback hasn't continued the target.
// If it did, when we'll set m_should_start to false and get out of here.
- if (GetPrivateState() == eStateRunning)
+ if (HasTargetRunSinceMe ())
+ {
m_should_stop = false;
+ break;
+ }
}
if (m_should_stop && !stop_requested)
@@ -423,7 +468,7 @@
bool stop_requested = wp_sp->InvokeCallback (&context);
// Also make sure that the callback hasn't continued the target.
// If it did, when we'll set m_should_start to false and get out of here.
- if (GetPrivateState() == eStateRunning)
+ if (HasTargetRunSinceMe ())
m_should_stop = false;
if (m_should_stop && !stop_requested)
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=144064&r1=144063&r2=144064&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/conditional_break/TestConditionalBreak.py (original)
+++ lldb/trunk/test/functionalities/conditional_break/TestConditionalBreak.py Mon Nov 7 21:00:11 2011
@@ -71,6 +71,7 @@
# The 10 in range(10) is just an arbitrary number, which means we would
# like to try for at most 10 times.
for j in range(10):
+ print "j is: ", j
thread = process.GetThreadAtIndex(0)
if thread.GetNumFrames() >= 2:
@@ -102,9 +103,13 @@
# executable, sets the breakpoint on c(), and adds the callback for the
# breakpoint such that lldb only stops when the caller of c() is a().
# the "my" package that defines the date() function.
+ print "About to source .lldb"
+
self.runCmd("command source .lldb")
+ print "About to run."
self.runCmd("run", RUN_SUCCEEDED)
+ print "Done running"
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
Modified: lldb/trunk/test/functionalities/conditional_break/conditional_break.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/conditional_break/conditional_break.py?rev=144064&r1=144063&r2=144064&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/conditional_break/conditional_break.py (original)
+++ lldb/trunk/test/functionalities/conditional_break/conditional_break.py Mon Nov 7 21:00:11 2011
@@ -7,7 +7,8 @@
dbg = lldb.SBDebugger.FindDebuggerWithID(lldb.debugger_unique_id)
# Perform synchronous interaction with the debugger.
- dbg.SetAsync(False)
+ old_async = dbg.GetAsync()
+ dbg.SetAsync(True)
# Retrieve the target, process, and the only thread.
target = dbg.GetSelectedTarget()
@@ -18,17 +19,19 @@
# of the leaf function c() is a(). If it's not the right caller, we ask the
# command interpreter to continue execution.
- #print >> sys.stdout, "Checking call frames..."
- #lldbutil.print_stacktrace(thread)
+ print >> sys.stdout, "Checking call frames..."
+ lldbutil.print_stacktrace(thread)
+ should_stop = True
if thread.GetNumFrames() >= 2:
funcs = lldbutil.get_function_names(thread)
- #print >> sys.stdout, funcs[0], "called from", funcs[1]
+ print >> sys.stdout, funcs[0], "called from", funcs[1]
if (funcs[0] == 'c' and funcs[1] == 'a'):
- #print >> sys.stdout, "Stopped at c() with immediate caller as a()."
- pass
+ should_stop = True
else:
- #print >> sys.stdout, "Continuing..."
process.Continue()
+ should_stop = False
+
+ dbg.SetAsync(old_async)
+ return should_stop
- return True
From jmolenda at apple.com Mon Nov 7 21:52:17 2011
From: jmolenda at apple.com (Jason Molenda)
Date: Tue, 08 Nov 2011 03:52:17 -0000
Subject: [Lldb-commits] [lldb] r144069 -
/lldb/trunk/source/Core/DataExtractor.cpp
Message-ID: <20111108035217.A2E312A6C12C@llvm.org>
Author: jmolenda
Date: Mon Nov 7 21:52:17 2011
New Revision: 144069
URL: http://llvm.org/viewvc/llvm-project?rev=144069&view=rev
Log:
Bitfields in uint8_t's will have format eFormatChar and DataExtractor::Dump
doesn't handle bitfields in eFormatChar's correctly, only eFormatUnsigned.
Fix DataExtractor::Dump to dump the bitfield eFormatChars correctly.
Modified:
lldb/trunk/source/Core/DataExtractor.cpp
Modified: lldb/trunk/source/Core/DataExtractor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/DataExtractor.cpp?rev=144069&r1=144068&r2=144069&view=diff
==============================================================================
--- lldb/trunk/source/Core/DataExtractor.cpp (original)
+++ lldb/trunk/source/Core/DataExtractor.cpp Mon Nov 7 21:52:17 2011
@@ -1440,6 +1440,9 @@
case eFormatChar:
case eFormatCharPrintable:
case eFormatCharArray:
+ if (item_bit_size < 8)
+ s->Printf ("%llu", GetMaxU64Bitfield(&offset, item_byte_size, item_bit_size, item_bit_offset));
+ else
{
// If we are only printing one character surround it with single
// quotes
From jmolenda at apple.com Mon Nov 7 22:28:12 2011
From: jmolenda at apple.com (Jason Molenda)
Date: Tue, 08 Nov 2011 04:28:12 -0000
Subject: [Lldb-commits] [lldb] r144074 - in
/lldb/trunk/tools/debugserver/source: DNB.cpp DNB.h MacOSX/MachProcess.cpp
MacOSX/MachProcess.h MacOSX/MachTask.cpp MacOSX/MachTask.h
MacOSX/MachVMMemory.cpp MacOSX/MachVMMemory.h MacOSX/MachVMRegion.h
RNBRemote.cpp RNBRemote.h
Message-ID: <20111108042813.168043524001@llvm.org>
Author: jmolenda
Date: Mon Nov 7 22:28:12 2011
New Revision: 144074
URL: http://llvm.org/viewvc/llvm-project?rev=144074&view=rev
Log:
Add "QAddressIsExecutable" packet to debugserver. Used to test
whether a given address is in an executable region of memory or
not. I haven't written the lldb side that will use this packet it
hasn't been tested yet but it's a simple enough bit of code.
I want to have this feature available for the unwinder code. When
we're stopped at an address with no valid symbol context, there are
a number of questions I'd like to ask --
is the current pc value in an executable region (e.g. did they
jump to unallocated/unexecutable memory? we know how to unwind
from here if so.)
Is the stack pointer or the frame pointer the correct register
to use to find the caller's saved pc value?
Once we're past the first frame we can trust things like eh_frame
and ABI unwind schemes but the first frame is challenging and having
a way to check potential addresses to see if they're executable or
not would help narrow down the possibilities a lot.
Modified:
lldb/trunk/tools/debugserver/source/DNB.cpp
lldb/trunk/tools/debugserver/source/DNB.h
lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp
lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.h
lldb/trunk/tools/debugserver/source/MacOSX/MachTask.cpp
lldb/trunk/tools/debugserver/source/MacOSX/MachTask.h
lldb/trunk/tools/debugserver/source/MacOSX/MachVMMemory.cpp
lldb/trunk/tools/debugserver/source/MacOSX/MachVMMemory.h
lldb/trunk/tools/debugserver/source/MacOSX/MachVMRegion.h
lldb/trunk/tools/debugserver/source/RNBRemote.cpp
lldb/trunk/tools/debugserver/source/RNBRemote.h
Modified: lldb/trunk/tools/debugserver/source/DNB.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/DNB.cpp?rev=144074&r1=144073&r2=144074&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/DNB.cpp (original)
+++ lldb/trunk/tools/debugserver/source/DNB.cpp Mon Nov 7 22:28:12 2011
@@ -1124,6 +1124,34 @@
return 0;
}
+//----------------------------------------------------------------------
+// Try to determine if a given address in the process PID is in an
+// executable region or not. Used for sniffing potential caller addresses
+// when unwinding a stack and we're making guesses about where the caller
+// frame addr might be saved.
+//
+// RETURNS: 1 if executable
+// 0 if not executable
+// -1 if we cannot make a determination on this target
+//
+// Note that unmapped memory (an address that is not an allocated page in
+// PID) will return as 0 - it is not executable memory. -1 is intended
+// for a platform where we can't inspect memory region attributes.
+//----------------------------------------------------------------------
+int
+DNBIsAddressExecutable (nub_process_t pid, nub_addr_t addr)
+{
+ MachProcessSP procSP;
+ if (GetProcessSP (pid, procSP))
+ {
+ if (procSP->IsAddressExecutable(addr))
+ return 1;
+ else
+ return 0;
+ }
+ return -1;
+}
+
//----------------------------------------------------------------------
// Formatted output that uses memory and registers from process and
Modified: lldb/trunk/tools/debugserver/source/DNB.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/DNB.h?rev=144074&r1=144073&r2=144074&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/DNB.h (original)
+++ lldb/trunk/tools/debugserver/source/DNB.h Mon Nov 7 22:28:12 2011
@@ -66,6 +66,7 @@
nub_size_t DNBProcessMemoryWrite (nub_process_t pid, nub_addr_t addr, nub_size_t size, const void *buf) DNB_EXPORT;
nub_addr_t DNBProcessMemoryAllocate (nub_process_t pid, nub_size_t size, uint32_t permissions) DNB_EXPORT;
nub_bool_t DNBProcessMemoryDeallocate (nub_process_t pid, nub_addr_t addr) DNB_EXPORT;
+int DNBIsAddressExecutable (nub_process_t pid, nub_addr_t addr) ;
//----------------------------------------------------------------------
// Process status
//----------------------------------------------------------------------
Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp?rev=144074&r1=144073&r2=144074&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp Mon Nov 7 22:28:12 2011
@@ -478,7 +478,6 @@
return true;
}
-
nub_size_t
MachProcess::RemoveTrapsFromBuffer (nub_addr_t addr, nub_size_t size, uint8_t *buf) const
{
@@ -604,6 +603,11 @@
return bytes_written;
}
+bool
+MachProcess::IsAddressExecutable(nub_addr_t address)
+{
+ return m_task.IsAddressExecutable (address);
+}
void
MachProcess::ReplyToAllExceptions ()
Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.h?rev=144074&r1=144073&r2=144074&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.h (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.h Mon Nov 7 22:28:12 2011
@@ -99,6 +99,7 @@
bool Detach ();
nub_size_t ReadMemory (nub_addr_t addr, nub_size_t size, void *buf);
nub_size_t WriteMemory (nub_addr_t addr, nub_size_t size, const void *buf);
+ bool IsAddressExecutable(nub_addr_t address);
//----------------------------------------------------------------------
// Path and arg accessors
Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachTask.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachTask.cpp?rev=144074&r1=144073&r2=144074&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachTask.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachTask.cpp Mon Nov 7 22:28:12 2011
@@ -205,6 +205,23 @@
}
//----------------------------------------------------------------------
+// MachTask::IsAddressExecutable
+//----------------------------------------------------------------------
+bool
+MachTask::IsAddressExecutable (nub_addr_t addr)
+{
+ task_t task = TaskPort();
+ bool ret = false;
+ if (task != TASK_NULL)
+ {
+ ret = m_vm_memory.IsExecutable(task, addr);
+ DNBLogThreadedIf(LOG_MEMORY, "MachTask::IsAddressExecutable ( addr = 0x%8.8llx ) => %s", (uint64_t)addr, (ret ? "true" : "false"));
+ }
+ return ret;
+}
+
+
+//----------------------------------------------------------------------
// MachTask::TaskPortForProcessID
//----------------------------------------------------------------------
task_t
Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachTask.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachTask.h?rev=144074&r1=144073&r2=144074&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachTask.h (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachTask.h Mon Nov 7 22:28:12 2011
@@ -64,6 +64,7 @@
nub_size_t ReadMemory (nub_addr_t addr, nub_size_t size, void *buf);
nub_size_t WriteMemory (nub_addr_t addr, nub_size_t size, const void *buf);
+ bool IsAddressExecutable (nub_addr_t addr) ;
nub_addr_t AllocateMemory (nub_size_t size, uint32_t permissions);
nub_bool_t DeallocateMemory (nub_addr_t addr);
Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachVMMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachVMMemory.cpp?rev=144074&r1=144073&r2=144074&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachVMMemory.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachVMMemory.cpp Mon Nov 7 22:28:12 2011
@@ -52,6 +52,17 @@
return count;
}
+bool
+MachVMMemory::IsExecutable(task_t task, nub_addr_t address)
+{
+ MachVMRegion vmRegion(task);
+
+ if (vmRegion.GetRegionForAddress(address) && vmRegion.IsExecutable())
+ return true;
+ else
+ return false;
+}
+
nub_size_t
MachVMMemory::Read(task_t task, nub_addr_t address, void *data, nub_size_t data_count)
{
Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachVMMemory.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachVMMemory.h?rev=144074&r1=144073&r2=144074&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachVMMemory.h (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachVMMemory.h Mon Nov 7 22:28:12 2011
@@ -27,6 +27,7 @@
nub_size_t Read(task_t task, nub_addr_t address, void *data, nub_size_t data_count);
nub_size_t Write(task_t task, nub_addr_t address, const void *data, nub_size_t data_count);
nub_size_t PageSize();
+ bool IsExecutable(task_t task, nub_addr_t address);
protected:
nub_size_t MaxBytesLeftInPage(nub_addr_t addr, nub_size_t count);
Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachVMRegion.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachVMRegion.h?rev=144074&r1=144073&r2=144074&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachVMRegion.h (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachVMRegion.h Mon Nov 7 22:28:12 2011
@@ -42,6 +42,9 @@
bool SetProtections(mach_vm_address_t addr, mach_vm_size_t size, vm_prot_t prot);
bool RestoreProtections();
bool GetRegionForAddress(nub_addr_t addr);
+
+ bool IsExecutable() const { return (m_data.protection & VM_PROT_EXECUTE) == VM_PROT_EXECUTE; }
+
protected:
#if defined (VM_REGION_SUBMAP_SHORT_INFO_COUNT_64)
typedef vm_region_submap_short_info_data_64_t RegionInfo;
Modified: lldb/trunk/tools/debugserver/source/RNBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/RNBRemote.cpp?rev=144074&r1=144073&r2=144074&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/RNBRemote.cpp (original)
+++ lldb/trunk/tools/debugserver/source/RNBRemote.cpp Mon Nov 7 22:28:12 2011
@@ -186,6 +186,8 @@
// t.push_back (Packet (pass_signals_to_inferior, &RNBRemote::HandlePacket_UNIMPLEMENTED, NULL, "QPassSignals:", "Specify which signals are passed to the inferior"));
t.push_back (Packet (allocate_memory, &RNBRemote::HandlePacket_AllocateMemory, NULL, "_M", "Allocate memory in the inferior process."));
t.push_back (Packet (deallocate_memory, &RNBRemote::HandlePacket_DeallocateMemory, NULL, "_m", "Deallocate memory in the inferior process."));
+ t.push_back (Packet (address_is_executable, &RNBRemote::HandlePacket_IsAddressExecutable, NULL, "QAddressIsExecutable", "Indicate if an address is in an executable region or not"));
+
}
@@ -3238,6 +3240,45 @@
return rnb_success;
}
+rnb_err_t
+RNBRemote::HandlePacket_IsAddressExecutable (const char *p)
+{
+ /* This tells us whether the specified address is in an executable region
+ in the remote process or not. Examples of use:
+ QAddressIsExecutable,3a55140
+ AddressIsInExecutableRegion
+
+ QAddressIsExecutable,0
+ AddressIsNotInExecutableRegion
+
+ QAddressIsExecutable,3a551140 (on a different platform)
+ CannotDetermineRegionAttributes
+ */
+
+ p += sizeof ("QAddressIsExecutable") - 1;
+ if (*p == '\0')
+ return SendPacket ("OK");
+ if (*p++ != ',')
+ return SendPacket ("E67");
+ if (*p == '0' && (*(p + 1) == 'x' || *(p + 1) == 'X'))
+ p += 2;
+
+ errno = 0;
+ uint64_t address = strtoul (p, NULL, 16);
+ if (errno != 0 && address == 0)
+ {
+ return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Invalid address in QAddressIsExecutable packet");
+ }
+ int ret = DNBIsAddressExecutable (m_ctx.ProcessID(), address);
+ if (ret == 1)
+ return SendPacket ("AddressIsInExecutableRegion");
+ if (ret == 0)
+ return SendPacket ("AddressIsNotInExecutableRegion");
+
+ return SendPacket ("CannotDetermineRegionAttributes");
+}
+
+
/* `C sig [;addr]'
Resume with signal sig, optionally at address addr. */
Modified: lldb/trunk/tools/debugserver/source/RNBRemote.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/RNBRemote.h?rev=144074&r1=144073&r2=144074&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/RNBRemote.h (original)
+++ lldb/trunk/tools/debugserver/source/RNBRemote.h Mon Nov 7 22:28:12 2011
@@ -106,6 +106,7 @@
set_stdout, // 'QSetSTDOUT:'
set_stderr, // 'QSetSTDERR:'
set_working_dir, // 'QSetWorkingDir:'
+ address_is_executable, // 'QAddressIsExecutable'
allocate_memory, // '_M'
deallocate_memory, // '_m'
@@ -198,6 +199,7 @@
rnb_err_t HandlePacket_ILLFORMED (const char *file, int line, const char *p, const char *description);
rnb_err_t HandlePacket_AllocateMemory (const char *p);
rnb_err_t HandlePacket_DeallocateMemory (const char *p);
+ rnb_err_t HandlePacket_IsAddressExecutable (const char *p);
rnb_err_t HandlePacket_stop_process (const char *p);
From johnny.chen at apple.com Tue Nov 8 17:08:03 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Tue, 08 Nov 2011 23:08:03 -0000
Subject: [Lldb-commits] [lldb] r144145 -
/lldb/trunk/scripts/Python/modify-python-lldb.py
Message-ID: <20111108230803.E5A632A6C12C@llvm.org>
Author: johnny
Date: Tue Nov 8 17:08:03 2011
New Revision: 144145
URL: http://llvm.org/viewvc/llvm-project?rev=144145&view=rev
Log:
Add a missing ')' in the comment.
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=144145&r1=144144&r2=144145&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/modify-python-lldb.py (original)
+++ lldb/trunk/scripts/Python/modify-python-lldb.py Tue Nov 8 17:08:03 2011
@@ -15,7 +15,7 @@
#
# In addition to the 'residues' removal during the cleanup step, it also
# transforms the 'char' data type (which was actually 'char *' but the 'autodoc'
-# feature of swig removes ' *' from it into 'str' (as a Python str type).
+# feature of swig removes ' *' from it) into 'str' (as a Python str type).
#
# It also calls SBDebugger.Initialize() to initialize the lldb debugger
# subsystem.
From jmolenda at apple.com Wed Nov 9 02:03:56 2011
From: jmolenda at apple.com (Jason Molenda)
Date: Wed, 09 Nov 2011 08:03:56 -0000
Subject: [Lldb-commits] [lldb] r144175 - in
/lldb/trunk/tools/debugserver/source: DNB.cpp DNB.h MacOSX/MachProcess.cpp
MacOSX/MachProcess.h MacOSX/MachTask.cpp MacOSX/MachTask.h
MacOSX/MachVMMemory.cpp MacOSX/MachVMMemory.h MacOSX/MachVMRegion.cpp
MacOSX/MachVMRegion.h RNBRemote.cpp RNBRemote.h
Message-ID: <20111109080356.912E52A6C12C@llvm.org>
Author: jmolenda
Date: Wed Nov 9 02:03:56 2011
New Revision: 144175
URL: http://llvm.org/viewvc/llvm-project?rev=144175&view=rev
Log:
Remove the QAddressIsExecutable packet I added last night.
Add a more general purpose qMemoryRegionInfo packet which can
describe various attributes about a memory region. Currently it
will return the start address, size, and permissions (read, write,
executable) for the memory region. It may be possible to add
additional attributes in the future such as whether the region is
designated as stack memory or jitted code a la vmmap.
I still haven't implemented the lldb side of the code to use this
packet yet so there may be unexpected behavior - but the basic implementation looks
about right. I'll hook it up to lldb soon and fix any problems that crop up.
Modified:
lldb/trunk/tools/debugserver/source/DNB.cpp
lldb/trunk/tools/debugserver/source/DNB.h
lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp
lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.h
lldb/trunk/tools/debugserver/source/MacOSX/MachTask.cpp
lldb/trunk/tools/debugserver/source/MacOSX/MachTask.h
lldb/trunk/tools/debugserver/source/MacOSX/MachVMMemory.cpp
lldb/trunk/tools/debugserver/source/MacOSX/MachVMMemory.h
lldb/trunk/tools/debugserver/source/MacOSX/MachVMRegion.cpp
lldb/trunk/tools/debugserver/source/MacOSX/MachVMRegion.h
lldb/trunk/tools/debugserver/source/RNBRemote.cpp
lldb/trunk/tools/debugserver/source/RNBRemote.h
Modified: lldb/trunk/tools/debugserver/source/DNB.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/DNB.cpp?rev=144175&r1=144174&r2=144175&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/DNB.cpp (original)
+++ lldb/trunk/tools/debugserver/source/DNB.cpp Wed Nov 9 02:03:56 2011
@@ -1125,29 +1125,26 @@
}
//----------------------------------------------------------------------
-// Try to determine if a given address in the process PID is in an
-// executable region or not. Used for sniffing potential caller addresses
-// when unwinding a stack and we're making guesses about where the caller
-// frame addr might be saved.
+// Find attributes of the memory region that contains ADDR for process PID,
+// if possible, and return a string describing those attributes.
//
-// RETURNS: 1 if executable
-// 0 if not executable
-// -1 if we cannot make a determination on this target
+// Returns 1 if we could find attributes for this region and OUTBUF can
+// be sent to the remote debugger.
+//
+// Returns 0 if we couldn't find the attributes for a region of memory at
+// that address and OUTBUF should not be sent.
+//
+// Returns -1 if this platform cannot look up information about memory regions
+// or if we do not yet have a valid launched process.
//
-// Note that unmapped memory (an address that is not an allocated page in
-// PID) will return as 0 - it is not executable memory. -1 is intended
-// for a platform where we can't inspect memory region attributes.
//----------------------------------------------------------------------
int
-DNBIsAddressExecutable (nub_process_t pid, nub_addr_t addr)
+DNBMemoryRegionInfo (nub_process_t pid, nub_addr_t addr, char *outbuf, nub_size_t outbufsize)
{
MachProcessSP procSP;
if (GetProcessSP (pid, procSP))
{
- if (procSP->IsAddressExecutable(addr))
- return 1;
- else
- return 0;
+ return procSP->MemoryRegionInfo(addr, outbuf, outbufsize);
}
return -1;
}
Modified: lldb/trunk/tools/debugserver/source/DNB.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/DNB.h?rev=144175&r1=144174&r2=144175&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/DNB.h (original)
+++ lldb/trunk/tools/debugserver/source/DNB.h Wed Nov 9 02:03:56 2011
@@ -66,7 +66,8 @@
nub_size_t DNBProcessMemoryWrite (nub_process_t pid, nub_addr_t addr, nub_size_t size, const void *buf) DNB_EXPORT;
nub_addr_t DNBProcessMemoryAllocate (nub_process_t pid, nub_size_t size, uint32_t permissions) DNB_EXPORT;
nub_bool_t DNBProcessMemoryDeallocate (nub_process_t pid, nub_addr_t addr) DNB_EXPORT;
-int DNBIsAddressExecutable (nub_process_t pid, nub_addr_t addr) ;
+int DNBMemoryRegionInfo (nub_process_t pid, nub_addr_t addr, char *outbuf, nub_size_t outbufsize);
+
//----------------------------------------------------------------------
// Process status
//----------------------------------------------------------------------
@@ -88,6 +89,7 @@
nub_size_t DNBProcessGetAvailableSTDERR (nub_process_t pid, char *buf, nub_size_t buf_size) DNB_EXPORT;
nub_size_t DNBProcessGetStopCount (nub_process_t pid) DNB_EXPORT;
uint32_t DNBProcessGetCPUType (nub_process_t pid) DNB_EXPORT;
+
//----------------------------------------------------------------------
// Process executable and arguments
//----------------------------------------------------------------------
Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp?rev=144175&r1=144174&r2=144175&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp Wed Nov 9 02:03:56 2011
@@ -603,10 +603,10 @@
return bytes_written;
}
-bool
-MachProcess::IsAddressExecutable(nub_addr_t address)
+int
+MachProcess::MemoryRegionInfo(nub_addr_t address, char *outbuf, nub_size_t outbufsize)
{
- return m_task.IsAddressExecutable (address);
+ return m_task.MemoryRegionInfo (address, outbuf, outbufsize);
}
void
Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.h?rev=144175&r1=144174&r2=144175&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.h (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.h Wed Nov 9 02:03:56 2011
@@ -99,7 +99,7 @@
bool Detach ();
nub_size_t ReadMemory (nub_addr_t addr, nub_size_t size, void *buf);
nub_size_t WriteMemory (nub_addr_t addr, nub_size_t size, const void *buf);
- bool IsAddressExecutable(nub_addr_t address);
+ int MemoryRegionInfo(nub_addr_t address, char *outbuf, nub_size_t outbufsize);
//----------------------------------------------------------------------
// Path and arg accessors
Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachTask.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachTask.cpp?rev=144175&r1=144174&r2=144175&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachTask.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachTask.cpp Wed Nov 9 02:03:56 2011
@@ -205,18 +205,17 @@
}
//----------------------------------------------------------------------
-// MachTask::IsAddressExecutable
+// MachTask::MemoryRegionInfo
//----------------------------------------------------------------------
-bool
-MachTask::IsAddressExecutable (nub_addr_t addr)
+int
+MachTask::MemoryRegionInfo (nub_addr_t addr, char *outbuf, nub_size_t outbufsize)
{
task_t task = TaskPort();
- bool ret = false;
- if (task != TASK_NULL)
- {
- ret = m_vm_memory.IsExecutable(task, addr);
- DNBLogThreadedIf(LOG_MEMORY, "MachTask::IsAddressExecutable ( addr = 0x%8.8llx ) => %s", (uint64_t)addr, (ret ? "true" : "false"));
- }
+ if (task == TASK_NULL)
+ return -1;
+
+ int ret = m_vm_memory.MemoryRegionInfo(task, addr, outbuf, outbufsize);
+ DNBLogThreadedIf(LOG_MEMORY, "MachTask::MemoryRegionInfo ( addr = 0x%8.8llx ) => %d", (uint64_t)addr, ret);
return ret;
}
Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachTask.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachTask.h?rev=144175&r1=144174&r2=144175&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachTask.h (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachTask.h Wed Nov 9 02:03:56 2011
@@ -64,7 +64,7 @@
nub_size_t ReadMemory (nub_addr_t addr, nub_size_t size, void *buf);
nub_size_t WriteMemory (nub_addr_t addr, nub_size_t size, const void *buf);
- bool IsAddressExecutable (nub_addr_t addr) ;
+ int MemoryRegionInfo (nub_addr_t addr, char *outbuf, nub_size_t outbufsize);
nub_addr_t AllocateMemory (nub_size_t size, uint32_t permissions);
nub_bool_t DeallocateMemory (nub_addr_t addr);
Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachVMMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachVMMemory.cpp?rev=144175&r1=144174&r2=144175&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachVMMemory.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachVMMemory.cpp Wed Nov 9 02:03:56 2011
@@ -52,15 +52,16 @@
return count;
}
-bool
-MachVMMemory::IsExecutable(task_t task, nub_addr_t address)
+int
+MachVMMemory::MemoryRegionInfo(task_t task, nub_addr_t address, char *outbuf, nub_size_t outbufsize)
{
MachVMRegion vmRegion(task);
+ outbuf[0] = '\0';
- if (vmRegion.GetRegionForAddress(address) && vmRegion.IsExecutable())
- return true;
+ if (vmRegion.GetRegionForAddress(address) && vmRegion.GetRegionDescription(outbuf, outbufsize))
+ return 1;
else
- return false;
+ return 0;
}
nub_size_t
Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachVMMemory.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachVMMemory.h?rev=144175&r1=144174&r2=144175&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachVMMemory.h (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachVMMemory.h Wed Nov 9 02:03:56 2011
@@ -27,7 +27,7 @@
nub_size_t Read(task_t task, nub_addr_t address, void *data, nub_size_t data_count);
nub_size_t Write(task_t task, nub_addr_t address, const void *data, nub_size_t data_count);
nub_size_t PageSize();
- bool IsExecutable(task_t task, nub_addr_t address);
+ int MemoryRegionInfo(task_t task, nub_addr_t address, char *outbuf, nub_size_t outbufsize);
protected:
nub_size_t MaxBytesLeftInPage(nub_addr_t addr, nub_size_t count);
Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachVMRegion.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachVMRegion.cpp?rev=144175&r1=144174&r2=144175&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachVMRegion.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachVMRegion.cpp Wed Nov 9 02:03:56 2011
@@ -177,3 +177,27 @@
return true;
}
+
+bool
+MachVMRegion::GetRegionDescription (char *outbuf, nub_size_t outbufsize)
+{
+ if (m_addr == INVALID_NUB_ADDRESS || m_start == INVALID_NUB_ADDRESS || m_size == 0)
+ return false;
+ snprintf (outbuf, outbufsize, "start:%llx,size:%llx", m_start, m_size);
+ outbuf[outbufsize - 1] = '\0';
+
+ char tmpbuf[128];
+ strcpy (tmpbuf, ",permissions:");
+ if ((m_data.protection & VM_PROT_READ) == VM_PROT_READ)
+ strcat (tmpbuf, "r");
+ if ((m_data.protection & VM_PROT_WRITE) == VM_PROT_WRITE)
+ strcat (tmpbuf, "w");
+ if ((m_data.protection & VM_PROT_EXECUTE) == VM_PROT_EXECUTE)
+ strcat (tmpbuf, "x");
+ strlcat (outbuf, tmpbuf, outbufsize);
+
+ // It would be nice if we could figure out whether the memory region is stack memory or jitted code memory as well
+
+ outbuf[outbufsize - 1] = '\0';
+ return true;
+}
Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachVMRegion.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachVMRegion.h?rev=144175&r1=144174&r2=144175&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachVMRegion.h (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachVMRegion.h Wed Nov 9 02:03:56 2011
@@ -43,7 +43,7 @@
bool RestoreProtections();
bool GetRegionForAddress(nub_addr_t addr);
- bool IsExecutable() const { return (m_data.protection & VM_PROT_EXECUTE) == VM_PROT_EXECUTE; }
+ bool GetRegionDescription (char *outbuf, nub_size_t outbufsize);
protected:
#if defined (VM_REGION_SUBMAP_SHORT_INFO_COUNT_64)
Modified: lldb/trunk/tools/debugserver/source/RNBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/RNBRemote.cpp?rev=144175&r1=144174&r2=144175&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/RNBRemote.cpp (original)
+++ lldb/trunk/tools/debugserver/source/RNBRemote.cpp Wed Nov 9 02:03:56 2011
@@ -186,7 +186,7 @@
// t.push_back (Packet (pass_signals_to_inferior, &RNBRemote::HandlePacket_UNIMPLEMENTED, NULL, "QPassSignals:", "Specify which signals are passed to the inferior"));
t.push_back (Packet (allocate_memory, &RNBRemote::HandlePacket_AllocateMemory, NULL, "_M", "Allocate memory in the inferior process."));
t.push_back (Packet (deallocate_memory, &RNBRemote::HandlePacket_DeallocateMemory, NULL, "_m", "Deallocate memory in the inferior process."));
- t.push_back (Packet (address_is_executable, &RNBRemote::HandlePacket_IsAddressExecutable, NULL, "QAddressIsExecutable", "Indicate if an address is in an executable region or not"));
+ t.push_back (Packet (memory_region_info, &RNBRemote::HandlePacket_MemoryRegionInfo, NULL, "qMemoryRegionInfo", "Return size and attributes of a memory region that contains the given address"));
}
@@ -3241,24 +3241,36 @@
}
rnb_err_t
-RNBRemote::HandlePacket_IsAddressExecutable (const char *p)
+RNBRemote::HandlePacket_MemoryRegionInfo (const char *p)
{
- /* This tells us whether the specified address is in an executable region
- in the remote process or not. Examples of use:
- QAddressIsExecutable,3a55140
- AddressIsInExecutableRegion
+ /* This packet will find memory attributes (e.g. readable, writable, executable, stack, jitted code)
+ for the memory region containing a given address and return that information.
+
+ Users of this packet must be prepared for three results:
+
+ Region information is returned
+ Region information is unavailable for this address because the address is in unmapped memory
+ Region lookup cannot be performed on this platform or process is not yet launched
+ This packet isn't implemented
+
+ Examples of use:
+ qMemoryRegionInfo:3a55140
+ start:3a50000,size:100000,permissions:rwx
- QAddressIsExecutable,0
- AddressIsNotInExecutableRegion
+ qMemoryRegionInfo:0
+ error:address in unmapped region
- QAddressIsExecutable,3a551140 (on a different platform)
- CannotDetermineRegionAttributes
+ qMemoryRegionInfo:3a551140 (on a different platform)
+ error:region lookup cannot be performed
+
+ qMemoryRegionInfo
+ OK // this packet is implemented by the remote nub
*/
- p += sizeof ("QAddressIsExecutable") - 1;
+ p += sizeof ("qMemoryRegionInfo") - 1;
if (*p == '\0')
return SendPacket ("OK");
- if (*p++ != ',')
+ if (*p++ != ':')
return SendPacket ("E67");
if (*p == '0' && (*(p + 1) == 'x' || *(p + 1) == 'X'))
p += 2;
@@ -3267,15 +3279,21 @@
uint64_t address = strtoul (p, NULL, 16);
if (errno != 0 && address == 0)
{
- return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Invalid address in QAddressIsExecutable packet");
+ return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Invalid address in qMemoryRegionInfo packet");
}
- int ret = DNBIsAddressExecutable (m_ctx.ProcessID(), address);
+
+ char retbuf[1024];
+
+ int ret = DNBMemoryRegionInfo (m_ctx.ProcessID(), address, retbuf, sizeof (retbuf));
+ retbuf[sizeof (retbuf) - 1] = '\0';
if (ret == 1)
- return SendPacket ("AddressIsInExecutableRegion");
+ return SendPacket (retbuf);
if (ret == 0)
- return SendPacket ("AddressIsNotInExecutableRegion");
-
- return SendPacket ("CannotDetermineRegionAttributes");
+ return SendPacket ("error:address in unmapped region");
+ if (ret == -1)
+ return SendPacket ("error:region lookup cannot be performed");
+
+ return SendPacket ("E68");
}
Modified: lldb/trunk/tools/debugserver/source/RNBRemote.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/RNBRemote.h?rev=144175&r1=144174&r2=144175&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/RNBRemote.h (original)
+++ lldb/trunk/tools/debugserver/source/RNBRemote.h Wed Nov 9 02:03:56 2011
@@ -106,7 +106,7 @@
set_stdout, // 'QSetSTDOUT:'
set_stderr, // 'QSetSTDERR:'
set_working_dir, // 'QSetWorkingDir:'
- address_is_executable, // 'QAddressIsExecutable'
+ memory_region_info, // 'qMemoryRegionInfo:'
allocate_memory, // '_M'
deallocate_memory, // '_m'
@@ -199,7 +199,7 @@
rnb_err_t HandlePacket_ILLFORMED (const char *file, int line, const char *p, const char *description);
rnb_err_t HandlePacket_AllocateMemory (const char *p);
rnb_err_t HandlePacket_DeallocateMemory (const char *p);
- rnb_err_t HandlePacket_IsAddressExecutable (const char *p);
+ rnb_err_t HandlePacket_MemoryRegionInfo (const char *p);
rnb_err_t HandlePacket_stop_process (const char *p);
From jingham at apple.com Wed Nov 9 13:02:04 2011
From: jingham at apple.com (Jim Ingham)
Date: Wed, 09 Nov 2011 19:02:04 -0000
Subject: [Lldb-commits] [lldb] r144199 -
/lldb/trunk/source/Commands/CommandObjectSource.cpp
Message-ID: <20111109190204.BE0EC1BE001@llvm.org>
Author: jingham
Date: Wed Nov 9 13:02:04 2011
New Revision: 144199
URL: http://llvm.org/viewvc/llvm-project?rev=144199&view=rev
Log:
"source list -n" should use eFunctionNameTypeAuto not eFunctionNameTypeBase for the name lookup.
Modified:
lldb/trunk/source/Commands/CommandObjectSource.cpp
Modified: lldb/trunk/source/Commands/CommandObjectSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSource.cpp?rev=144199&r1=144198&r2=144199&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectSource.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectSource.cpp Wed Nov 9 13:02:04 2011
@@ -311,13 +311,13 @@
{
matching_modules.Clear();
target->GetImages().FindModules (&module_spec, NULL, NULL, NULL, matching_modules);
- num_matches += matching_modules.FindFunctions (name, eFunctionNameTypeBase, include_symbols, append, sc_list);
+ num_matches += matching_modules.FindFunctions (name, eFunctionNameTypeAuto, include_symbols, append, sc_list);
}
}
}
else
{
- num_matches = target->GetImages().FindFunctions (name, eFunctionNameTypeBase, include_symbols, append, sc_list);
+ num_matches = target->GetImages().FindFunctions (name, eFunctionNameTypeAuto, include_symbols, append, sc_list);
}
SymbolContext sc;
From gclayton at apple.com Wed Nov 9 13:04:58 2011
From: gclayton at apple.com (Greg Clayton)
Date: Wed, 09 Nov 2011 19:04:58 -0000
Subject: [Lldb-commits] [lldb] r144200 - in /lldb/trunk:
source/Symbol/ClangASTContext.cpp source/Symbol/ClangASTType.cpp
tools/debugserver/scripts/dbgnub-config.pl
Message-ID: <20111109190458.D6CA21BE001@llvm.org>
Author: gclayton
Date: Wed Nov 9 13:04:58 2011
New Revision: 144200
URL: http://llvm.org/viewvc/llvm-project?rev=144200&view=rev
Log:
Cleanup some warnings.
Modified:
lldb/trunk/source/Symbol/ClangASTContext.cpp
lldb/trunk/source/Symbol/ClangASTType.cpp
lldb/trunk/tools/debugserver/scripts/dbgnub-config.pl
Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=144200&r1=144199&r2=144200&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Wed Nov 9 13:04:58 2011
@@ -3059,7 +3059,7 @@
case clang::BuiltinType::BoundMember:
case clang::BuiltinType::Half:
case clang::BuiltinType::ARCUnbridgedCast:
- //case clang::BuiltinType::PseudoObject:
+ case clang::BuiltinType::PseudoObject:
return 1;
}
break;
@@ -4899,7 +4899,7 @@
case clang::BuiltinType::BoundMember:
case clang::BuiltinType::Half:
case clang::BuiltinType::ARCUnbridgedCast:
- //case clang::BuiltinType::PseudoObject:
+ case clang::BuiltinType::PseudoObject:
break;
}
break;
@@ -5035,7 +5035,7 @@
case clang::BuiltinType::BoundMember:
case clang::BuiltinType::Half:
case clang::BuiltinType::ARCUnbridgedCast:
- //case clang::BuiltinType::PseudoObject:
+ case clang::BuiltinType::PseudoObject:
break;
}
break;
Modified: lldb/trunk/source/Symbol/ClangASTType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTType.cpp?rev=144200&r1=144199&r2=144200&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTType.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTType.cpp Wed Nov 9 13:04:58 2011
@@ -572,7 +572,7 @@
case clang::BuiltinType::ObjCSel:
case clang::BuiltinType::Half:
case clang::BuiltinType::ARCUnbridgedCast:
- //case clang::BuiltinType::PseudoObject:
+ case clang::BuiltinType::PseudoObject:
return lldb::eFormatHex;
}
break;
Modified: lldb/trunk/tools/debugserver/scripts/dbgnub-config.pl
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/scripts/dbgnub-config.pl?rev=144200&r1=144199&r2=144200&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/scripts/dbgnub-config.pl (original)
+++ lldb/trunk/tools/debugserver/scripts/dbgnub-config.pl Wed Nov 9 13:04:58 2011
@@ -22,7 +22,7 @@
# Open the config file
#----------------------------------------------------------------------
open(CONFIG, "> $config_file") || die "Couldn't open '$config_file' for writing: $!\n";
-print CONFIG "/*" . "-" x 72 . "\n";
+print CONFIG "//" . "-" x 72 . "\n";
print CONFIG "// This file is auto generated by a dbgnub-config.pl, do not edit by hand!\n";
print CONFIG "//" . "-" x 72 . "\n";
print CONFIG "// COMMAND LINE\n";
@@ -39,7 +39,7 @@
print CONFIG "// SETTINGS\n";
print CONFIG "// config_file: '$config_file'\n";
print CONFIG "//" . "-" x 72 . "\n";
-print CONFIG "*/\n\n";
+print CONFIG "\n\n";
print CONFIG "#ifndef __DBGNUB_CONFIG__\n";
print CONFIG "#define __DBGNUB_CONFIG__\n";
From scallanan at apple.com Wed Nov 9 13:33:21 2011
From: scallanan at apple.com (Sean Callanan)
Date: Wed, 09 Nov 2011 19:33:21 -0000
Subject: [Lldb-commits] [lldb] r144203 - in /lldb/trunk:
include/lldb/Expression/ClangASTSource.h
source/Expression/ClangASTSource.cpp source/Symbol/ClangASTImporter.cpp
Message-ID: <20111109193321.A96811BE001@llvm.org>
Author: spyffe
Date: Wed Nov 9 13:33:21 2011
New Revision: 144203
URL: http://llvm.org/viewvc/llvm-project?rev=144203&view=rev
Log:
Added a function to ClangASTSource to service
lookups for Objective-C methods by selector.
Right now all it does is print log information.
Also improved the logging for imported TagDecls
to indicate whether or not the definition for
the imported TagDecl is complete.
Modified:
lldb/trunk/include/lldb/Expression/ClangASTSource.h
lldb/trunk/source/Expression/ClangASTSource.cpp
lldb/trunk/source/Symbol/ClangASTImporter.cpp
Modified: lldb/trunk/include/lldb/Expression/ClangASTSource.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangASTSource.h?rev=144203&r1=144202&r2=144203&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/ClangASTSource.h (original)
+++ lldb/trunk/include/lldb/Expression/ClangASTSource.h Wed Nov 9 13:33:21 2011
@@ -278,6 +278,17 @@
lldb::ModuleSP module,
ClangNamespaceDecl &namespace_decl,
unsigned int current_id);
+
+ //------------------------------------------------------------------
+ /// Find all Objective-C methods matching a given selector.
+ ///
+ /// @param[in] context
+ /// The NameSearchContext that can construct Decls for this name.
+ /// Its m_decl_name contains the selector and its m_decl_context
+ /// is the containing object.
+ //------------------------------------------------------------------
+ void
+ FindObjCMethodDecls (NameSearchContext &context);
//------------------------------------------------------------------
/// A wrapper for ClangASTContext::CopyType that sets a flag that
Modified: lldb/trunk/source/Expression/ClangASTSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangASTSource.cpp?rev=144203&r1=144202&r2=144203&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangASTSource.cpp (original)
+++ lldb/trunk/source/Expression/ClangASTSource.cpp Wed Nov 9 13:33:21 2011
@@ -72,12 +72,18 @@
case DeclarationName::CXXUsingDirective:
return SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
- // These aren't looked up like this.
case DeclarationName::ObjCZeroArgSelector:
case DeclarationName::ObjCOneArgSelector:
case DeclarationName::ObjCMultiArgSelector:
- return DeclContext::lookup_result();
+ {
+ llvm::SmallVector method_decls;
+ NameSearchContext method_search_context (*this, method_decls, clang_decl_name, decl_ctx);
+
+ FindObjCMethodDecls(method_search_context);
+
+ return SetExternalVisibleDeclsForName (decl_ctx, clang_decl_name, method_decls);
+ }
// These aren't possible in the global context.
case DeclarationName::CXXConstructorName:
case DeclarationName::CXXDestructorName:
@@ -457,6 +463,46 @@
} while(0);
}
+void
+ClangASTSource::FindObjCMethodDecls (NameSearchContext &context)
+{
+ lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
+
+ const DeclarationName &decl_name(context.m_decl_name);
+ const DeclContext *decl_ctx(context.m_decl_context);
+
+ const ObjCInterfaceDecl *interface_decl = dyn_cast(decl_ctx);
+
+ if (!interface_decl)
+ return;
+
+ StreamString ss;
+ if (decl_name.isObjCZeroArgSelector())
+ {
+ ss.Printf("%s", decl_name.getAsString().c_str());
+ }
+ else if (decl_name.isObjCOneArgSelector())
+ {
+ ss.Printf("%s:", decl_name.getAsString().c_str());
+ }
+ else
+ {
+ clang::Selector sel = decl_name.getObjCSelector();
+
+ for (unsigned i = 0, e = sel.getNumArgs();
+ i != e;
+ ++i)
+ {
+ llvm::StringRef r = sel.getNameForSlot(i);
+ ss.Printf("%s:", r.str().c_str());
+ }
+ }
+ ss.Flush();
+
+ if (log)
+ log->Printf("ClangASTSource::FindObjCMethodDecls for selector [%s %s]", interface_decl->getNameAsString().c_str(), ss.GetData());
+}
+
void
ClangASTSource::CompleteNamespaceMap (ClangASTImporter::NamespaceMapSP &namespace_map,
const ConstString &name,
Modified: lldb/trunk/source/Symbol/ClangASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTImporter.cpp?rev=144203&r1=144202&r2=144203&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTImporter.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTImporter.cpp Wed Nov 9 13:33:21 2011
@@ -165,12 +165,16 @@
TagDecl *to_tag_decl = dyn_cast(to);
to_tag_decl->setHasExternalLexicalStorage();
-
+
if (log)
- log->Printf(" [ClangASTImporter] Imported a TagDecl named %s%s%s",
+ log->Printf(" [ClangASTImporter] Imported %p, a %s named %s%s%s [%s->%s]",
+ to,
+ ((clang::Decl*)from_tag_decl)->getDeclKindName(),
from_tag_decl->getName().str().c_str(),
(to_tag_decl->hasExternalLexicalStorage() ? " Lexical" : ""),
- (to_tag_decl->hasExternalVisibleStorage() ? " Visible" : ""));
+ (to_tag_decl->hasExternalVisibleStorage() ? " Visible" : ""),
+ (from_tag_decl->isCompleteDefinition() ? "complete" : "incomplete"),
+ (to_tag_decl->isCompleteDefinition() ? "complete" : "incomplete"));
}
if (isa(from))
@@ -186,6 +190,8 @@
{
ObjCInterfaceDecl *to_interface_decl = dyn_cast(to);
+ to_interface_decl->setHasExternalVisibleStorage();
+
if (!to_interface_decl->isForwardDecl())
to_interface_decl->setExternallyCompleted();
}
From gclayton at apple.com Wed Nov 9 17:25:03 2011
From: gclayton at apple.com (Greg Clayton)
Date: Wed, 09 Nov 2011 23:25:03 -0000
Subject: [Lldb-commits] [lldb] r144240 -
/lldb/trunk/source/Interpreter/CommandInterpreter.cpp
Message-ID: <20111109232503.641FF1BE001@llvm.org>
Author: gclayton
Date: Wed Nov 9 17:25:03 2011
New Revision: 144240
URL: http://llvm.org/viewvc/llvm-project?rev=144240&view=rev
Log:
Fixed an issue with the gdb format stuff for any aliases that expand to
contain a "--".
Modified:
lldb/trunk/source/Interpreter/CommandInterpreter.cpp
Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=144240&r1=144239&r2=144240&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Wed Nov 9 17:25:03 2011
@@ -898,6 +898,36 @@
}
}
+static size_t
+FindArgumentTerminator (const std::string &s)
+{
+ printf ("FindArgumentTerminator( s = '%s') => ", s.c_str());
+ const size_t s_len = s.size();
+ size_t offset = 0;
+ while (offset < s_len)
+ {
+ size_t pos = s.find ("--", offset);
+ if (pos == std::string::npos)
+ break;
+ if (pos > 0)
+ {
+ if (isspace(s[pos-1]))
+ {
+ // Check if the string ends "\s--" (where \s is a space character)
+ // or if we have "\s--\s".
+ if ((pos + 2 >= s_len) || isspace(s[pos+2]))
+ {
+ printf ("%zu\n", pos);
+ return pos;
+ }
+ }
+ }
+ offset = pos + 2;
+ }
+ printf ("-1\n");
+ return std::string::npos;
+}
+
static bool
ExtractCommand (std::string &command_string, std::string &command, std::string &suffix, char "e_char)
{
@@ -1367,9 +1397,25 @@
Options *command_options = cmd_obj->GetOptions();
if (command_options && command_options->SupportsLongOption("gdb-format"))
{
- revised_command_line.Printf (" --gdb-format=%s", suffix.c_str() + 1);
- if (wants_raw_input && command_string.find ("-- ") == std::string::npos)
- revised_command_line.Printf (" --");
+ std::string gdb_format_option ("--gdb-format=");
+ gdb_format_option += (suffix.c_str() + 1);
+
+ bool inserted = false;
+ std::string &cmd = revised_command_line.GetString();
+ size_t arg_terminator_idx = FindArgumentTerminator (cmd);
+ if (arg_terminator_idx != std::string::npos)
+ {
+ // Insert the gdb format option before the "--" that terminates options
+ gdb_format_option.append(1,' ');
+ cmd.insert(arg_terminator_idx, gdb_format_option);
+ inserted = true;
+ }
+
+ if (!inserted)
+ revised_command_line.Printf (" %s", gdb_format_option.c_str());
+
+ if (wants_raw_input && FindArgumentTerminator(cmd) == std::string::npos)
+ revised_command_line.PutCString (" --");
}
else
{
From jingham at apple.com Wed Nov 9 19:12:26 2011
From: jingham at apple.com (Jim Ingham)
Date: Thu, 10 Nov 2011 01:12:26 -0000
Subject: [Lldb-commits] [lldb] r144254 - in /lldb/trunk:
include/lldb/Target/ThreadPlanRunToAddress.h
source/Target/ThreadPlanRunToAddress.cpp
Message-ID: <20111110011226.AD13D1BE001@llvm.org>
Author: jingham
Date: Wed Nov 9 19:12:26 2011
New Revision: 144254
URL: http://llvm.org/viewvc/llvm-project?rev=144254&view=rev
Log:
Using the wrong type for the break id's (user_id_t is an unsigned int, but internal breakpoints can be negative, and anyway it is a good idea to use break_id_t for breakpoints, no?)
Modified:
lldb/trunk/include/lldb/Target/ThreadPlanRunToAddress.h
lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp
Modified: lldb/trunk/include/lldb/Target/ThreadPlanRunToAddress.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlanRunToAddress.h?rev=144254&r1=144253&r2=144254&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/ThreadPlanRunToAddress.h (original)
+++ lldb/trunk/include/lldb/Target/ThreadPlanRunToAddress.h Wed Nov 9 19:12:26 2011
@@ -74,7 +74,7 @@
bool m_stop_others;
std::vector m_addresses; // This is the address we are going to run to.
// TODO: Would it be useful to have multiple addresses?
- std::vector m_break_ids; // This is the breakpoint we are using to stop us at m_address.
+ std::vector m_break_ids; // This is the breakpoint we are using to stop us at m_address.
DISALLOW_COPY_AND_ASSIGN (ThreadPlanRunToAddress);
Modified: lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp?rev=144254&r1=144253&r2=144254&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp Wed Nov 9 19:12:26 2011
@@ -152,7 +152,7 @@
}
s->Address(m_addresses[i], sizeof (addr_t));
- s->Printf (" using breakpoint: %llu - ", m_break_ids[i]);
+ s->Printf (" using breakpoint: %d - ", m_break_ids[i]);
Breakpoint *breakpoint = m_thread.GetProcess().GetTarget().GetBreakpointByID (m_break_ids[i]).get();
if (breakpoint)
breakpoint->Dump (s);
From gclayton at apple.com Wed Nov 9 19:18:58 2011
From: gclayton at apple.com (Greg Clayton)
Date: Thu, 10 Nov 2011 01:18:58 -0000
Subject: [Lldb-commits] [lldb] r144256 -
/lldb/trunk/source/Commands/CommandObjectTarget.cpp
Message-ID: <20111110011858.46CE01BE001@llvm.org>
Author: gclayton
Date: Wed Nov 9 19:18:58 2011
New Revision: 144256
URL: http://llvm.org/viewvc/llvm-project?rev=144256&view=rev
Log:
Added the ability for many of the "target modules dump xxx" commands to find
modules first in the target, then fall back to the global shared module
cache, then fall back to the global module list.
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=144256&r1=144255&r2=144256&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Wed Nov 9 19:18:58 2011
@@ -1601,6 +1601,70 @@
}
+
+static size_t
+FindModulesByName (Target *target,
+ const char *module_name,
+ ModuleList &module_list,
+ bool check_global_list)
+{
+// Dump specified images (by basename or fullpath)
+ FileSpec module_file_spec(module_name, false);
+
+ const size_t initial_size = module_list.GetSize ();
+
+ size_t num_matches = 0;
+
+ if (target)
+ {
+ num_matches = target->GetImages().FindModules (&module_file_spec,
+ NULL,
+ NULL,
+ NULL,
+ module_list);
+
+ // Not found in our module list for our target, check the main
+ // shared module list in case it is a extra file used somewhere
+ // else
+ if (num_matches == 0)
+ num_matches = ModuleList::FindSharedModules (module_file_spec,
+ target->GetArchitecture(),
+ NULL,
+ NULL,
+ module_list);
+ }
+ else
+ {
+ num_matches = ModuleList::FindSharedModules (module_file_spec,
+ ArchSpec(),
+ NULL,
+ NULL,
+ module_list);
+ }
+
+ if (check_global_list && num_matches == 0)
+ {
+ // Check the global list
+ Mutex::Locker locker(Module::GetAllocationModuleCollectionMutex().GetMutex());
+ const uint32_t num_modules = Module::GetNumberAllocatedModules();
+ ModuleSP module_sp;
+ for (uint32_t image_idx = 0; image_idxGetFileSpec(), module_file_spec, true))
+ {
+ module_sp = module;
+ module_list.AppendIfNeeded(module_sp);
+ }
+ }
+ }
+ }
+ return module_list.GetSize () - initial_size;
+}
+
#pragma mark CommandObjectTargetModulesModuleAutoComplete
//----------------------------------------------------------------------
@@ -1796,26 +1860,14 @@
const char *arg_cstr;
for (int arg_idx = 0; (arg_cstr = command.GetArgumentAtIndex(arg_idx)) != NULL; ++arg_idx)
{
- FileSpec image_file(arg_cstr, false);
- ModuleList matching_modules;
- size_t num_matching_modules = target->GetImages().FindModules(&image_file, NULL, NULL, NULL, matching_modules);
-
- // Not found in our module list for our target, check the main
- // shared module list in case it is a extra file used somewhere
- // else
- if (num_matching_modules == 0)
- num_matching_modules = ModuleList::FindSharedModules (image_file,
- target->GetArchitecture(),
- NULL,
- NULL,
- matching_modules);
-
- if (num_matching_modules > 0)
+ ModuleList module_list;
+ const size_t num_matches = FindModulesByName (target, arg_cstr, module_list, true);
+ if (num_matches > 0)
{
- for (size_t i=0; i 0)
{
@@ -1823,7 +1875,7 @@
result.GetOutputStream().EOL();
}
num_dumped++;
- DumpModuleSymtab (m_interpreter, result.GetOutputStream(), image_module, m_options.m_sort_order);
+ DumpModuleSymtab (m_interpreter, result.GetOutputStream(), module, m_options.m_sort_order);
}
}
}
@@ -1995,34 +2047,27 @@
const char *arg_cstr;
for (int arg_idx = 0; (arg_cstr = command.GetArgumentAtIndex(arg_idx)) != NULL; ++arg_idx)
{
- FileSpec image_file(arg_cstr, false);
- ModuleList matching_modules;
- size_t num_matching_modules = target->GetImages().FindModules(&image_file, NULL, NULL, NULL, matching_modules);
-
- // Not found in our module list for our target, check the main
- // shared module list in case it is a extra file used somewhere
- // else
- if (num_matching_modules == 0)
- num_matching_modules = ModuleList::FindSharedModules (image_file,
- target->GetArchitecture(),
- NULL,
- NULL,
- matching_modules);
-
- if (num_matching_modules > 0)
+ ModuleList module_list;
+ const size_t num_matches = FindModulesByName (target, arg_cstr, module_list, true);
+ if (num_matches > 0)
{
- for (size_t i=0; iGetImages().FindModules(&image_file, NULL, NULL, NULL, matching_modules);
-
- // Not found in our module list for our target, check the main
- // shared module list in case it is a extra file used somewhere
- // else
- if (num_matching_modules == 0)
- num_matching_modules = ModuleList::FindSharedModules (image_file,
- target->GetArchitecture(),
- NULL,
- NULL,
- matching_modules);
-
- if (num_matching_modules > 0)
+ ModuleList module_list;
+ const size_t num_matches = FindModulesByName (target, arg_cstr, module_list, true);
+ if (num_matches > 0)
{
- for (size_t i=0; iGetImages().FindModules(&image_file, NULL, NULL, NULL, matching_modules);
-
- // Not found in our module list for our target, check the main
- // shared module list in case it is a extra file used somewhere
- // else
- if (num_matching_modules == 0)
- num_matching_modules = ModuleList::FindSharedModules (image_file,
- target->GetArchitecture(),
- NULL,
- NULL,
- matching_modules);
-
- if (num_matching_modules > 0)
+ ModuleList module_list;
+ const size_t num_matches = FindModulesByName (target, arg_cstr, module_list, false);
+ if (num_matches > 0)
{
- for (size_t j=0; j
Author: gclayton
Date: Wed Nov 9 19:30:05 2011
New Revision: 144257
URL: http://llvm.org/viewvc/llvm-project?rev=144257&view=rev
Log:
Removed debug printf statements.
Modified:
lldb/trunk/source/Interpreter/CommandInterpreter.cpp
Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=144257&r1=144256&r2=144257&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Wed Nov 9 19:30:05 2011
@@ -901,7 +901,6 @@
static size_t
FindArgumentTerminator (const std::string &s)
{
- printf ("FindArgumentTerminator( s = '%s') => ", s.c_str());
const size_t s_len = s.size();
size_t offset = 0;
while (offset < s_len)
@@ -917,14 +916,12 @@
// or if we have "\s--\s".
if ((pos + 2 >= s_len) || isspace(s[pos+2]))
{
- printf ("%zu\n", pos);
return pos;
}
}
}
offset = pos + 2;
}
- printf ("-1\n");
return std::string::npos;
}
From gclayton at apple.com Wed Nov 9 21:08:09 2011
From: gclayton at apple.com (Greg Clayton)
Date: Thu, 10 Nov 2011 03:08:09 -0000
Subject: [Lldb-commits] [lldb] r144259 -
/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
Message-ID: <20111110030809.3007B1BE001@llvm.org>
Author: gclayton
Date: Wed Nov 9 21:08:08 2011
New Revision: 144259
URL: http://llvm.org/viewvc/llvm-project?rev=144259&view=rev
Log:
Fixed an issue where if you had an initialized global variable, we would not
link it up correctly in the debug info if the .o file had the symbols as
UNDF + EXT (undefined external). We now properly link the globals.
Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp?rev=144259&r1=144258&r2=144259&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp Wed Nov 9 21:08:08 2011
@@ -384,6 +384,8 @@
#endif
// Next we find the non-stab entry that corresponds to the N_GSYM in the .o file
Symbol *oso_gsym_symbol = oso_symtab->FindFirstSymbolWithNameAndType(exe_symbol->GetMangled().GetName(), eSymbolTypeData, Symtab::eDebugNo, Symtab::eVisibilityAny);
+ if (oso_gsym_symbol == NULL)
+ oso_gsym_symbol = oso_symtab->FindFirstSymbolWithNameAndType(exe_symbol->GetMangled().GetName(), eSymbolTypeExtern, Symtab::eDebugNo, Symtab::eVisibilityExtern);
if (exe_gsym_symbol && oso_gsym_symbol && exe_gsym_symbol->GetAddressRangePtr() && oso_gsym_symbol->GetAddressRangePtr())
{
// If we found the symbol, then we
From gclayton at apple.com Wed Nov 9 21:38:56 2011
From: gclayton at apple.com (Greg Clayton)
Date: Thu, 10 Nov 2011 03:38:56 -0000
Subject: [Lldb-commits] [lldb] r144261 -
/lldb/trunk/source/Core/DataExtractor.cpp
Message-ID: <20111110033856.DF7CC1BE001@llvm.org>
Author: gclayton
Date: Wed Nov 9 21:38:56 2011
New Revision: 144261
URL: http://llvm.org/viewvc/llvm-project?rev=144261&view=rev
Log:
Fixed the eFormatChar, eFormatCharPrintable and eFormatCharArray to print
things out correctly again.
Modified:
lldb/trunk/source/Core/DataExtractor.cpp
Modified: lldb/trunk/source/Core/DataExtractor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/DataExtractor.cpp?rev=144261&r1=144260&r2=144261&view=diff
==============================================================================
--- lldb/trunk/source/Core/DataExtractor.cpp (original)
+++ lldb/trunk/source/Core/DataExtractor.cpp Wed Nov 9 21:38:56 2011
@@ -1440,18 +1440,15 @@
case eFormatChar:
case eFormatCharPrintable:
case eFormatCharArray:
- if (item_bit_size < 8)
- s->Printf ("%llu", GetMaxU64Bitfield(&offset, item_byte_size, item_bit_size, item_bit_offset));
- else
{
// If we are only printing one character surround it with single
// quotes
if (item_count == 1 && item_format == eFormatChar)
s->PutChar('\'');
- uint32_t ch = GetMaxU64(&offset, item_byte_size);
+ const uint64_t ch = GetMaxU64Bitfield(&offset, item_byte_size, item_bit_size, item_bit_offset);
if (isprint(ch))
- s->Printf ("%c", ch);
+ s->Printf ("%c", (char)ch);
else if (item_format != eFormatCharPrintable)
{
switch (ch)
@@ -1467,9 +1464,9 @@
case '\0': s->Printf ("\\0"); break;
default:
if (item_byte_size == 1)
- s->Printf ("\\x%2.2x", ch);
+ s->Printf ("\\x%2.2x", (uint8_t)ch);
else
- s->Printf ("\\u%x", ch);
+ s->Printf ("%llu", ch);
break;
}
}
From gclayton at apple.com Thu Nov 10 12:31:53 2011
From: gclayton at apple.com (Greg Clayton)
Date: Thu, 10 Nov 2011 18:31:53 -0000
Subject: [Lldb-commits] [lldb] r144297 - in /lldb/trunk/source:
API/SBFrame.cpp Host/macosx/Host.mm
Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
Message-ID: <20111110183153.E22082A6C12E@llvm.org>
Author: gclayton
Date: Thu Nov 10 12:31:53 2011
New Revision: 144297
URL: http://llvm.org/viewvc/llvm-project?rev=144297&view=rev
Log:
Made the Host::SetCrashDescription(const char *) function copy the incoming
string to avoid possible later crashes.
Modified the locations that do set the crash description to NULL out the
string when they are done doing their tasks.
Modified:
lldb/trunk/source/API/SBFrame.cpp
lldb/trunk/source/Host/macosx/Host.mm
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
Modified: lldb/trunk/source/API/SBFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=144297&r1=144296&r2=144297&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFrame.cpp (original)
+++ lldb/trunk/source/API/SBFrame.cpp Thu Nov 10 12:31:53 2011
@@ -765,6 +765,8 @@
keep_in_memory,
fetch_dynamic_value,
*expr_result);
+
+ Host::SetCrashDescription (NULL);
}
if (expr_log)
Modified: lldb/trunk/source/Host/macosx/Host.mm
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/Host.mm?rev=144297&r1=144296&r2=144297&view=diff
==============================================================================
--- lldb/trunk/source/Host/macosx/Host.mm (original)
+++ lldb/trunk/source/Host/macosx/Host.mm Thu Nov 10 12:31:53 2011
@@ -503,7 +503,10 @@
{
const char *shell_executable = getenv("SHELL");
std::string safe_arg;
- command.Printf(" -- %s -c '", shell_executable);
+ if (launch_info.GetArchitecture().IsValid())
+ command.Printf(" -- %s -c 'exec /usr/bin/arch -arch %s ", shell_executable, launch_info.GetArchitecture().GetArchitectureName());
+ else
+ command.Printf(" -- %s -c 'exec ", shell_executable);
const char **argv = launch_info.GetArguments().GetConstArgumentVector ();
if (argv)
{
@@ -644,7 +647,16 @@
Host::SetCrashDescription (const char *cstr)
{
Mutex::Locker locker (GetCrashReporterMutex ());
- __crashreporter_info__ = cstr;
+ static std::string g_crash_description;
+ if (cstr)
+ {
+ g_crash_description.assign (cstr);
+ __crashreporter_info__ = g_crash_description.c_str();
+ }
+ else
+ {
+ __crashreporter_info__ = NULL;
+ }
}
bool
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=144297&r1=144296&r2=144297&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Thu Nov 10 12:31:53 2011
@@ -4585,6 +4585,8 @@
is_artificial);
LinkDeclContextToDIE(ClangASTContext::GetAsDeclContext(cxx_method_decl), die);
+ Host::SetCrashDescription (NULL);
+
type_handled = cxx_method_decl != NULL;
}
}
From gclayton at apple.com Thu Nov 10 13:20:53 2011
From: gclayton at apple.com (Greg Clayton)
Date: Thu, 10 Nov 2011 19:20:53 -0000
Subject: [Lldb-commits] [lldb] r144302 - in /lldb/trunk:
include/lldb/API/SBType.h scripts/Python/interface/SBType.i
source/API/SBType.cpp
Message-ID: <20111110192053.1816A2A6C12F@llvm.org>
Author: gclayton
Date: Thu Nov 10 13:20:52 2011
New Revision: 144302
URL: http://llvm.org/viewvc/llvm-project?rev=144302&view=rev
Log:
Added the ability to get a type without qualifiers (const, volatile, restrict, etc).
Modified:
lldb/trunk/include/lldb/API/SBType.h
lldb/trunk/scripts/Python/interface/SBType.i
lldb/trunk/source/API/SBType.cpp
Modified: lldb/trunk/include/lldb/API/SBType.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBType.h?rev=144302&r1=144301&r2=144302&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBType.h (original)
+++ lldb/trunk/include/lldb/API/SBType.h Thu Nov 10 13:20:52 2011
@@ -92,7 +92,10 @@
lldb::SBType
GetDereferencedType();
-
+
+ lldb::SBType
+ GetUnqualifiedType();
+
lldb::SBType
GetBasicType(lldb::BasicType type);
Modified: lldb/trunk/scripts/Python/interface/SBType.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBType.i?rev=144302&r1=144301&r2=144302&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBType.i (original)
+++ lldb/trunk/scripts/Python/interface/SBType.i Thu Nov 10 13:20:52 2011
@@ -143,6 +143,9 @@
GetDereferencedType();
lldb::SBType
+ GetUnqualifiedType();
+
+ lldb::SBType
GetBasicType (lldb::BasicType type);
uint32_t
Modified: lldb/trunk/source/API/SBType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBType.cpp?rev=144302&r1=144301&r2=144302&view=diff
==============================================================================
--- lldb/trunk/source/API/SBType.cpp (original)
+++ lldb/trunk/source/API/SBType.cpp Thu Nov 10 13:20:52 2011
@@ -211,6 +211,17 @@
return SBType(ClangASTType(m_opaque_sp->GetASTContext(),qt.getNonReferenceType().getAsOpaquePtr()));
}
+lldb::SBType
+SBType::GetUnqualifiedType()
+{
+ if (!IsValid())
+ return SBType();
+
+ QualType qt (QualType::getFromOpaquePtr(m_opaque_sp->GetOpaqueQualType()));
+ return SBType(ClangASTType(m_opaque_sp->GetASTContext(),qt.getUnqualifiedType().getAsOpaquePtr()));
+}
+
+
SBType
SBType::GetBasicType(lldb::BasicType type)
{
From jmolenda at apple.com Thu Nov 10 16:43:35 2011
From: jmolenda at apple.com (Jason Molenda)
Date: Thu, 10 Nov 2011 22:43:35 -0000
Subject: [Lldb-commits] [lldb] r144327 -
/lldb/trunk/source/Commands/CommandObjectCommands.cpp
Message-ID: <20111110224335.96FF02A6C130@llvm.org>
Author: jmolenda
Date: Thu Nov 10 16:43:35 2011
New Revision: 144327
URL: http://llvm.org/viewvc/llvm-project?rev=144327&view=rev
Log:
Fix help strings that refer to the "commands" top-level noun.
It's "command", "commands" is not recognized.
Modified:
lldb/trunk/source/Commands/CommandObjectCommands.cpp
Modified: lldb/trunk/source/Commands/CommandObjectCommands.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCommands.cpp?rev=144327&r1=144326&r2=144327&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectCommands.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectCommands.cpp Thu Nov 10 16:43:35 2011
@@ -330,21 +330,21 @@
"'alias' allows the user to create a short-cut or abbreviation for long \n\
commands, multi-word commands, and commands that take particular options. \n\
Below are some simple examples of how one might use the 'alias' command: \n\
- \n 'commands alias sc script' // Creates the abbreviation 'sc' for the 'script' \n\
+ \n 'command alias sc script' // Creates the abbreviation 'sc' for the 'script' \n\
// command. \n\
- 'commands alias bp breakpoint' // Creates the abbreviation 'bp' for the 'breakpoint' \n\
+ 'command alias bp breakpoint' // Creates the abbreviation 'bp' for the 'breakpoint' \n\
// command. Since breakpoint commands are two-word \n\
// commands, the user will still need to enter the \n\
// second word after 'bp', e.g. 'bp enable' or \n\
// 'bp delete'. \n\
- 'commands alias bpl breakpoint list' // Creates the abbreviation 'bpl' for the \n\
+ 'command alias bpl breakpoint list' // Creates the abbreviation 'bpl' for the \n\
// two-word command 'breakpoint list'. \n\
\nAn alias can include some options for the command, with the values either \n\
filled in at the time the alias is created, or specified as positional \n\
arguments, to be filled in when the alias is invoked. The following example \n\
shows how to create aliases with options: \n\
\n\
- 'commands alias bfl breakpoint set -f %1 -l %2' \n\
+ 'command alias bfl breakpoint set -f %1 -l %2' \n\
\nThis creates the abbreviation 'bfl' (for break-file-line), with the -f and -l \n\
options already part of the alias. So if the user wants to set a breakpoint \n\
by file and line without explicitly having to use the -f and -l options, the \n\
@@ -359,7 +359,7 @@
Note: the positional arguments must substitute as whole words in the resultant\n\
command, so you can't at present do something like:\n\
\n\
- commands alias bcppfl breakpoint set -f %1.cpp -l %2\n\
+ command alias bcppfl breakpoint set -f %1.cpp -l %2\n\
\n\
to get the file extension \".cpp\" automatically appended. For more complex\n\
aliasing, use the \"command regex\" command instead.\n\
@@ -367,19 +367,19 @@
filled in with the first argument following 'bfl' and the actual line number \n\
value will be filled in with the second argument. The user would use this \n\
alias as follows: \n\
- \n (lldb) commands alias bfl breakpoint set -f %1 -l %2 \n\
+ \n (lldb) command alias bfl breakpoint set -f %1 -l %2 \n\
<... some time later ...> \n\
(lldb) bfl my-file.c 137 \n\
\nThis would be the same as if the user had entered \n\
'breakpoint set -f my-file.c -l 137'. \n\
\nAnother example: \n\
- \n (lldb) commands alias pltty process launch -s -o %1 -e %1 \n\
+ \n (lldb) command alias pltty process launch -s -o %1 -e %1 \n\
(lldb) pltty /dev/tty0 \n\
// becomes 'process launch -s -o /dev/tty0 -e /dev/tty0' \n\
\nIf the user always wanted to pass the same value to a particular option, the \n\
alias could be defined with that value directly in the alias as a constant, \n\
rather than using a positional placeholder: \n\
- \n commands alias bl3 breakpoint set -f %1 -l 3 // Always sets a breakpoint on line \n\
+ \n command alias bl3 breakpoint set -f %1 -l 3 // Always sets a breakpoint on line \n\
// 3 of whatever file is indicated. \n");
CommandArgumentEntry arg1;
@@ -797,7 +797,7 @@
const size_t argc = args.GetArgumentCount();
if (argc == 0)
{
- result.AppendError ("usage: 'commands regex [s/// s/// ...]'\n");
+ result.AppendError ("usage: 'command regex [s/// s/// ...]'\n");
result.SetStatus (eReturnStatusFailed);
}
else
From jmolenda at apple.com Thu Nov 10 17:03:44 2011
From: jmolenda at apple.com (Jason Molenda)
Date: Thu, 10 Nov 2011 23:03:44 -0000
Subject: [Lldb-commits] [lldb] r144330 -
/lldb/trunk/source/Commands/CommandObjectTarget.cpp
Message-ID: <20111110230344.732222A6C130@llvm.org>
Author: jmolenda
Date: Thu Nov 10 17:03:44 2011
New Revision: 144330
URL: http://llvm.org/viewvc/llvm-project?rev=144330&view=rev
Log:
Fix order of arguments for target stop-hook list/delete. Having
the argument description in the command name could cause a command
alias to crash, e.g.
command alias zzz target stop-hook delete 1
because the "name" is used to re-fetch the exact CommandObject when
adding the final arg.
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=144330&r1=144329&r2=144330&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Thu Nov 10 17:03:44 2011
@@ -3830,9 +3830,9 @@
CommandObjectTargetStopHookDelete (CommandInterpreter &interpreter) :
CommandObject (interpreter,
- "target stop-hook delete []",
+ "target stop-hook delete",
"Delete a stop-hook.",
- "target stop-hook delete")
+ "target stop-hook delete []")
{
}
@@ -3976,9 +3976,9 @@
CommandObjectTargetStopHookList (CommandInterpreter &interpreter) :
CommandObject (interpreter,
- "target stop-hook list []",
+ "target stop-hook list",
"List all stop-hooks.",
- "target stop-hook list")
+ "target stop-hook list []")
{
}
From gclayton at apple.com Thu Nov 10 19:21:03 2011
From: gclayton at apple.com (Greg Clayton)
Date: Fri, 11 Nov 2011 01:21:03 -0000
Subject: [Lldb-commits] [lldb] r144353 -
/lldb/trunk/include/lldb/Core/MappedHash.h
Message-ID: <20111111012103.72C4B2A6C130@llvm.org>
Author: gclayton
Date: Thu Nov 10 19:21:03 2011
New Revision: 144353
URL: http://llvm.org/viewvc/llvm-project?rev=144353&view=rev
Log:
Allow the Apple hash tables to be emtpy.
Modified:
lldb/trunk/include/lldb/Core/MappedHash.h
Modified: lldb/trunk/include/lldb/Core/MappedHash.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/MappedHash.h?rev=144353&r1=144352&r2=144353&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/MappedHash.h (original)
+++ lldb/trunk/include/lldb/Core/MappedHash.h Thu Nov 10 19:21:03 2011
@@ -380,7 +380,7 @@
m_hash_offsets (NULL)
{
uint32_t offset = m_header.Read (data, 0);
- if (offset != UINT32_MAX)
+ if (offset != UINT32_MAX && IsValid ())
{
m_hash_indexes = (uint32_t *)data.GetData (&offset, m_header.bucket_count * sizeof(uint32_t));
m_hash_values = (uint32_t *)data.GetData (&offset, m_header.hashes_count * sizeof(uint32_t));
@@ -396,7 +396,10 @@
bool
IsValid () const
{
- return m_header.version == 1 && m_header.hash_function == eHashFunctionDJB;
+ return m_header.version == 1 &&
+ m_header.hash_function == eHashFunctionDJB &&
+ m_header.bucket_count > 0 &&
+ m_header.hashes_count > 0;
}
uint32_t
From gclayton at apple.com Thu Nov 10 21:16:25 2011
From: gclayton at apple.com (Greg Clayton)
Date: Fri, 11 Nov 2011 03:16:25 -0000
Subject: [Lldb-commits] [lldb] r144359 -
/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
Message-ID: <20111111031625.C146A2A6C130@llvm.org>
Author: gclayton
Date: Thu Nov 10 21:16:25 2011
New Revision: 144359
URL: http://llvm.org/viewvc/llvm-project?rev=144359&view=rev
Log:
Added report errors for when the .apple_XXXX hashed name table lookups contain
invalid information. This will help us perfect the tables that are emitted by
clang.
Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
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=144359&r1=144358&r2=144359&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Thu Nov 10 21:16:25 2011
@@ -1743,7 +1743,16 @@
const dw_offset_t die_offset = method_die_offsets[i];
DWARFDebugInfoEntry *method_die = debug_info->GetDIEPtrWithCompileUnitHint (die_offset, &method_cu);
- ResolveType (method_cu, method_die);
+ if (method_die)
+ ResolveType (method_cu, method_die);
+ else
+ {
+ if (m_using_apple_tables)
+ {
+ ReportError (".apple_objc accelerator table had bad die 0x%8.8x for '%s'\n",
+ die_offset, class_str.c_str());
+ }
+ }
}
}
}
@@ -2295,16 +2304,27 @@
const dw_offset_t die_offset = die_offsets[i];
die = debug_info->GetDIEPtrWithCompileUnitHint (die_offset, &dwarf_cu);
- sc.comp_unit = GetCompUnitForDWARFCompUnit(dwarf_cu, UINT32_MAX);
- assert(sc.comp_unit != NULL);
-
- if (namespace_decl && !DIEIsInNamespace (namespace_decl, dwarf_cu, die))
- continue;
+ if (die)
+ {
+ sc.comp_unit = GetCompUnitForDWARFCompUnit(dwarf_cu, UINT32_MAX);
+ assert(sc.comp_unit != NULL);
+
+ if (namespace_decl && !DIEIsInNamespace (namespace_decl, dwarf_cu, die))
+ continue;
- ParseVariables(sc, dwarf_cu, LLDB_INVALID_ADDRESS, die, false, false, &variables);
+ ParseVariables(sc, dwarf_cu, LLDB_INVALID_ADDRESS, die, false, false, &variables);
- if (variables.GetSize() - original_size >= max_matches)
- break;
+ if (variables.GetSize() - original_size >= max_matches)
+ break;
+ }
+ else
+ {
+ if (m_using_apple_tables)
+ {
+ ReportError (".apple_names accelerator table had bad die 0x%8.8x for '%s'\n",
+ die_offset, name.GetCString());
+ }
+ }
}
}
@@ -2367,12 +2387,24 @@
{
const dw_offset_t die_offset = die_offsets[i];
die = debug_info->GetDIEPtrWithCompileUnitHint (die_offset, &dwarf_cu);
- sc.comp_unit = GetCompUnitForDWARFCompUnit(dwarf_cu, UINT32_MAX);
+
+ if (die)
+ {
+ sc.comp_unit = GetCompUnitForDWARFCompUnit(dwarf_cu, UINT32_MAX);
- ParseVariables(sc, dwarf_cu, LLDB_INVALID_ADDRESS, die, false, false, &variables);
+ ParseVariables(sc, dwarf_cu, LLDB_INVALID_ADDRESS, die, false, false, &variables);
- if (variables.GetSize() - original_size >= max_matches)
- break;
+ if (variables.GetSize() - original_size >= max_matches)
+ break;
+ }
+ else
+ {
+ if (m_using_apple_tables)
+ {
+ ReportError (".apple_names accelerator table had bad die 0x%8.8x for regex '%s'\n",
+ die_offset, regex.GetText());
+ }
+ }
}
}
@@ -2677,7 +2709,8 @@
num_matches = m_apple_names_ap->FindByName (name_cstr, die_offsets);
for (uint32_t i = 0; i < num_matches; i++)
{
- const DWARFDebugInfoEntry *die = info->GetDIEPtrWithCompileUnitHint (die_offsets[i], &dwarf_cu);
+ const dw_offset_t die_offset = die_offsets[i];
+ const DWARFDebugInfoEntry *die = info->GetDIEPtrWithCompileUnitHint (die_offset, &dwarf_cu);
if (die)
{
if (namespace_decl && !DIEIsInNamespace (namespace_decl, dwarf_cu, die))
@@ -2685,6 +2718,11 @@
ResolveFunction (dwarf_cu, die, sc_list);
}
+ else
+ {
+ ReportError (".apple_names accelerator table had bad die 0x%8.8x for '%s'\n",
+ die_offset, name_cstr);
+ }
}
}
else
@@ -2700,13 +2738,19 @@
for (uint32_t i = 0; i < num_matches; i++)
{
- const DWARFDebugInfoEntry* die = info->GetDIEPtrWithCompileUnitHint (die_offsets[i], &dwarf_cu);
+ const dw_offset_t die_offset = die_offsets[i];
+ const DWARFDebugInfoEntry* die = info->GetDIEPtrWithCompileUnitHint (die_offset, &dwarf_cu);
if (die)
{
const char *die_name = die->GetName(this, dwarf_cu);
if (ObjCLanguageRuntime::IsPossibleObjCMethodName(die_name))
ResolveFunction (dwarf_cu, die, sc_list);
}
+ else
+ {
+ ReportError (".apple_names accelerator table had bad die 0x%8.8x for '%s'\n",
+ die_offset, name_cstr);
+ }
}
die_offsets.clear();
}
@@ -2728,7 +2772,8 @@
for (uint32_t i = 0; i < num_matches; i++)
{
- const DWARFDebugInfoEntry* die = info->GetDIEPtrWithCompileUnitHint (die_offsets[i], &dwarf_cu);
+ const dw_offset_t die_offset = die_offsets[i];
+ const DWARFDebugInfoEntry* die = info->GetDIEPtrWithCompileUnitHint (die_offset, &dwarf_cu);
if (die)
{
if (namespace_decl && !DIEIsInNamespace (namespace_decl, dwarf_cu, die))
@@ -2745,6 +2790,11 @@
// If we get to here, the die is good, and we should add it:
ResolveFunction (dwarf_cu, die, sc_list);
}
+ else
+ {
+ ReportError (".apple_names accelerator table had bad die 0x%8.8x for '%s'\n",
+ die_offset, name_cstr);
+ }
}
die_offsets.clear();
}
@@ -2967,17 +3017,29 @@
const dw_offset_t die_offset = die_offsets[i];
die = debug_info->GetDIEPtrWithCompileUnitHint (die_offset, &dwarf_cu);
- if (namespace_decl && !DIEIsInNamespace (namespace_decl, dwarf_cu, die))
- continue;
-
- Type *matching_type = ResolveType (dwarf_cu, die);
- if (matching_type)
+ if (die)
{
- // We found a type pointer, now find the shared pointer form our type list
- types.InsertUnique (TypeSP (matching_type));
- if (types.GetSize() >= max_matches)
- break;
+ if (namespace_decl && !DIEIsInNamespace (namespace_decl, dwarf_cu, die))
+ continue;
+
+ Type *matching_type = ResolveType (dwarf_cu, die);
+ if (matching_type)
+ {
+ // We found a type pointer, now find the shared pointer form our type list
+ types.InsertUnique (TypeSP (matching_type));
+ if (types.GetSize() >= max_matches)
+ break;
+ }
}
+ else
+ {
+ if (m_using_apple_tables)
+ {
+ ReportError (".apple_types accelerator table had bad die 0x%8.8x for '%s'\n",
+ die_offset, name.GetCString());
+ }
+ }
+
}
return types.GetSize() - initial_types_size;
}
@@ -3038,15 +3100,27 @@
const dw_offset_t die_offset = die_offsets[i];
die = debug_info->GetDIEPtrWithCompileUnitHint (die_offset, &dwarf_cu);
- if (parent_namespace_decl && !DIEIsInNamespace (parent_namespace_decl, dwarf_cu, die))
- continue;
-
- clang::NamespaceDecl *clang_namespace_decl = ResolveNamespaceDIE (dwarf_cu, die);
- if (clang_namespace_decl)
+ if (die)
{
- namespace_decl.SetASTContext (GetClangASTContext().getASTContext());
- namespace_decl.SetNamespaceDecl (clang_namespace_decl);
+ if (parent_namespace_decl && !DIEIsInNamespace (parent_namespace_decl, dwarf_cu, die))
+ continue;
+
+ clang::NamespaceDecl *clang_namespace_decl = ResolveNamespaceDIE (dwarf_cu, die);
+ if (clang_namespace_decl)
+ {
+ namespace_decl.SetASTContext (GetClangASTContext().getASTContext());
+ namespace_decl.SetNamespaceDecl (clang_namespace_decl);
+ }
}
+ else
+ {
+ if (m_using_apple_tables)
+ {
+ ReportError (".apple_namespaces accelerator table had bad die 0x%8.8x for '%s'\n",
+ die_offset, name.GetCString());
+ }
+ }
+
}
}
}
@@ -3748,31 +3822,43 @@
const dw_offset_t die_offset = die_offsets[i];
type_die = debug_info->GetDIEPtrWithCompileUnitHint (die_offset, &type_cu);
- if (type_die != die && type_die->Tag() == type_tag)
+ if (type_die)
{
- // Hold off on comparing parent DIE tags until
- // we know what happens with stuff in namespaces
- // for gcc and clang...
- //DWARFDebugInfoEntry *parent_die = die->GetParent();
- //DWARFDebugInfoEntry *parent_type_die = type_die->GetParent();
- //if (parent_die->Tag() == parent_type_die->Tag())
- {
- Type *resolved_type = ResolveType (type_cu, type_die, false);
- if (resolved_type && resolved_type != DIE_IS_BEING_PARSED)
- {
- DEBUG_PRINTF ("resolved 0x%8.8llx (cu 0x%8.8llx) from %s to 0x%8.8llx (cu 0x%8.8llx)\n",
- MakeUserID(die->GetOffset()),
- MakeUserID(curr_cu->GetOffset()),
- m_obj_file->GetFileSpec().GetFilename().AsCString(),
- MakeUserID(type_die->GetOffset()),
- MakeUserID(type_cu->GetOffset()));
-
- m_die_to_type[die] = resolved_type;
- type_sp = resolved_type;
- break;
+ if (type_die != die && type_die->Tag() == type_tag)
+ {
+ // Hold off on comparing parent DIE tags until
+ // we know what happens with stuff in namespaces
+ // for gcc and clang...
+ //DWARFDebugInfoEntry *parent_die = die->GetParent();
+ //DWARFDebugInfoEntry *parent_type_die = type_die->GetParent();
+ //if (parent_die->Tag() == parent_type_die->Tag())
+ {
+ Type *resolved_type = ResolveType (type_cu, type_die, false);
+ if (resolved_type && resolved_type != DIE_IS_BEING_PARSED)
+ {
+ DEBUG_PRINTF ("resolved 0x%8.8llx (cu 0x%8.8llx) from %s to 0x%8.8llx (cu 0x%8.8llx)\n",
+ MakeUserID(die->GetOffset()),
+ MakeUserID(curr_cu->GetOffset()),
+ m_obj_file->GetFileSpec().GetFilename().AsCString(),
+ MakeUserID(type_die->GetOffset()),
+ MakeUserID(type_cu->GetOffset()));
+
+ m_die_to_type[die] = resolved_type;
+ type_sp = resolved_type;
+ break;
+ }
}
}
}
+ else
+ {
+ if (m_using_apple_tables)
+ {
+ ReportError (".apple_types accelerator table had bad die 0x%8.8x for '%s'\n",
+ die_offset, type_name.GetCString());
+ }
+ }
+
}
}
return type_sp;
@@ -5000,12 +5086,23 @@
{
const dw_offset_t die_offset = die_offsets[i];
die = debug_info->GetDIEPtrWithCompileUnitHint (die_offset, &match_dwarf_cu);
- VariableSP var_sp (ParseVariableDIE(sc, dwarf_cu, die, LLDB_INVALID_ADDRESS));
- if (var_sp)
+ if (die)
{
- variables->AddVariableIfUnique (var_sp);
- ++vars_added;
+ VariableSP var_sp (ParseVariableDIE(sc, dwarf_cu, die, LLDB_INVALID_ADDRESS));
+ if (var_sp)
+ {
+ variables->AddVariableIfUnique (var_sp);
+ ++vars_added;
+ }
}
+ else
+ {
+ if (m_using_apple_tables)
+ {
+ ReportError (".apple_names accelerator table had bad die 0x%8.8x\n", die_offset);
+ }
+ }
+
}
}
}
From scallanan at apple.com Fri Nov 11 12:37:32 2011
From: scallanan at apple.com (Sean Callanan)
Date: Fri, 11 Nov 2011 18:37:32 -0000
Subject: [Lldb-commits] [lldb] r144400 -
/lldb/trunk/include/lldb/Expression/ClangASTSource.h
Message-ID: <20111111183732.95C7E1BE001@llvm.org>
Author: spyffe
Date: Fri Nov 11 12:37:32 2011
New Revision: 144400
URL: http://llvm.org/viewvc/llvm-project?rev=144400&view=rev
Log:
Fixed a bug that inhibited symbol lookup. The
problem is that we had a bitfield that kept
track of what had been found so far, and inhibited
searches when the local variable bit was set.
This bitfield was not being initialized correctly.
Modified:
lldb/trunk/include/lldb/Expression/ClangASTSource.h
Modified: lldb/trunk/include/lldb/Expression/ClangASTSource.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangASTSource.h?rev=144400&r1=144399&r2=144400&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/ClangASTSource.h (original)
+++ lldb/trunk/include/lldb/Expression/ClangASTSource.h Fri Nov 11 12:37:32 2011
@@ -369,7 +369,10 @@
m_ast_source(astSource),
m_decls(decls),
m_decl_name(name),
- m_decl_context(dc) {}
+ m_decl_context(dc)
+ {
+ memset(&m_found, 0, sizeof(m_found));
+ }
//------------------------------------------------------------------
/// Create a VarDecl with the name being searched for and the provided
From daniel at zuster.org Fri Nov 11 17:36:19 2011
From: daniel at zuster.org (Daniel Dunbar)
Date: Fri, 11 Nov 2011 23:36:19 -0000
Subject: [Lldb-commits] [lldb] r144429 - /lldb/trunk/Makefile
Message-ID: <20111111233619.608B41BE001@llvm.org>
Author: ddunbar
Date: Fri Nov 11 17:36:19 2011
New Revision: 144429
URL: http://llvm.org/viewvc/llvm-project?rev=144429&view=rev
Log:
build/Make: Tweak Clang include paths to use LLVM_{SRC,OBJ}_ROOT instead of
level based, so that lldb itself can be a symlink inside the tools dir.
Modified:
lldb/trunk/Makefile
Modified: lldb/trunk/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/Makefile?rev=144429&r1=144428&r2=144429&view=diff
==============================================================================
--- lldb/trunk/Makefile (original)
+++ lldb/trunk/Makefile Fri Nov 11 17:36:19 2011
@@ -33,8 +33,8 @@
# Set common LLDB build flags.
CPP.Flags += -I$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/include
CPP.Flags += -I$(PROJ_OBJ_DIR)/$(LLDB_LEVEL)/include
-CPP.Flags += -I$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/../clang/include
-CPP.Flags += -I$(PROJ_OBJ_DIR)/$(LLDB_LEVEL)/../clang/include
+CPP.Flags += -I$(LLVM_SRC_ROOT)/tools/clang/include
+CPP.Flags += -I$(LLVM_OBJ_ROOT)/tools/clang/include
CPP.Flags += $(PYTHON_INC_DIR)
CPP.Flags += -I$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/source
CPP.Flags += -I$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/source/Utility
From gclayton at apple.com Fri Nov 11 20:10:57 2011
From: gclayton at apple.com (Greg Clayton)
Date: Sat, 12 Nov 2011 02:10:57 -0000
Subject: [Lldb-commits] [lldb] r144443 - in /lldb/trunk:
include/lldb/Target/Process.h source/API/SBProcess.cpp
source/API/SBTarget.cpp source/Commands/CommandObjectProcess.cpp
source/Host/macosx/Host.mm
source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
source/Target/Process.cpp
Message-ID: <20111112021057.3058B1BE001@llvm.org>
Author: gclayton
Date: Fri Nov 11 20:10:56 2011
New Revision: 144443
URL: http://llvm.org/viewvc/llvm-project?rev=144443&view=rev
Log:
Added the ability to run a process in a shell on MacOSX currently when using
the --tty option. So you can now get shell expansion and file redirection:
(lldb) process launch --tty --shell -- *.jpg < in.txt > out.txt
Again, the "--tty" is mandatory for now until we hook this up to other
functions. The shell is also currently hard coded to "/bin/bash" and not the
"SHELL" variable. "/bin/tcsh" was causing problems which I need to dig into.
Modified:
lldb/trunk/include/lldb/Target/Process.h
lldb/trunk/source/API/SBProcess.cpp
lldb/trunk/source/API/SBTarget.cpp
lldb/trunk/source/Commands/CommandObjectProcess.cpp
lldb/trunk/source/Host/macosx/Host.mm
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
lldb/trunk/source/Target/Process.cpp
Modified: lldb/trunk/include/lldb/Target/Process.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=144443&r1=144442&r2=144443&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Fri Nov 11 20:10:56 2011
@@ -1332,7 +1332,7 @@
/// LLDB_INVALID_PROCESS_ID if attaching fails.
//------------------------------------------------------------------
virtual Error
- Attach (lldb::pid_t pid);
+ Attach (lldb::pid_t pid, uint32_t exec_count);
//------------------------------------------------------------------
/// Attach to an existing process by process name.
@@ -2711,8 +2711,13 @@
NextEventAction (Process *process) :
m_process(process)
- {}
- virtual ~NextEventAction() {}
+ {
+ }
+
+ virtual
+ ~NextEventAction()
+ {
+ }
virtual EventActionResult PerformAction (lldb::EventSP &event_sp) = 0;
virtual void HandleBeingUnshipped () {};
@@ -2734,15 +2739,22 @@
class AttachCompletionHandler : public NextEventAction
{
public:
- AttachCompletionHandler (Process *process) :
- NextEventAction(process)
- {}
- virtual ~AttachCompletionHandler() {}
+ AttachCompletionHandler (Process *process, uint32_t exec_count) :
+ NextEventAction (process),
+ m_exec_count (exec_count)
+ {
+ }
+
+ virtual
+ ~AttachCompletionHandler()
+ {
+ }
virtual EventActionResult PerformAction (lldb::EventSP &event_sp);
virtual EventActionResult HandleBeingInterrupted ();
virtual const char *GetExitString();
private:
+ uint32_t m_exec_count;
std::string m_exit_string;
};
Modified: lldb/trunk/source/API/SBProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBProcess.cpp?rev=144443&r1=144442&r2=144443&view=diff
==============================================================================
--- lldb/trunk/source/API/SBProcess.cpp (original)
+++ lldb/trunk/source/API/SBProcess.cpp Fri Nov 11 20:10:56 2011
@@ -169,7 +169,7 @@
Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
if (m_opaque_sp->GetState() == eStateConnected)
{
- error.SetError (m_opaque_sp->Attach (pid));
+ error.SetError (m_opaque_sp->Attach (pid, 0));
}
else
{
Modified: lldb/trunk/source/API/SBTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=144443&r1=144442&r2=144443&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTarget.cpp (original)
+++ lldb/trunk/source/API/SBTarget.cpp Fri Nov 11 20:10:56 2011
@@ -337,7 +337,7 @@
if (sb_process.IsValid())
{
- error.SetError (sb_process->Attach (pid));
+ error.SetError (sb_process->Attach (pid, 0));
// If we are doing synchronous mode, then wait for the
// process to stop!
if (m_opaque_sp->GetDebugger().GetAsyncExecution () == false)
Modified: lldb/trunk/source/Commands/CommandObjectProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectProcess.cpp?rev=144443&r1=144442&r2=144443&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectProcess.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectProcess.cpp Fri Nov 11 20:10:56 2011
@@ -232,6 +232,8 @@
if (m_options.launch_info.GetFlags().Test (eLaunchFlagLaunchInTTY))
{
+ m_options.launch_info.GetArchitecture() = target->GetArchitecture();
+
process = target->GetPlatform()->DebugProcess (m_options.launch_info,
debugger,
target,
@@ -695,7 +697,7 @@
if (attach_pid != LLDB_INVALID_PROCESS_ID)
{
- error = process->Attach (attach_pid);
+ error = process->Attach (attach_pid, 0);
if (error.Success())
{
result.SetStatus (eReturnStatusSuccessContinuingNoResult);
Modified: lldb/trunk/source/Host/macosx/Host.mm
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/Host.mm?rev=144443&r1=144442&r2=144443&view=diff
==============================================================================
--- lldb/trunk/source/Host/macosx/Host.mm (original)
+++ lldb/trunk/source/Host/macosx/Host.mm Fri Nov 11 20:10:56 2011
@@ -501,10 +501,10 @@
if (launch_info.GetFlags().Test (eLaunchFlagLaunchInShell))
{
- const char *shell_executable = getenv("SHELL");
+ const char *shell_executable = "/bin/bash"; //getenv("SHELL");
std::string safe_arg;
if (launch_info.GetArchitecture().IsValid())
- command.Printf(" -- %s -c 'exec /usr/bin/arch -arch %s ", shell_executable, launch_info.GetArchitecture().GetArchitectureName());
+ command.Printf(" -- %s -c 'exec /usr/bin/arch -arch %s", shell_executable, launch_info.GetArchitecture().GetArchitectureName());
else
command.Printf(" -- %s -c 'exec ", shell_executable);
const char **argv = launch_info.GetArguments().GetConstArgumentVector ();
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp?rev=144443&r1=144442&r2=144443&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp Fri Nov 11 20:10:56 2011
@@ -443,7 +443,7 @@
process_sp = target->CreateProcess (listener, "gdb-remote");
if (process_sp)
- error = process_sp->Attach (pid);
+ error = process_sp->Attach (pid, 2);
}
}
else
Modified: lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp?rev=144443&r1=144442&r2=144443&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp Fri Nov 11 20:10:56 2011
@@ -391,7 +391,7 @@
assert (connect_url_len < sizeof(connect_url));
error = process_sp->ConnectRemote (connect_url);
if (error.Success())
- error = process_sp->Attach(pid);
+ error = process_sp->Attach(pid, 0);
}
}
}
Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=144443&r1=144442&r2=144443&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Fri Nov 11 20:10:56 2011
@@ -2186,24 +2186,33 @@
case eStateStopped:
case eStateCrashed:
- {
- // During attach, prior to sending the eStateStopped event,
- // lldb_private::Process subclasses must set the process must set
- // the new process ID.
- assert (m_process->GetID() != LLDB_INVALID_PROCESS_ID);
- m_process->CompleteAttach ();
- return eEventActionSuccess;
- }
-
-
+ {
+ // During attach, prior to sending the eStateStopped event,
+ // lldb_private::Process subclasses must set the process must set
+ // the new process ID.
+ assert (m_process->GetID() != LLDB_INVALID_PROCESS_ID);
+ if (m_exec_count > 0)
+ {
+ --m_exec_count;
+ m_process->Resume();
+ return eEventActionRetry;
+ }
+ else
+ {
+ m_process->CompleteAttach ();
+ return eEventActionSuccess;
+ }
+ }
break;
+
default:
case eStateExited:
case eStateInvalid:
- m_exit_string.assign ("No valid Process");
- return eEventActionExit;
break;
}
+
+ m_exit_string.assign ("No valid Process");
+ return eEventActionExit;
}
Process::NextEventAction::EventActionResult
@@ -2219,7 +2228,7 @@
}
Error
-Process::Attach (lldb::pid_t attach_pid)
+Process::Attach (lldb::pid_t attach_pid, uint32_t exec_count)
{
m_abi_sp.reset();
@@ -2236,7 +2245,8 @@
error = DoAttachToProcessWithID (attach_pid);
if (error.Success())
{
- SetNextEventAction(new Process::AttachCompletionHandler(this));
+
+ SetNextEventAction(new Process::AttachCompletionHandler(this, exec_count));
StartPrivateStateThread();
}
else
@@ -2316,7 +2326,7 @@
}
else
{
- SetNextEventAction(new Process::AttachCompletionHandler(this));
+ SetNextEventAction(new Process::AttachCompletionHandler(this, 0));
StartPrivateStateThread();
}
}
@@ -2806,8 +2816,10 @@
case NextEventAction::eEventActionSuccess:
SetNextEventAction(NULL);
break;
+
case NextEventAction::eEventActionRetry:
break;
+
case NextEventAction::eEventActionExit:
// Handle Exiting Here. If we already got an exited event,
// we should just propagate it. Otherwise, swallow this event,
From jingham at apple.com Fri Nov 11 19:36:44 2011
From: jingham at apple.com (Jim Ingham)
Date: Sat, 12 Nov 2011 01:36:44 -0000
Subject: [Lldb-commits] [lldb] r144440 - in /lldb/trunk:
include/lldb/Core/ClangForward.h include/lldb/Symbol/ClangASTContext.h
source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
source/Symbol/ClangASTContext.cpp test/lang/objc/objc-property/
test/lang/objc/objc-property/Makefile
test/lang/objc/objc-property/TestObjCProperty.py
test/lang/objc/objc-property/main.m
Message-ID: <20111112013644.54A6E1BE001@llvm.org>
Author: jingham
Date: Fri Nov 11 19:36:43 2011
New Revision: 144440
URL: http://llvm.org/viewvc/llvm-project?rev=144440&view=rev
Log:
Add code that reads the APPLE_property debug info, and makes up properties from them.
Added:
lldb/trunk/test/lang/objc/objc-property/
lldb/trunk/test/lang/objc/objc-property/Makefile
lldb/trunk/test/lang/objc/objc-property/TestObjCProperty.py
lldb/trunk/test/lang/objc/objc-property/main.m
Modified:
lldb/trunk/include/lldb/Core/ClangForward.h
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/Core/ClangForward.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ClangForward.h?rev=144440&r1=144439&r2=144440&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ClangForward.h (original)
+++ lldb/trunk/include/lldb/Core/ClangForward.h Fri Nov 11 19:36:43 2011
@@ -80,6 +80,7 @@
class ObjCEncodeExpr;
class ObjCImplicitSetterGetterRefExpr;
class ObjCInterfaceDecl;
+ class ObjCIvarDecl;
class ObjCIvarRefExpr;
class ObjCMessageExpr;
class ObjCMethodDecl;
Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=144440&r1=144439&r2=144440&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Fri Nov 11 19:36:43 2011
@@ -22,6 +22,7 @@
#include "llvm/ADT/SmallVector.h"
#include "clang/AST/TemplateBase.h"
+
// Project includes
#include "lldb/lldb-enumerations.h"
#include "lldb/Core/ClangForward.h"
@@ -247,7 +248,7 @@
int kind,
lldb::LanguageType language);
- static bool
+ static clang::FieldDecl *
AddFieldToRecordType (clang::ASTContext *ast,
lldb::clang_type_t record_qual_type,
const char *name,
@@ -255,7 +256,7 @@
lldb::AccessType access,
uint32_t bitfield_bit_size);
- bool
+ clang::FieldDecl *
AddFieldToRecordType (lldb::clang_type_t record_qual_type,
const char *name,
lldb::clang_type_t field_type,
@@ -383,7 +384,7 @@
bool isForwardDecl,
bool isInternal);
- static bool
+ static clang::FieldDecl *
AddObjCClassIVar (clang::ASTContext *ast,
lldb::clang_type_t class_opaque_type,
const char *name,
@@ -392,7 +393,7 @@
uint32_t bitfield_bit_size,
bool isSynthesized);
- bool
+ clang::FieldDecl *
AddObjCClassIVar (lldb::clang_type_t class_opaque_type,
const char *name,
lldb::clang_type_t ivar_opaque_type,
@@ -409,6 +410,41 @@
isSynthesized);
}
+ static bool
+ AddObjCClassProperty
+ (
+ clang::ASTContext *ast,
+ lldb::clang_type_t class_opaque_type,
+ const char *property_name,
+ lldb::clang_type_t property_opaque_type, // The property type is only required if you don't have an ivar decl
+ clang::ObjCIvarDecl *ivar_decl,
+ const char *property_setter_name,
+ const char *property_getter_name,
+ uint32_t property_attributes
+ );
+
+ bool
+ AddObjCClassProperty
+ (
+ lldb::clang_type_t class_opaque_type,
+ const char *property_name,
+ lldb::clang_type_t property_opaque_type,
+ clang::ObjCIvarDecl *ivar_decl,
+ const char *property_setter_name,
+ const char *property_getter_name,
+ uint32_t property_attributes
+ )
+ {
+ return ClangASTContext::AddObjCClassProperty (getASTContext(),
+ class_opaque_type,
+ property_name,
+ property_opaque_type,
+ ivar_decl,
+ property_setter_name,
+ property_getter_name,
+ property_attributes);
+ }
+
bool
SetObjCSuperClass (lldb::clang_type_t class_clang_type,
lldb::clang_type_t superclass_clang_type);
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=144440&r1=144439&r2=144440&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Fri Nov 11 19:36:43 2011
@@ -14,6 +14,7 @@
#include "clang/AST/ASTContext.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclGroup.h"
+#include "clang/AST/DeclObjC.h"
#include "clang/Basic/Builtins.h"
#include "clang/Basic/IdentifierTable.h"
#include "clang/Basic/LangOptions.h"
@@ -1324,6 +1325,12 @@
Declaration decl;
//DWARFExpression location;
const char *name = NULL;
+ const char *prop_name = NULL;
+ const char *prop_getter_name = NULL;
+ const char *prop_setter_name = NULL;
+ uint32_t prop_attributes = 0;
+
+
bool is_artificial = false;
lldb::user_id_t encoding_uid = LLDB_INVALID_UID;
AccessType accessibility = eAccessNone;
@@ -1369,6 +1376,12 @@
case DW_AT_description:
case DW_AT_mutable:
case DW_AT_visibility:
+
+ case DW_AT_APPLE_property_name: prop_name = form_value.AsCString(&get_debug_str_data()); break;
+ case DW_AT_APPLE_property_getter: prop_getter_name = form_value.AsCString(&get_debug_str_data()); break;
+ case DW_AT_APPLE_property_setter: prop_setter_name = form_value.AsCString(&get_debug_str_data()); break;
+ case DW_AT_APPLE_property_attribute: prop_attributes = form_value.Unsigned(); break;
+
default:
case DW_AT_sibling:
break;
@@ -1415,13 +1428,14 @@
if (is_artificial == false)
{
Type *member_type = ResolveTypeUID(encoding_uid);
+ clang::FieldDecl *field_decl = NULL;
if (member_type)
{
if (accessibility == eAccessNone)
accessibility = default_accessibility;
member_accessibilities.push_back(accessibility);
- GetClangASTContext().AddFieldToRecordType (class_clang_type,
+ field_decl = GetClangASTContext().AddFieldToRecordType (class_clang_type,
name,
member_type->GetClangLayoutType(),
accessibility,
@@ -1439,6 +1453,22 @@
MakeUserID(die->GetOffset()),
encoding_uid);
}
+
+ if (prop_name != NULL)
+ {
+
+ clang::ObjCIvarDecl *ivar_decl = clang::dyn_cast(field_decl);
+ assert (ivar_decl != NULL);
+
+
+ GetClangASTContext().AddObjCClassProperty (class_clang_type,
+ prop_name,
+ 0,
+ ivar_decl,
+ prop_setter_name,
+ prop_getter_name,
+ prop_attributes);
+ }
}
}
++member_idx;
Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=144440&r1=144439&r2=144440&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Fri Nov 11 19:36:43 2011
@@ -1782,7 +1782,7 @@
return cxx_method_decl;
}
-bool
+clang::FieldDecl *
ClangASTContext::AddFieldToRecordType
(
ASTContext *ast,
@@ -1794,8 +1794,9 @@
)
{
if (record_clang_type == NULL || field_type == NULL)
- return false;
+ return NULL;
+ FieldDecl *field = NULL;
IdentifierTable *identifier_table = &ast->Idents;
assert (ast != NULL);
@@ -1818,7 +1819,7 @@
APInt bitfield_bit_size_apint(ast->getTypeSize(ast->IntTy), bitfield_bit_size);
bit_width = new (*ast)IntegerLiteral (*ast, bitfield_bit_size_apint, ast->IntTy, SourceLocation());
}
- FieldDecl *field = FieldDecl::Create (*ast,
+ field = FieldDecl::Create (*ast,
record_decl,
SourceLocation(),
SourceLocation(),
@@ -1846,7 +1847,7 @@
if (objc_class_type)
{
bool is_synthesized = false;
- ClangASTContext::AddObjCClassIVar (ast,
+ field = ClangASTContext::AddObjCClassIVar (ast,
record_clang_type,
name,
field_type,
@@ -1856,7 +1857,7 @@
}
}
}
- return false;
+ return field;
}
bool
@@ -2047,7 +2048,7 @@
}
-bool
+FieldDecl *
ClangASTContext::AddObjCClassIVar
(
ASTContext *ast,
@@ -2060,8 +2061,10 @@
)
{
if (class_opaque_type == NULL || ivar_opaque_type == NULL)
- return false;
+ return NULL;
+ ObjCIvarDecl *field = NULL;
+
IdentifierTable *identifier_table = &ast->Idents;
assert (ast != NULL);
@@ -2087,16 +2090,16 @@
bit_width = new (*ast)IntegerLiteral (*ast, bitfield_bit_size_apint, ast->IntTy, SourceLocation());
}
- ObjCIvarDecl *field = ObjCIvarDecl::Create (*ast,
- class_interface_decl,
- SourceLocation(),
- SourceLocation(),
- &identifier_table->get(name), // Identifier
- QualType::getFromOpaquePtr(ivar_opaque_type), // Field type
- NULL, // TypeSourceInfo *
- ConvertAccessTypeToObjCIvarAccessControl (access),
- bit_width,
- is_synthesized);
+ field = ObjCIvarDecl::Create (*ast,
+ class_interface_decl,
+ SourceLocation(),
+ SourceLocation(),
+ &identifier_table->get(name), // Identifier
+ QualType::getFromOpaquePtr(ivar_opaque_type), // Field type
+ NULL, // TypeSourceInfo *
+ ConvertAccessTypeToObjCIvarAccessControl (access),
+ bit_width,
+ is_synthesized);
if (field)
{
@@ -2106,14 +2109,105 @@
VerifyDecl(field);
#endif
- return true;
+ return field;
}
}
}
}
- return false;
+ return NULL;
}
+bool
+ClangASTContext::AddObjCClassProperty
+(
+ ASTContext *ast,
+ clang_type_t class_opaque_type,
+ const char *property_name,
+ clang_type_t property_opaque_type,
+ ObjCIvarDecl *ivar_decl,
+ const char *property_setter_name,
+ const char *property_getter_name,
+ uint32_t property_attributes
+)
+{
+ if (class_opaque_type == NULL)
+ return false;
+
+ IdentifierTable *identifier_table = &ast->Idents;
+
+ assert (ast != NULL);
+ assert (identifier_table != NULL);
+
+ QualType class_qual_type(QualType::getFromOpaquePtr(class_opaque_type));
+ const clang::Type *class_type = class_qual_type.getTypePtr();
+ if (class_type)
+ {
+ const ObjCObjectType *objc_class_type = dyn_cast(class_type);
+
+ if (objc_class_type)
+ {
+ ObjCInterfaceDecl *class_interface_decl = objc_class_type->getInterface();
+
+ // FIXME: For now, we don't know how to add properties if we don't have their associated ivar.
+ if (class_interface_decl && ivar_decl)
+ {
+ clang::TypeSourceInfo *prop_type_source;
+ if (ivar_decl)
+ prop_type_source = ast->CreateTypeSourceInfo (ivar_decl->getType());
+ else
+ prop_type_source = ast->CreateTypeSourceInfo (QualType::getFromOpaquePtr(property_opaque_type));
+
+ ObjCPropertyDecl *property_decl = ObjCPropertyDecl::Create(*ast,
+ class_interface_decl,
+ SourceLocation(), // Source Location
+ &identifier_table->get(property_name),
+ SourceLocation(), //Source Location for AT
+ prop_type_source
+ );
+ if (property_decl)
+ {
+ class_interface_decl->addDecl (property_decl);
+ if (property_setter_name != NULL)
+ {
+ std::string property_setter_no_colon(property_setter_name, strlen(property_setter_name) - 1);
+ clang::IdentifierInfo *setter_ident = &identifier_table->get(property_setter_no_colon.c_str());
+ Selector setter_sel = ast->Selectors.getSelector(1, &setter_ident);
+ property_decl->setSetterName(setter_sel);
+ property_decl->setPropertyAttributes (clang::ObjCPropertyDecl::OBJC_PR_setter);
+ }
+
+ if (property_getter_name != NULL)
+ {
+ clang::IdentifierInfo *getter_ident = &identifier_table->get(property_getter_name);
+ Selector getter_sel = ast->Selectors.getSelector(0, &getter_ident);
+ property_decl->setGetterName(getter_sel);
+ property_decl->setPropertyAttributes (clang::ObjCPropertyDecl::OBJC_PR_getter);
+
+ }
+
+ if (ivar_decl)
+ property_decl->setPropertyIvarDecl (ivar_decl);
+
+ if (property_attributes & DW_APPLE_PROPERTY_readonly)
+ property_decl->setPropertyAttributes (clang::ObjCPropertyDecl::OBJC_PR_readonly);
+ if (property_attributes & DW_APPLE_PROPERTY_readwrite)
+ property_decl->setPropertyAttributes (clang::ObjCPropertyDecl::OBJC_PR_readwrite);
+ if (property_attributes & DW_APPLE_PROPERTY_assign)
+ property_decl->setPropertyAttributes (clang::ObjCPropertyDecl::OBJC_PR_assign);
+ if (property_attributes & DW_APPLE_PROPERTY_retain)
+ property_decl->setPropertyAttributes (clang::ObjCPropertyDecl::OBJC_PR_retain);
+ if (property_attributes & DW_APPLE_PROPERTY_copy)
+ property_decl->setPropertyAttributes (clang::ObjCPropertyDecl::OBJC_PR_copy);
+ if (property_attributes & DW_APPLE_PROPERTY_nonatomic)
+ property_decl->setPropertyAttributes (clang::ObjCPropertyDecl::OBJC_PR_nonatomic);
+
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+}
bool
ClangASTContext::ObjCTypeHasIVars (clang_type_t class_opaque_type, bool check_superclass)
Added: lldb/trunk/test/lang/objc/objc-property/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/objc-property/Makefile?rev=144440&view=auto
==============================================================================
--- lldb/trunk/test/lang/objc/objc-property/Makefile (added)
+++ lldb/trunk/test/lang/objc/objc-property/Makefile Fri Nov 11 19:36:43 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/objc-property/TestObjCProperty.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/objc-property/TestObjCProperty.py?rev=144440&view=auto
==============================================================================
--- lldb/trunk/test/lang/objc/objc-property/TestObjCProperty.py (added)
+++ lldb/trunk/test/lang/objc/objc-property/TestObjCProperty.py Fri Nov 11 19:36:43 2011
@@ -0,0 +1,129 @@
+"""
+Use lldb Python API to verify that expression evaluation for property references uses the correct getters and setters
+"""
+
+import os, time
+import re
+import unittest2
+import lldb, lldbutil
+from lldbtest import *
+
+class ObjCDynamicValueTestCase(TestBase):
+
+ mydir = os.path.join("lang", "objc", "objc-property")
+
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ @python_api_test
+ def test_get_dynamic_objc_vals_with_dsym(self):
+ """Test that expr uses the correct property getters and setters"""
+ self.buildDsym()
+ self.do_test_properties()
+
+ @python_api_test
+ def test_get_objc_dynamic_vals_with_dwarf(self):
+ """Test that expr uses the correct property getters and setters"""
+ self.buildDwarf()
+ self.do_test_properties()
+
+ def setUp(self):
+ # Call super's setUp().
+ TestBase.setUp(self)
+
+ # Find the line number to break for main.c.
+
+ self.source_name = 'main.m'
+
+ def run_to_main (self):
+ """Test that expr uses the correct property getters and setters"""
+ exe = os.path.join(os.getcwd(), "a.out")
+
+ # Create a target from the debugger.
+
+ target = self.dbg.CreateTarget (exe)
+ self.assertTrue(target, VALID_TARGET)
+
+ # Set up our breakpoints:
+
+ main_bkpt = target.BreakpointCreateBySourceRegex ("Set a breakpoint here.", lldb.SBFileSpec (self.source_name))
+ self.assertTrue(main_bkpt and
+ main_bkpt.GetNumLocations() == 1,
+ VALID_BREAKPOINT)
+
+ # Now launch the process, and do not stop at the entry point.
+ process = target.LaunchSimple (None, None, os.getcwd())
+
+ self.assertTrue(process.GetState() == lldb.eStateStopped,
+ PROCESS_STOPPED)
+
+ threads = lldbutil.get_threads_stopped_at_breakpoint (process, main_bkpt)
+ self.assertTrue (len(threads) == 1)
+ thread = threads[0]
+ return thread
+
+ def do_test_properties (self):
+
+ thread = self.run_to_main()
+
+ frame = thread.GetFrameAtIndex(0)
+
+ mine = frame.FindVariable ("mine")
+ self.assertTrue (mine.IsValid())
+ access_count = mine.GetChildMemberWithName ("_access_count")
+ self.assertTrue (access_count.IsValid())
+ start_access_count = access_count.GetValueAsUnsigned (123456)
+ self.assertTrue (start_access_count != 123456)
+
+ #
+ # The first set of tests test calling the getter & setter of
+ # a property that actually only has a getter & setter and no
+ # @property.
+ #
+ nonexistant_value = frame.EvaluateExpression("mine.nonexistantInt", False)
+ nonexistant_error = nonexistant_value.GetError()
+ self.assertTrue (nonexistant_error.Success())
+ nonexistant_int = nonexistant_value.GetValueAsUnsigned (123456)
+ self.assertTrue (nonexistant_int == 6)
+
+ # Calling the getter function would up the access count, so make sure that happened.
+
+ new_access_count = access_count.GetValueAsUnsigned (123456)
+ self.assertTrue (new_access_count - start_access_count == 1)
+ start_access_count = new_access_count
+
+ #
+ # Now call the setter, then make sure that
+ nonexistant_change = frame.EvaluateExpression("mine.nonexistantInt = 10", False)
+ nonexistant_error = nonexistant_change.GetError()
+ self.assertTrue (nonexistant_error.Success())
+
+ # Calling the setter function would up the access count, so make sure that happened.
+
+ new_access_count = access_count.GetValueAsUnsigned (123456)
+ self.assertTrue (new_access_count - start_access_count == 1)
+ start_access_count = new_access_count
+
+ #
+ # Now we call the getter of a property that is backed by an ivar,
+ # make sure it works and that we actually update the backing ivar.
+ #
+
+ backed_value = frame.EvaluateExpression("mine.backedInt", False)
+ backed_error = backed_value.GetError()
+ self.assertTrue (backed_error.Success())
+ backing_value = mine.GetChildMemberWithName ("_backedInt")
+ self.assertTrue (backing_value.IsValid())
+ self.assertTrue (backed_value.GetValueAsUnsigned (12345) == backing_value.GetValueAsUnsigned(23456))
+
+ #
+ # This doesn't work correctly yet, because the clang Sema::HandleExprPropertyRefExpr
+ # doesn't complete the class before looking up the property.
+ #
+ #unbacked_value = frame.EvaluateExpression("mine.unbackedInt", False)
+ #unbacked_error = unbacked_value.GetError()
+ #self.assertTrue (unbacked_error.Success())
+
+if __name__ == '__main__':
+ import atexit
+ lldb.SBDebugger.Initialize()
+ atexit.register(lambda: lldb.SBDebugger.Terminate())
+ unittest2.main()
Added: lldb/trunk/test/lang/objc/objc-property/main.m
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/objc-property/main.m?rev=144440&view=auto
==============================================================================
--- lldb/trunk/test/lang/objc/objc-property/main.m (added)
+++ lldb/trunk/test/lang/objc/objc-property/main.m Fri Nov 11 19:36:43 2011
@@ -0,0 +1,91 @@
+#import
+
+ at interface BaseClass : NSObject
+{
+ int _backedInt;
+ int _access_count;
+}
+
+- (int) nonexistantInt;
+- (void) setNonexistantInt: (int) in_int;
+
+- (int) myGetUnbackedInt;
+- (void) mySetUnbackedInt: (int) in_int;
+
+- (int) getAccessCount;
+
++(BaseClass *) baseClassWithBackedInt: (int) inInt andUnbackedInt: (int) inOtherInt;
+
+ at property(getter=myGetUnbackedInt,setter=mySetUnbackedInt:) int unbackedInt;
+ at property int backedInt;
+ at end
+
+ at implementation BaseClass
+ at synthesize unbackedInt;
+ at synthesize backedInt = _backedInt;
+
++ (BaseClass *) baseClassWithBackedInt: (int) inInt andUnbackedInt: (int) inOtherInt
+{
+ BaseClass *new = [[BaseClass alloc] init];
+
+ new->_backedInt = inInt;
+ new->unbackedInt = inOtherInt;
+
+ return new;
+}
+
+- (int) myGetUnbackedInt
+{
+ // NSLog (@"Getting BaseClass::unbackedInt - %d.\n", unbackedInt);
+ _access_count++;
+ return unbackedInt;
+}
+
+- (void) mySetUnbackedInt: (int) in_int
+{
+ // NSLog (@"Setting BaseClass::unbackedInt from %d to %d.", unbackedInt, in_int);
+ _access_count++;
+ unbackedInt = in_int;
+}
+
+- (int) nonexistantInt
+{
+ // NSLog (@"Getting BaseClass::nonexistantInt - %d.\n", 5);
+ _access_count++;
+ return 6;
+}
+
+- (void) setNonexistantInt: (int) in_int
+{
+ // NSLog (@"Setting BaseClass::nonexistantInt from 7 to %d.", in_int);
+ _access_count++;
+}
+
+- (int) getAccessCount
+{
+ return _access_count;
+}
+ at end
+
+int
+main ()
+{
+ BaseClass *mine = [BaseClass baseClassWithBackedInt: 10 andUnbackedInt: 20];
+
+ // Set a breakpoint here.
+ int nonexistant = mine.nonexistantInt;
+
+ int backedInt = mine.backedInt;
+
+ int unbackedInt = mine.unbackedInt;
+
+ NSLog (@"Results for %p: nonexistant: %d backed: %d unbacked: %d accessCount: %d.",
+ mine,
+ nonexistant,
+ backedInt,
+ unbackedInt,
+ [mine getAccessCount]);
+ return 0;
+
+}
+
From johnny.chen at apple.com Fri Nov 11 20:30:23 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Sat, 12 Nov 2011 02:30:23 -0000
Subject: [Lldb-commits] [lldb] r144450 -
/lldb/trunk/test/lang/cpp/class_types/TestClassTypes.py
Message-ID: <20111112023023.A953E1BE001@llvm.org>
Author: johnny
Date: Fri Nov 11 20:30:23 2011
New Revision: 144450
URL: http://llvm.org/viewvc/llvm-project?rev=144450&view=rev
Log:
Make the test case more robust by using line number to break, instead.
Modified:
lldb/trunk/test/lang/cpp/class_types/TestClassTypes.py
Modified: lldb/trunk/test/lang/cpp/class_types/TestClassTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/class_types/TestClassTypes.py?rev=144450&r1=144449&r2=144450&view=diff
==============================================================================
--- lldb/trunk/test/lang/cpp/class_types/TestClassTypes.py (original)
+++ lldb/trunk/test/lang/cpp/class_types/TestClassTypes.py Fri Nov 11 20:30:23 2011
@@ -159,8 +159,12 @@
# Is this a case of clang (116.1) generating bad debug info?
#
# Break on the ctor function of class C.
- self.expect("breakpoint set -M C", BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: name = 'C'")
+ #self.expect("breakpoint set -M C", BREAKPOINT_CREATED,
+ # startstr = "Breakpoint created: 1: name = 'C'")
+
+ # Make the test case more robust by using line number to break, instead.
+ self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
+ startstr = "Breakpoint created")
self.runCmd("run", RUN_SUCCEEDED)
@@ -174,6 +178,7 @@
substrs = [' resolved, hit count = 1'])
# Continue on inside the ctor() body...
+ self.runCmd("register read pc")
self.runCmd("thread step-over")
# Verify that 'frame variable this' gets the data type correct.
@@ -181,6 +186,8 @@
substrs = ['C *'])
# Verify that frame variable -T this->m_c_int behaves correctly.
+ self.runCmd("register read pc")
+ self.runCmd("expr m_c_int")
self.expect("frame variable -T this->m_c_int", VARIABLES_DISPLAYED_CORRECTLY,
startstr = '(int) this->m_c_int = 66')
From gclayton at apple.com Sat Nov 12 22:45:22 2011
From: gclayton at apple.com (Greg Clayton)
Date: Sun, 13 Nov 2011 04:45:22 -0000
Subject: [Lldb-commits] [lldb] r144491 - in /lldb/trunk:
include/lldb/Target/Process.h
source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
source/Target/Process.cpp
Message-ID: <20111113044522.EB2D62A6C131@llvm.org>
Author: gclayton
Date: Sat Nov 12 22:45:22 2011
New Revision: 144491
URL: http://llvm.org/viewvc/llvm-project?rev=144491&view=rev
Log:
A long time ago we started to centralized the STDOUT in lldb_private::Process
but we missed a few things still in ProcessGDBRemote.
Modified:
lldb/trunk/include/lldb/Target/Process.h
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
lldb/trunk/source/Target/Process.cpp
Modified: lldb/trunk/include/lldb/Target/Process.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=144491&r1=144490&r2=144491&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Sat Nov 12 22:45:22 2011
@@ -2378,12 +2378,7 @@
/// be made to retrieve more STDOUT data.
//------------------------------------------------------------------
virtual size_t
- GetSTDOUT (char *buf, size_t buf_size, Error &error)
- {
- error.SetErrorString("stdout unsupported");
- return 0;
- }
-
+ GetSTDOUT (char *buf, size_t buf_size, Error &error);
//------------------------------------------------------------------
/// Get any available STDERR.
@@ -2407,11 +2402,7 @@
/// be made to retrieve more STDERR data.
//------------------------------------------------------------------
virtual size_t
- GetSTDERR (char *buf, size_t buf_size, Error &error)
- {
- error.SetErrorString("stderr unsupported");
- return 0;
- }
+ GetSTDERR (char *buf, size_t buf_size, Error &error);
virtual size_t
PutSTDIN (const char *buf, size_t buf_size, Error &error)
@@ -2800,6 +2791,7 @@
lldb_private::Communication m_stdio_communication;
lldb_private::Mutex m_stdio_communication_mutex;
std::string m_stdout_data;
+ std::string m_stderr_data;
MemoryCache m_memory_cache;
AllocatedMemoryCache m_allocated_memory_cache;
bool m_attached_to_process; /// Did we launch the process or attach to it?
@@ -2870,6 +2862,9 @@
void
AppendSTDOUT (const char *s, size_t len);
+ void
+ AppendSTDERR (const char *s, size_t len);
+
static void
STDIOReadThreadBytesReceived (void *baton, const void *src, size_t src_len);
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=144491&r1=144490&r2=144491&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Sat Nov 12 22:45:22 2011
@@ -120,7 +120,6 @@
ProcessGDBRemote::ProcessGDBRemote(Target& target, Listener &listener) :
Process (target, listener),
m_flags (0),
- m_stdio_mutex (Mutex::eMutexTypeRecursive),
m_gdb_comm(false),
m_debugserver_pid (LLDB_INVALID_PROCESS_ID),
m_debugserver_thread (LLDB_INVALID_HOST_THREAD),
@@ -1753,41 +1752,6 @@
//------------------------------------------------------------------
// Process STDIO
//------------------------------------------------------------------
-
-size_t
-ProcessGDBRemote::GetSTDOUT (char *buf, size_t buf_size, Error &error)
-{
- Mutex::Locker locker(m_stdio_mutex);
- size_t bytes_available = m_stdout_data.size();
- if (bytes_available > 0)
- {
- LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS));
- if (log)
- log->Printf ("ProcessGDBRemote::%s (&%p[%lu]) ...", __FUNCTION__, buf, buf_size);
- if (bytes_available > buf_size)
- {
- memcpy(buf, m_stdout_data.c_str(), buf_size);
- m_stdout_data.erase(0, buf_size);
- bytes_available = buf_size;
- }
- else
- {
- memcpy(buf, m_stdout_data.c_str(), bytes_available);
- m_stdout_data.clear();
-
- //ResetEventBits(eBroadcastBitSTDOUT);
- }
- }
- return bytes_available;
-}
-
-size_t
-ProcessGDBRemote::GetSTDERR (char *buf, size_t buf_size, Error &error)
-{
- // Can we get STDERR through the remote protocol?
- return 0;
-}
-
size_t
ProcessGDBRemote::PutSTDIN (const char *src, size_t src_len, Error &error)
{
@@ -2018,10 +1982,6 @@
{
m_flags = 0;
m_thread_list.Clear();
- {
- Mutex::Locker locker(m_stdio_mutex);
- m_stdout_data.clear();
- }
}
Error
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h?rev=144491&r1=144490&r2=144491&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h Sat Nov 12 22:45:22 2011
@@ -173,12 +173,6 @@
// Process STDIO
//------------------------------------------------------------------
virtual size_t
- GetSTDOUT (char *buf, size_t buf_size, lldb_private::Error &error);
-
- virtual size_t
- GetSTDERR (char *buf, size_t buf_size, lldb_private::Error &error);
-
- virtual size_t
PutSTDIN (const char *buf, size_t buf_size, lldb_private::Error &error);
//----------------------------------------------------------------------
@@ -239,12 +233,6 @@
bool
ProcessIDIsValid ( ) const;
-// static void
-// STDIOReadThreadBytesReceived (void *baton, const void *src, size_t src_len);
-
-// void
-// AppendSTDOUT (const char* s, size_t len);
-
void
Clear ( );
@@ -289,7 +277,6 @@
};
lldb_private::Flags m_flags; // Process specific flags (see eFlags enums)
- lldb_private::Mutex m_stdio_mutex; // Multithreaded protection for stdio
GDBRemoteCommunicationClient m_gdb_comm;
lldb::pid_t m_debugserver_pid;
lldb::thread_t m_debugserver_thread;
Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=144491&r1=144490&r2=144491&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Sat Nov 12 22:45:22 2011
@@ -683,6 +683,7 @@
m_stdio_communication ("process.stdio"),
m_stdio_communication_mutex (Mutex::eMutexTypeRecursive),
m_stdout_data (),
+ m_stderr_data (),
m_memory_cache (*this),
m_allocated_memory_cache (*this),
m_attached_to_process (false),
@@ -3217,11 +3218,73 @@
{
Mutex::Locker locker (m_stdio_communication_mutex);
m_stdout_data.append (s, len);
-
BroadcastEventIfUnique (eBroadcastBitSTDOUT, new ProcessEventData (GetTarget().GetProcessSP(), GetState()));
}
void
+Process::AppendSTDERR (const char * s, size_t len)
+{
+ Mutex::Locker locker (m_stdio_communication_mutex);
+ m_stderr_data.append (s, len);
+ BroadcastEventIfUnique (eBroadcastBitSTDERR, new ProcessEventData (GetTarget().GetProcessSP(), GetState()));
+}
+
+//------------------------------------------------------------------
+// Process STDIO
+//------------------------------------------------------------------
+
+size_t
+Process::GetSTDOUT (char *buf, size_t buf_size, Error &error)
+{
+ Mutex::Locker locker(m_stdio_communication_mutex);
+ size_t bytes_available = m_stdout_data.size();
+ if (bytes_available > 0)
+ {
+ LogSP log (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
+ if (log)
+ log->Printf ("Process::GetSTDOUT (buf = %p, size = %zu)", buf, buf_size);
+ if (bytes_available > buf_size)
+ {
+ memcpy(buf, m_stdout_data.c_str(), buf_size);
+ m_stdout_data.erase(0, buf_size);
+ bytes_available = buf_size;
+ }
+ else
+ {
+ memcpy(buf, m_stdout_data.c_str(), bytes_available);
+ m_stdout_data.clear();
+ }
+ }
+ return bytes_available;
+}
+
+
+size_t
+Process::GetSTDERR (char *buf, size_t buf_size, Error &error)
+{
+ Mutex::Locker locker(m_stdio_communication_mutex);
+ size_t bytes_available = m_stderr_data.size();
+ if (bytes_available > 0)
+ {
+ LogSP log (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
+ if (log)
+ log->Printf ("Process::GetSTDERR (buf = %p, size = %zu)", buf, buf_size);
+ if (bytes_available > buf_size)
+ {
+ memcpy(buf, m_stderr_data.c_str(), buf_size);
+ m_stderr_data.erase(0, buf_size);
+ bytes_available = buf_size;
+ }
+ else
+ {
+ memcpy(buf, m_stderr_data.c_str(), bytes_available);
+ m_stderr_data.clear();
+ }
+ }
+ return bytes_available;
+}
+
+void
Process::STDIOReadThreadBytesReceived (void *baton, const void *src, size_t src_len)
{
Process *process = (Process *) baton;
From gclayton at apple.com Sat Nov 12 22:15:56 2011
From: gclayton at apple.com (Greg Clayton)
Date: Sun, 13 Nov 2011 04:15:56 -0000
Subject: [Lldb-commits] [lldb] r144489 - in /lldb/trunk: include/lldb/
include/lldb/Core/ include/lldb/Expression/ source/Commands/
source/Expression/ source/Plugins/ObjectFile/Mach-O/
source/Plugins/SymbolFile/DWARF/ source/Symbol/ test/
test/lang/c/global_variables/
Message-ID: <20111113041557.35C252A6C131@llvm.org>
Author: gclayton
Date: Sat Nov 12 22:15:56 2011
New Revision: 144489
URL: http://llvm.org/viewvc/llvm-project?rev=144489&view=rev
Log:
This is the actual fix for the above radar where global variables that weren't
initialized were not being shown correctly when leaving the DWARF in the .o
files. Global variables that aren't intialized have symbols in the .o files
that specify they are undefined and external to the .o file, yet document the
size of the variable. This allows the compiler to emit a single copy, but makes
it harder for our DWARF in .o files with the executable having a debug map
because the symbol for the global in the .o file doesn't exist in a section
that we can assign a fixed up linked address to, and also the DWARF contains
an invalid address in the "DW_OP_addr" location (always zero). This means that
the DWARF is incorrect and actually maps all such global varaibles to the
first file address in the .o file which is usually the first function. So we
can fix this in either of two ways: make a new fake section in the .o file
so that we have a file address in the .o file that we can relink, or fix the
the variable as it is created in the .o file DWARF parser and actually give it
the file address from the executable. Each variable contains a
SymbolContextScope, or a single pointer that helps us to recreate where the
variables came from (which module, file, function, etc). This context helps
us to resolve any file addresses that might be in the location description of
the variable by pointing us to which file the file address comes from, so we
can just replace the SymbolContextScope and also fix up the location, which we
would have had to do for the other case as well, and update the file address.
Now globals display correctly.
The above changes made it possible to determine if a variable is a global
or static variable when parsing DWARF. The DWARF emits a DW_TAG_variable tag
for each variable (local, global, or static), yet DWARF provides no way for
us to classify these variables into these categories. We can now detect when
a variable has a simple address expressions as its location and this will help
us classify these correctly.
While making the above changes I also noticed that we had two symbol types:
eSymbolTypeExtern and eSymbolTypeUndefined which mean essentially the same
thing: the symbol is not defined in the current object file. Symbol objects
also have a bit that specifies if a symbol is externally visible, so I got
rid of the eSymbolTypeExtern symbol type and moved all code locations that
used it to use the eSymbolTypeUndefined type.
Modified:
lldb/trunk/include/lldb/Core/dwarf.h
lldb/trunk/include/lldb/Expression/DWARFExpression.h
lldb/trunk/include/lldb/lldb-enumerations.h
lldb/trunk/source/Commands/CommandObjectTarget.cpp
lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
lldb/trunk/source/Expression/DWARFExpression.cpp
lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
lldb/trunk/source/Symbol/ObjectFile.cpp
lldb/trunk/source/Symbol/Symbol.cpp
lldb/trunk/test/lang/c/global_variables/TestGlobalVariables.py
lldb/trunk/test/lang/c/global_variables/main.c
lldb/trunk/test/lldbutil.py
Modified: lldb/trunk/include/lldb/Core/dwarf.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/dwarf.h?rev=144489&r1=144488&r2=144489&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/dwarf.h (original)
+++ lldb/trunk/include/lldb/Core/dwarf.h Sat Nov 12 22:15:56 2011
@@ -42,24 +42,24 @@
#define DW_EH_PE_MASK_ENCODING 0x0F
-// The following are used only internally within lldb - don't
-// document them in the llvm Dwarf.h header file, we won't see
-// them in executable files anywhere.
-// These constants fit between DW_OP_lo_user (0xe0) and DW_OP_hi_user (0xff).
-
-#define DW_OP_APPLE_array_ref 0xEE // first pops index, then pops array; pushes array[index]
-#define DW_OP_APPLE_extern 0xEF // ULEB128 index of external object (i.e., an entity from the program that was used in the expression)
-#define DW_OP_APPLE_uninit 0xF0
-#define DW_OP_APPLE_assign 0xF1 // pops value off and assigns it to second item on stack (2nd item must have assignable context)
-#define DW_OP_APPLE_address_of 0xF2 // gets the address of the top stack item (top item must be a variable, or have value_type that is an address already)
-#define DW_OP_APPLE_value_of 0xF3 // pops the value off the stack and pushes the value of that object (top item must be a variable, or expression local)
-#define DW_OP_APPLE_deref_type 0xF4 // gets the address of the top stack item (top item must be a variable, or a clang type)
-#define DW_OP_APPLE_expr_local 0xF5 // ULEB128 expression local index
-#define DW_OP_APPLE_constf 0xF6 // 1 byte float size, followed by constant float data
-#define DW_OP_APPLE_scalar_cast 0xF7 // Cast top of stack to 2nd in stack's type leaving all items in place
-#define DW_OP_APPLE_clang_cast 0xF8 // pointer size clang::Type * off the stack and cast top stack item to this type
-#define DW_OP_APPLE_clear 0xFE // clears the entire expression stack, ok if the stack is empty
-#define DW_OP_APPLE_error 0xFF // Stops expression evaluation and returns an error (no args)
+//// The following are used only internally within lldb - don't
+//// document them in the llvm Dwarf.h header file, we won't see
+//// them in executable files anywhere.
+//// These constants fit between DW_OP_lo_user (0xe0) and DW_OP_hi_user (0xff).
+//
+//#define DW_OP_APPLE_array_ref 0xEE // first pops index, then pops array; pushes array[index]
+//#define DW_OP_APPLE_extern 0xEF // ULEB128 index of external object (i.e., an entity from the program that was used in the expression)
+#define DW_OP_APPLE_uninit 0xF0 // This is actually generated by some apple compilers in locations lists
+//#define DW_OP_APPLE_assign 0xF1 // pops value off and assigns it to second item on stack (2nd item must have assignable context)
+//#define DW_OP_APPLE_address_of 0xF2 // gets the address of the top stack item (top item must be a variable, or have value_type that is an address already)
+//#define DW_OP_APPLE_value_of 0xF3 // pops the value off the stack and pushes the value of that object (top item must be a variable, or expression local)
+//#define DW_OP_APPLE_deref_type 0xF4 // gets the address of the top stack item (top item must be a variable, or a clang type)
+//#define DW_OP_APPLE_expr_local 0xF5 // ULEB128 expression local index
+//#define DW_OP_APPLE_constf 0xF6 // 1 byte float size, followed by constant float data
+//#define DW_OP_APPLE_scalar_cast 0xF7 // Cast top of stack to 2nd in stack's type leaving all items in place
+//#define DW_OP_APPLE_clang_cast 0xF8 // pointer size clang::Type * off the stack and cast top stack item to this type
+//#define DW_OP_APPLE_clear 0xFE // clears the entire expression stack, ok if the stack is empty
+//#define DW_OP_APPLE_error 0xFF // Stops expression evaluation and returns an error (no args)
#endif // DebugBase_dwarf_h_
Modified: lldb/trunk/include/lldb/Expression/DWARFExpression.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/DWARFExpression.h?rev=144489&r1=144488&r2=144489&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/DWARFExpression.h (original)
+++ lldb/trunk/include/lldb/Expression/DWARFExpression.h Sat Nov 12 22:15:56 2011
@@ -131,6 +131,30 @@
LocationListContainsAddress (lldb::addr_t loclist_base_addr, lldb::addr_t addr) const;
//------------------------------------------------------------------
+ /// If a location is not a location list, return true if the location
+ /// contains a DW_OP_addr () opcode in the stream that matches \a
+ /// file_addr. If file_addr is LLDB_INVALID_ADDRESS, the this
+ /// function will return true if the variable there is any DW_OP_addr
+ /// in a location that (yet still is NOT a location list). This helps
+ /// us detect if a variable is a global or static variable since
+ /// there is no other indication from DWARF debug info.
+ ///
+ /// @param[in] file_addr
+ /// The file address to search for in the location.
+ ///
+ /// @return
+ /// True if IsLocationList() is false and the \a file_addr was
+ /// is contained in a DW_OP_addr location opcode or if \a file_addr
+ /// was invalid and there are any DW_OP_addr opcodes, false
+ /// otherwise.
+ //------------------------------------------------------------------
+ bool
+ LocationContains_DW_OP_addr (lldb::addr_t file_addr = LLDB_INVALID_ADDRESS) const;
+
+ bool
+ Update_DW_OP_addr (lldb::addr_t file_addr);
+
+ //------------------------------------------------------------------
/// Make the expression parser read its location information from a
/// given data source. Does not change the offset and length
///
Modified: lldb/trunk/include/lldb/lldb-enumerations.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-enumerations.h?rev=144489&r1=144488&r2=144489&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-enumerations.h (original)
+++ lldb/trunk/include/lldb/lldb-enumerations.h Sat Nov 12 22:15:56 2011
@@ -428,7 +428,6 @@
eSymbolTypeAny = 0,
eSymbolTypeInvalid = 0,
eSymbolTypeAbsolute,
- eSymbolTypeExtern,
eSymbolTypeCode,
eSymbolTypeData,
eSymbolTypeTrampoline,
Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=144489&r1=144488&r2=144489&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Sat Nov 12 22:15:56 2011
@@ -702,7 +702,7 @@
size_t count = comp_unit_varlist_sp->GetSize();
if (count > 0)
{
- s.Printf ("Global in %s/%s:\n",
+ s.Printf ("Global variables for %s/%s:\n",
comp_unit->GetDirectory().GetCString(),
comp_unit->GetFilename().GetCString());
Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=144489&r1=144488&r2=144489&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Sat Nov 12 22:15:56 2011
@@ -746,7 +746,6 @@
case eSymbolTypeParam:
case eSymbolTypeInvalid:
case eSymbolTypeAbsolute:
- case eSymbolTypeExtern:
case eSymbolTypeException:
case eSymbolTypeSourceFile:
case eSymbolTypeHeaderFile:
Modified: lldb/trunk/source/Expression/DWARFExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/DWARFExpression.cpp?rev=144489&r1=144488&r2=144489&view=diff
==============================================================================
--- lldb/trunk/source/Expression/DWARFExpression.cpp (original)
+++ lldb/trunk/source/Expression/DWARFExpression.cpp Sat Nov 12 22:15:56 2011
@@ -11,6 +11,7 @@
#include
+#include "lldb/Core/DataEncoder.h"
#include "lldb/Core/dwarf.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/RegisterValue.h"
@@ -193,19 +194,19 @@
case 0x98: return "DW_OP_call2";
case 0x99: return "DW_OP_call4";
case 0x9a: return "DW_OP_call_ref";
- case DW_OP_APPLE_array_ref: return "DW_OP_APPLE_array_ref";
- case DW_OP_APPLE_extern: return "DW_OP_APPLE_extern";
+// case DW_OP_APPLE_array_ref: return "DW_OP_APPLE_array_ref";
+// case DW_OP_APPLE_extern: return "DW_OP_APPLE_extern";
case DW_OP_APPLE_uninit: return "DW_OP_APPLE_uninit";
- case DW_OP_APPLE_assign: return "DW_OP_APPLE_assign";
- case DW_OP_APPLE_address_of: return "DW_OP_APPLE_address_of";
- case DW_OP_APPLE_value_of: return "DW_OP_APPLE_value_of";
- case DW_OP_APPLE_deref_type: return "DW_OP_APPLE_deref_type";
- case DW_OP_APPLE_expr_local: return "DW_OP_APPLE_expr_local";
- case DW_OP_APPLE_constf: return "DW_OP_APPLE_constf";
- case DW_OP_APPLE_scalar_cast: return "DW_OP_APPLE_scalar_cast";
- case DW_OP_APPLE_clang_cast: return "DW_OP_APPLE_clang_cast";
- case DW_OP_APPLE_clear: return "DW_OP_APPLE_clear";
- case DW_OP_APPLE_error: return "DW_OP_APPLE_error";
+// case DW_OP_APPLE_assign: return "DW_OP_APPLE_assign";
+// case DW_OP_APPLE_address_of: return "DW_OP_APPLE_address_of";
+// case DW_OP_APPLE_value_of: return "DW_OP_APPLE_value_of";
+// case DW_OP_APPLE_deref_type: return "DW_OP_APPLE_deref_type";
+// case DW_OP_APPLE_expr_local: return "DW_OP_APPLE_expr_local";
+// case DW_OP_APPLE_constf: return "DW_OP_APPLE_constf";
+// case DW_OP_APPLE_scalar_cast: return "DW_OP_APPLE_scalar_cast";
+// case DW_OP_APPLE_clang_cast: return "DW_OP_APPLE_clang_cast";
+// case DW_OP_APPLE_clear: return "DW_OP_APPLE_clear";
+// case DW_OP_APPLE_error: return "DW_OP_APPLE_error";
default:
snprintf (invalid, sizeof(invalid), "Unknown DW_OP constant: 0x%x", val);
return invalid;
@@ -567,55 +568,55 @@
// break;
// case DW_OP_lo_user: s->PutCString("DW_OP_lo_user"); break; // 0xe0
// case DW_OP_hi_user: s->PutCString("DW_OP_hi_user"); break; // 0xff
- case DW_OP_APPLE_extern:
- s->Printf("DW_OP_APPLE_extern(%llu)", m_data.GetULEB128(&offset));
- break;
- case DW_OP_APPLE_array_ref:
- s->PutCString("DW_OP_APPLE_array_ref");
- break;
+// case DW_OP_APPLE_extern:
+// s->Printf("DW_OP_APPLE_extern(%llu)", m_data.GetULEB128(&offset));
+// break;
+// case DW_OP_APPLE_array_ref:
+// s->PutCString("DW_OP_APPLE_array_ref");
+// break;
case DW_OP_APPLE_uninit:
s->PutCString("DW_OP_APPLE_uninit"); // 0xF0
break;
- case DW_OP_APPLE_assign: // 0xF1 - pops value off and assigns it to second item on stack (2nd item must have assignable context)
- s->PutCString("DW_OP_APPLE_assign");
- break;
- case DW_OP_APPLE_address_of: // 0xF2 - gets the address of the top stack item (top item must be a variable, or have value_type that is an address already)
- s->PutCString("DW_OP_APPLE_address_of");
- break;
- case DW_OP_APPLE_value_of: // 0xF3 - pops the value off the stack and pushes the value of that object (top item must be a variable, or expression local)
- s->PutCString("DW_OP_APPLE_value_of");
- break;
- case DW_OP_APPLE_deref_type: // 0xF4 - gets the address of the top stack item (top item must be a variable, or a clang type)
- s->PutCString("DW_OP_APPLE_deref_type");
- break;
- case DW_OP_APPLE_expr_local: // 0xF5 - ULEB128 expression local index
- s->Printf("DW_OP_APPLE_expr_local(%llu)", m_data.GetULEB128(&offset));
- break;
- case DW_OP_APPLE_constf: // 0xF6 - 1 byte float size, followed by constant float data
- {
- uint8_t float_length = m_data.GetU8(&offset);
- s->Printf("DW_OP_APPLE_constf(<%u> ", float_length);
- m_data.Dump(s, offset, eFormatHex, float_length, 1, UINT32_MAX, DW_INVALID_ADDRESS, 0, 0);
- s->PutChar(')');
- // Consume the float data
- m_data.GetData(&offset, float_length);
- }
- break;
- case DW_OP_APPLE_scalar_cast:
- s->Printf("DW_OP_APPLE_scalar_cast(%s)", Scalar::GetValueTypeAsCString ((Scalar::Type)m_data.GetU8(&offset)));
- break;
- case DW_OP_APPLE_clang_cast:
- {
- clang::Type *clang_type = (clang::Type *)m_data.GetMaxU64(&offset, sizeof(void*));
- s->Printf("DW_OP_APPLE_clang_cast(%p)", clang_type);
- }
- break;
- case DW_OP_APPLE_clear:
- s->PutCString("DW_OP_APPLE_clear");
- break;
- case DW_OP_APPLE_error: // 0xFF - Stops expression evaluation and returns an error (no args)
- s->PutCString("DW_OP_APPLE_error");
- break;
+// case DW_OP_APPLE_assign: // 0xF1 - pops value off and assigns it to second item on stack (2nd item must have assignable context)
+// s->PutCString("DW_OP_APPLE_assign");
+// break;
+// case DW_OP_APPLE_address_of: // 0xF2 - gets the address of the top stack item (top item must be a variable, or have value_type that is an address already)
+// s->PutCString("DW_OP_APPLE_address_of");
+// break;
+// case DW_OP_APPLE_value_of: // 0xF3 - pops the value off the stack and pushes the value of that object (top item must be a variable, or expression local)
+// s->PutCString("DW_OP_APPLE_value_of");
+// break;
+// case DW_OP_APPLE_deref_type: // 0xF4 - gets the address of the top stack item (top item must be a variable, or a clang type)
+// s->PutCString("DW_OP_APPLE_deref_type");
+// break;
+// case DW_OP_APPLE_expr_local: // 0xF5 - ULEB128 expression local index
+// s->Printf("DW_OP_APPLE_expr_local(%llu)", m_data.GetULEB128(&offset));
+// break;
+// case DW_OP_APPLE_constf: // 0xF6 - 1 byte float size, followed by constant float data
+// {
+// uint8_t float_length = m_data.GetU8(&offset);
+// s->Printf("DW_OP_APPLE_constf(<%u> ", float_length);
+// m_data.Dump(s, offset, eFormatHex, float_length, 1, UINT32_MAX, DW_INVALID_ADDRESS, 0, 0);
+// s->PutChar(')');
+// // Consume the float data
+// m_data.GetData(&offset, float_length);
+// }
+// break;
+// case DW_OP_APPLE_scalar_cast:
+// s->Printf("DW_OP_APPLE_scalar_cast(%s)", Scalar::GetValueTypeAsCString ((Scalar::Type)m_data.GetU8(&offset)));
+// break;
+// case DW_OP_APPLE_clang_cast:
+// {
+// clang::Type *clang_type = (clang::Type *)m_data.GetMaxU64(&offset, sizeof(void*));
+// s->Printf("DW_OP_APPLE_clang_cast(%p)", clang_type);
+// }
+// break;
+// case DW_OP_APPLE_clear:
+// s->PutCString("DW_OP_APPLE_clear");
+// break;
+// case DW_OP_APPLE_error: // 0xFF - Stops expression evaluation and returns an error (no args)
+// s->PutCString("DW_OP_APPLE_error");
+// break;
}
}
}
@@ -797,6 +798,275 @@
// return false;
//}
+static uint32_t
+GetOpcodeDataSize (const DataExtractor &data, const uint32_t data_offset, const uint8_t op)
+{
+ uint32_t offset = data_offset;
+ switch (op)
+ {
+ case DW_OP_addr:
+ case DW_OP_call_ref: // 0x9a 1 address sized offset of DIE (DWARF3)
+ return data.GetAddressByteSize();
+
+ // Opcodes with no arguments
+ case DW_OP_deref: // 0x06
+ case DW_OP_dup: // 0x12
+ case DW_OP_drop: // 0x13
+ case DW_OP_over: // 0x14
+ case DW_OP_swap: // 0x16
+ case DW_OP_rot: // 0x17
+ case DW_OP_xderef: // 0x18
+ case DW_OP_abs: // 0x19
+ case DW_OP_and: // 0x1a
+ case DW_OP_div: // 0x1b
+ case DW_OP_minus: // 0x1c
+ case DW_OP_mod: // 0x1d
+ case DW_OP_mul: // 0x1e
+ case DW_OP_neg: // 0x1f
+ case DW_OP_not: // 0x20
+ case DW_OP_or: // 0x21
+ case DW_OP_plus: // 0x22
+ case DW_OP_shl: // 0x24
+ case DW_OP_shr: // 0x25
+ case DW_OP_shra: // 0x26
+ case DW_OP_xor: // 0x27
+ case DW_OP_eq: // 0x29
+ case DW_OP_ge: // 0x2a
+ case DW_OP_gt: // 0x2b
+ case DW_OP_le: // 0x2c
+ case DW_OP_lt: // 0x2d
+ case DW_OP_ne: // 0x2e
+ case DW_OP_lit0: // 0x30
+ case DW_OP_lit1: // 0x31
+ case DW_OP_lit2: // 0x32
+ case DW_OP_lit3: // 0x33
+ case DW_OP_lit4: // 0x34
+ case DW_OP_lit5: // 0x35
+ case DW_OP_lit6: // 0x36
+ case DW_OP_lit7: // 0x37
+ case DW_OP_lit8: // 0x38
+ case DW_OP_lit9: // 0x39
+ case DW_OP_lit10: // 0x3A
+ case DW_OP_lit11: // 0x3B
+ case DW_OP_lit12: // 0x3C
+ case DW_OP_lit13: // 0x3D
+ case DW_OP_lit14: // 0x3E
+ case DW_OP_lit15: // 0x3F
+ case DW_OP_lit16: // 0x40
+ case DW_OP_lit17: // 0x41
+ case DW_OP_lit18: // 0x42
+ case DW_OP_lit19: // 0x43
+ case DW_OP_lit20: // 0x44
+ case DW_OP_lit21: // 0x45
+ case DW_OP_lit22: // 0x46
+ case DW_OP_lit23: // 0x47
+ case DW_OP_lit24: // 0x48
+ case DW_OP_lit25: // 0x49
+ case DW_OP_lit26: // 0x4A
+ case DW_OP_lit27: // 0x4B
+ case DW_OP_lit28: // 0x4C
+ case DW_OP_lit29: // 0x4D
+ case DW_OP_lit30: // 0x4E
+ case DW_OP_lit31: // 0x4f
+ case DW_OP_reg0: // 0x50
+ case DW_OP_reg1: // 0x51
+ case DW_OP_reg2: // 0x52
+ case DW_OP_reg3: // 0x53
+ case DW_OP_reg4: // 0x54
+ case DW_OP_reg5: // 0x55
+ case DW_OP_reg6: // 0x56
+ case DW_OP_reg7: // 0x57
+ case DW_OP_reg8: // 0x58
+ case DW_OP_reg9: // 0x59
+ case DW_OP_reg10: // 0x5A
+ case DW_OP_reg11: // 0x5B
+ case DW_OP_reg12: // 0x5C
+ case DW_OP_reg13: // 0x5D
+ case DW_OP_reg14: // 0x5E
+ case DW_OP_reg15: // 0x5F
+ case DW_OP_reg16: // 0x60
+ case DW_OP_reg17: // 0x61
+ case DW_OP_reg18: // 0x62
+ case DW_OP_reg19: // 0x63
+ case DW_OP_reg20: // 0x64
+ case DW_OP_reg21: // 0x65
+ case DW_OP_reg22: // 0x66
+ case DW_OP_reg23: // 0x67
+ case DW_OP_reg24: // 0x68
+ case DW_OP_reg25: // 0x69
+ case DW_OP_reg26: // 0x6A
+ case DW_OP_reg27: // 0x6B
+ case DW_OP_reg28: // 0x6C
+ case DW_OP_reg29: // 0x6D
+ case DW_OP_reg30: // 0x6E
+ case DW_OP_reg31: // 0x6F
+ case DW_OP_nop: // 0x96
+ case DW_OP_push_object_address: // 0x97 DWARF3
+ case DW_OP_form_tls_address: // 0x9b DWARF3
+ case DW_OP_call_frame_cfa: // 0x9c DWARF3
+ return 0;
+
+ // Opcodes with a single 1 byte arguments
+ case DW_OP_const1u: // 0x08 1 1-byte constant
+ case DW_OP_const1s: // 0x09 1 1-byte constant
+ case DW_OP_pick: // 0x15 1 1-byte stack index
+ case DW_OP_deref_size: // 0x94 1 1-byte size of data retrieved
+ case DW_OP_xderef_size: // 0x95 1 1-byte size of data retrieved
+ return 1;
+
+ // Opcodes with a single 2 byte arguments
+ case DW_OP_const2u: // 0x0a 1 2-byte constant
+ case DW_OP_const2s: // 0x0b 1 2-byte constant
+ case DW_OP_skip: // 0x2f 1 signed 2-byte constant
+ case DW_OP_bra: // 0x28 1 signed 2-byte constant
+ case DW_OP_call2: // 0x98 1 2-byte offset of DIE (DWARF3)
+ return 2;
+
+ // Opcodes with a single 4 byte arguments
+ case DW_OP_const4u: // 0x0c 1 4-byte constant
+ case DW_OP_const4s: // 0x0d 1 4-byte constant
+ case DW_OP_call4: // 0x99 1 4-byte offset of DIE (DWARF3)
+ return 4;
+
+ // Opcodes with a single 8 byte arguments
+ case DW_OP_const8u: // 0x0e 1 8-byte constant
+ case DW_OP_const8s: // 0x0f 1 8-byte constant
+ return 8;
+
+ // All opcodes that have a single ULEB (signed or unsigned) argument
+ case DW_OP_constu: // 0x10 1 ULEB128 constant
+ case DW_OP_consts: // 0x11 1 SLEB128 constant
+ case DW_OP_plus_uconst: // 0x23 1 ULEB128 addend
+ case DW_OP_breg0: // 0x70 1 ULEB128 register
+ case DW_OP_breg1: // 0x71 1 ULEB128 register
+ case DW_OP_breg2: // 0x72 1 ULEB128 register
+ case DW_OP_breg3: // 0x73 1 ULEB128 register
+ case DW_OP_breg4: // 0x74 1 ULEB128 register
+ case DW_OP_breg5: // 0x75 1 ULEB128 register
+ case DW_OP_breg6: // 0x76 1 ULEB128 register
+ case DW_OP_breg7: // 0x77 1 ULEB128 register
+ case DW_OP_breg8: // 0x78 1 ULEB128 register
+ case DW_OP_breg9: // 0x79 1 ULEB128 register
+ case DW_OP_breg10: // 0x7a 1 ULEB128 register
+ case DW_OP_breg11: // 0x7b 1 ULEB128 register
+ case DW_OP_breg12: // 0x7c 1 ULEB128 register
+ case DW_OP_breg13: // 0x7d 1 ULEB128 register
+ case DW_OP_breg14: // 0x7e 1 ULEB128 register
+ case DW_OP_breg15: // 0x7f 1 ULEB128 register
+ case DW_OP_breg16: // 0x80 1 ULEB128 register
+ case DW_OP_breg17: // 0x81 1 ULEB128 register
+ case DW_OP_breg18: // 0x82 1 ULEB128 register
+ case DW_OP_breg19: // 0x83 1 ULEB128 register
+ case DW_OP_breg20: // 0x84 1 ULEB128 register
+ case DW_OP_breg21: // 0x85 1 ULEB128 register
+ case DW_OP_breg22: // 0x86 1 ULEB128 register
+ case DW_OP_breg23: // 0x87 1 ULEB128 register
+ case DW_OP_breg24: // 0x88 1 ULEB128 register
+ case DW_OP_breg25: // 0x89 1 ULEB128 register
+ case DW_OP_breg26: // 0x8a 1 ULEB128 register
+ case DW_OP_breg27: // 0x8b 1 ULEB128 register
+ case DW_OP_breg28: // 0x8c 1 ULEB128 register
+ case DW_OP_breg29: // 0x8d 1 ULEB128 register
+ case DW_OP_breg30: // 0x8e 1 ULEB128 register
+ case DW_OP_breg31: // 0x8f 1 ULEB128 register
+ case DW_OP_regx: // 0x90 1 ULEB128 register
+ case DW_OP_fbreg: // 0x91 1 SLEB128 offset
+ case DW_OP_piece: // 0x93 1 ULEB128 size of piece addressed
+ data.Skip_LEB128(&offset);
+ return offset - data_offset;
+
+ // All opcodes that have a 2 ULEB (signed or unsigned) arguments
+ case DW_OP_bregx: // 0x92 2 ULEB128 register followed by SLEB128 offset
+ case DW_OP_bit_piece: // 0x9d ULEB128 bit size, ULEB128 bit offset (DWARF3);
+ data.Skip_LEB128(&offset);
+ data.Skip_LEB128(&offset);
+ return offset - data_offset;
+ default:
+ assert (!"Unhandled DW_OP_XXX opcode, add support for it");
+ break;
+ }
+ return UINT32_MAX;
+}
+
+bool
+DWARFExpression::LocationContains_DW_OP_addr (lldb::addr_t file_addr) const
+{
+ if (IsLocationList())
+ return false;
+ uint32_t offset = 0;
+ while (m_data.ValidOffset(offset))
+ {
+ const uint8_t op = m_data.GetU8(&offset);
+
+ if (op == DW_OP_addr)
+ {
+ if (file_addr == LLDB_INVALID_ADDRESS)
+ return true;
+ addr_t op_file_addr = m_data.GetAddress(&offset);
+ if (op_file_addr == file_addr)
+ return true;
+ }
+ else
+ {
+ const uint32_t op_arg_size = GetOpcodeDataSize (m_data, offset, op);
+ if (op_arg_size == UINT32_MAX)
+ break;
+ offset += op_arg_size;
+ }
+ }
+ return false;
+}
+
+bool
+DWARFExpression::Update_DW_OP_addr (lldb::addr_t file_addr)
+{
+ if (IsLocationList())
+ return false;
+ uint32_t offset = 0;
+ while (m_data.ValidOffset(offset))
+ {
+ const uint8_t op = m_data.GetU8(&offset);
+
+ if (op == DW_OP_addr)
+ {
+ const uint8_t addr_byte_size = m_data.GetAddressByteSize();
+ // We have to make a copy of the data as we don't know if this
+ // data is from a read only memory mapped buffer, so we duplicate
+ // all of the data first, then modify it, and if all goes well,
+ // we then replace the data for this expression
+
+ // So first we copy the data into a heap buffer
+ std::auto_ptr head_data_ap (new DataBufferHeap (m_data.GetDataStart(),
+ m_data.GetByteSize()));
+
+ // Make en encoder so we can write the address into the buffer using
+ // the correct byte order (endianness)
+ DataEncoder encoder (head_data_ap->GetBytes(),
+ head_data_ap->GetByteSize(),
+ m_data.GetByteOrder(),
+ addr_byte_size);
+
+ // Replace the address in the new buffer
+ if (encoder.PutMaxU64 (offset, addr_byte_size, file_addr) == UINT32_MAX)
+ return false;
+
+ // All went well, so now we can reset the data using a shared
+ // pointer to the heap data so "m_data" will now correctly
+ // manage the heap data.
+ m_data.SetData (DataBufferSP (head_data_ap.release()));
+ return true;
+ }
+ else
+ {
+ const uint32_t op_arg_size = GetOpcodeDataSize (m_data, offset, op);
+ if (op_arg_size == UINT32_MAX)
+ break;
+ offset += op_arg_size;
+ }
+ }
+ return false;
+}
+
bool
DWARFExpression::LocationListContainsAddress (lldb::addr_t loclist_base_addr, lldb::addr_t addr) const
{
@@ -2309,7 +2579,7 @@
error_ptr->SetErrorString ("Unimplemented opcode DW_OP_call4.");
return false;
-
+#if 0
//----------------------------------------------------------------------
// OPCODE: DW_OP_call_ref
// OPERANDS:
@@ -2344,15 +2614,15 @@
error_ptr->SetErrorString ("Unimplemented opcode DW_OP_call_ref.");
return false;
- //----------------------------------------------------------------------
- // OPCODE: DW_OP_APPLE_array_ref
- // OPERANDS: none
- // DESCRIPTION: Pops a value off the stack and uses it as the array
- // index. Pops a second value off the stack and uses it as the array
- // itself. Pushes a value onto the stack representing the element of
- // the array specified by the index.
- //----------------------------------------------------------------------
- case DW_OP_APPLE_array_ref:
+ //----------------------------------------------------------------------
+ // OPCODE: DW_OP_APPLE_array_ref
+ // OPERANDS: none
+ // DESCRIPTION: Pops a value off the stack and uses it as the array
+ // index. Pops a second value off the stack and uses it as the array
+ // itself. Pushes a value onto the stack representing the element of
+ // the array specified by the index.
+ //----------------------------------------------------------------------
+ case DW_OP_APPLE_array_ref:
{
if (stack.size() < 2)
{
@@ -2375,7 +2645,7 @@
error_ptr->SetErrorString("Invalid array index.");
return false;
}
-
+
if (array_val.GetContextType() != Value::eContextTypeClangType)
{
if (error_ptr)
@@ -2433,7 +2703,7 @@
stack.push_back(member);
}
- break;
+ break;
//----------------------------------------------------------------------
// OPCODE: DW_OP_APPLE_uninit
@@ -2866,6 +3136,8 @@
if (error_ptr)
error_ptr->SetErrorString ("Generic error.");
return false;
+#endif // #if 0
+
}
}
Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=144489&r1=144488&r2=144489&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Sat Nov 12 22:15:56 2011
@@ -273,7 +273,6 @@
{
case eSymbolTypeAny: return eAddressClassUnknown;
case eSymbolTypeAbsolute: return eAddressClassUnknown;
- case eSymbolTypeExtern: return eAddressClassUnknown;
case eSymbolTypeCode:
case eSymbolTypeTrampoline:
@@ -1195,7 +1194,7 @@
case NListTypeIndirect: // N_INDR - Fall through
case NListTypePreboundUndefined:// N_PBUD - Fall through
case NListTypeUndefined: // N_UNDF
- type = eSymbolTypeExtern;
+ type = eSymbolTypeUndefined;
break;
case NListTypeAbsolute: // N_ABS
@@ -1458,7 +1457,7 @@
{
Address so_addr(symbol_stub_addr, section_list);
- if (stub_symbol->GetType() == eSymbolTypeExtern)
+ if (stub_symbol->GetType() == eSymbolTypeUndefined)
{
// Change the external symbol into a trampoline that makes sense
// These symbols were N_UNDF N_EXT, and are useless to us, so we
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=144489&r1=144488&r2=144489&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Sat Nov 12 22:15:56 2011
@@ -5247,31 +5247,114 @@
const DWARFDebugInfoEntry *sc_parent_die = GetParentSymbolContextDIE(die);
dw_tag_t parent_tag = sc_parent_die ? sc_parent_die->Tag() : 0;
+ SymbolContextScope * symbol_context_scope = NULL;
+ // DWARF doesn't specify if a DW_TAG_variable is a local, global
+ // or static variable, so we have to do a little digging by
+ // looking at the location of a varaible to see if it contains
+ // a DW_OP_addr opcode _somewhere_ in the definition. I say
+ // somewhere because clang likes to combine small global variables
+ // into the same symbol and have locations like:
+ // DW_OP_addr(0x1000), DW_OP_constu(2), DW_OP_plus
+ // So if we don't have a DW_TAG_formal_parameter, we can look at
+ // the location to see if it contains a DW_OP_addr opcode, and
+ // then we can correctly classify our variables.
if (tag == DW_TAG_formal_parameter)
scope = eValueTypeVariableArgument;
- else if (is_external || parent_tag == DW_TAG_compile_unit)
- scope = eValueTypeVariableGlobal;
+ else if (location.LocationContains_DW_OP_addr ())
+ {
+ if (is_external)
+ {
+ if (m_debug_map_symfile)
+ {
+ // When leaving the DWARF in the .o files on darwin,
+ // when we have a global variable that wasn't initialized,
+ // the .o file might not have allocated a virtual
+ // address for the global variable. In this case it will
+ // have created a symbol for the global variable
+ // that is undefined and external and the value will
+ // be the byte size of the variable. When we do the
+ // address map in SymbolFileDWARFDebugMap we rely on
+ // having an address, we need to do some magic here
+ // so we can get the correct address for our global
+ // variable. The address for all of these entries
+ // will be zero, and there will be an undefined symbol
+ // in this object file, and the executable will have
+ // a matching symbol with a good address. So here we
+ // dig up the correct address and replace it in the
+ // location for the variable, and set the variable's
+ // symbol context scope to be that of the main executable
+ // so the file address will resolve correctly.
+ if (location.LocationContains_DW_OP_addr (0))
+ {
+
+ // we have a possible uninitialized extern global
+ Symtab *symtab = m_obj_file->GetSymtab();
+ if (symtab)
+ {
+ ConstString const_name(name);
+ Symbol *undefined_symbol = symtab->FindFirstSymbolWithNameAndType (const_name,
+ eSymbolTypeUndefined,
+ Symtab::eDebugNo,
+ Symtab::eVisibilityExtern);
+
+ if (undefined_symbol)
+ {
+ ObjectFile *debug_map_objfile = m_debug_map_symfile->GetObjectFile();
+ if (debug_map_objfile)
+ {
+ Symtab *debug_map_symtab = debug_map_objfile->GetSymtab();
+ Symbol *defined_symbol = debug_map_symtab->FindFirstSymbolWithNameAndType (const_name,
+ eSymbolTypeData,
+ Symtab::eDebugYes,
+ Symtab::eVisibilityExtern);
+ if (defined_symbol)
+ {
+ const AddressRange *defined_range = defined_symbol->GetAddressRangePtr();
+ if (defined_range)
+ {
+ const addr_t defined_addr = defined_range->GetBaseAddress().GetFileAddress();
+ if (defined_addr != LLDB_INVALID_ADDRESS)
+ {
+ if (location.Update_DW_OP_addr (defined_addr))
+ {
+ symbol_context_scope = defined_symbol;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ scope = eValueTypeVariableGlobal;
+ }
+ else
+ scope = eValueTypeVariableStatic;
+ }
else
scope = eValueTypeVariableLocal;
- SymbolContextScope * symbol_context_scope = NULL;
- switch (parent_tag)
+ if (symbol_context_scope == NULL)
{
- case DW_TAG_subprogram:
- case DW_TAG_inlined_subroutine:
- case DW_TAG_lexical_block:
- if (sc.function)
+ switch (parent_tag)
{
- symbol_context_scope = sc.function->GetBlock(true).FindBlockByID(MakeUserID(sc_parent_die->GetOffset()));
- if (symbol_context_scope == NULL)
- symbol_context_scope = sc.function;
+ case DW_TAG_subprogram:
+ case DW_TAG_inlined_subroutine:
+ case DW_TAG_lexical_block:
+ if (sc.function)
+ {
+ symbol_context_scope = sc.function->GetBlock(true).FindBlockByID(MakeUserID(sc_parent_die->GetOffset()));
+ if (symbol_context_scope == NULL)
+ symbol_context_scope = sc.function;
+ }
+ break;
+
+ default:
+ symbol_context_scope = sc.comp_unit;
+ break;
}
- break;
-
- default:
- symbol_context_scope = sc.comp_unit;
- break;
}
if (symbol_context_scope)
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp?rev=144489&r1=144488&r2=144489&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp Sat Nov 12 22:15:56 2011
@@ -373,100 +373,36 @@
// parsed to span the gaps, or we can find the global variable
// sizes from the DWARF info as we are parsing.
-#if 0
- // First we find the non-stab entry that corresponds to the N_GSYM in the executable
- Symbol *exe_gsym_symbol = exe_symtab->FindFirstSymbolWithNameAndType(exe_symbol->GetMangled().GetName(Mangled::ePreferMangled), eSymbolTypeData, Symtab::eDebugNo, Symtab::eVisibilityAny);
-#else
- // The mach-o object file parser already matches up the N_GSYM with with the non-stab
- // entry, so we shouldn't have to do that. If this ever changes, enable the code above
- // in the "#if 0" block. STSYM's always match the symbol as found below.
- Symbol *exe_gsym_symbol = exe_symbol;
-#endif
// Next we find the non-stab entry that corresponds to the N_GSYM in the .o file
- Symbol *oso_gsym_symbol = oso_symtab->FindFirstSymbolWithNameAndType(exe_symbol->GetMangled().GetName(), eSymbolTypeData, Symtab::eDebugNo, Symtab::eVisibilityAny);
- if (oso_gsym_symbol == NULL)
- oso_gsym_symbol = oso_symtab->FindFirstSymbolWithNameAndType(exe_symbol->GetMangled().GetName(), eSymbolTypeExtern, Symtab::eDebugNo, Symtab::eVisibilityExtern);
- if (exe_gsym_symbol && oso_gsym_symbol && exe_gsym_symbol->GetAddressRangePtr() && oso_gsym_symbol->GetAddressRangePtr())
+ Symbol *oso_gsym_symbol = oso_symtab->FindFirstSymbolWithNameAndType (exe_symbol->GetMangled().GetName(),
+ eSymbolTypeData,
+ Symtab::eDebugNo,
+ Symtab::eVisibilityAny);
+
+ if (exe_symbol && oso_gsym_symbol && exe_symbol->GetAddressRangePtr() && oso_gsym_symbol->GetAddressRangePtr())
{
// If we found the symbol, then we
- Section* exe_gsym_section = const_cast(exe_gsym_symbol->GetAddressRangePtr()->GetBaseAddress().GetSection());
+ Section* exe_gsym_section = const_cast(exe_symbol->GetAddressRangePtr()->GetBaseAddress().GetSection());
Section* oso_gsym_section = const_cast(oso_gsym_symbol->GetAddressRangePtr()->GetBaseAddress().GetSection());
if (oso_gsym_section)
{
SectionSP oso_gsym_section_sp (new Section (const_cast(oso_gsym_symbol->GetAddressRangePtr()->GetBaseAddress().GetSection()),
- oso_module, // Module (the .o file)
- sect_id++, // Section ID starts at 0x10000 and increments so the section IDs don't overlap with the standard mach IDs
- exe_symbol->GetMangled().GetName(Mangled::ePreferMangled), // Name the section the same as the symbol for which is was generated!
- eSectionTypeDebug,
- oso_gsym_symbol->GetAddressRangePtr()->GetBaseAddress().GetOffset(), // File VM address offset in the current section
- 1, // We don't know the size of the global, just do the main address for now.
- 0, 0, 0));
+ oso_module, // Module (the .o file)
+ sect_id++, // Section ID starts at 0x10000 and increments so the section IDs don't overlap with the standard mach IDs
+ exe_symbol->GetMangled().GetName(Mangled::ePreferMangled), // Name the section the same as the symbol for which is was generated!
+ eSectionTypeDebug,
+ oso_gsym_symbol->GetAddressRangePtr()->GetBaseAddress().GetOffset(), // File VM address offset in the current section
+ 1, // We don't know the size of the global, just do the main address for now.
+ 0, 0, 0));
oso_gsym_section_sp->SetLinkedLocation (exe_gsym_section,
- exe_gsym_symbol->GetValue().GetFileAddress() - exe_gsym_section->GetFileAddress());
+ exe_symbol->GetValue().GetFileAddress() - exe_gsym_section->GetFileAddress());
oso_gsym_section->GetChildren().AddSection(oso_gsym_section_sp);
comp_unit_info->debug_map_sections_sp->AddSection(oso_gsym_section_sp);
}
}
}
break;
-
-// case eSymbolTypeStatic:
-// {
-// // For each N_STSYM we remap the address for the global by making
-// // a new section that we add to the sections found in the .o file.
-// // This new section has the file address set to what the
-// // addresses are in the .o file, and the load address is adjusted
-// // to match where it ended up in the final executable! We do this
-// // before we parse any dwarf info so that when it goes get parsed
-// // all section/offset addresses that get registered will resolve
-// // correctly to the new addresses in the main executable. We
-// // initially set the section size to be 1 byte, but will need to
-// // fix up these addresses further after all globals have been
-// // parsed to span the gaps, or we can find the global variable
-// // sizes from the DWARF info as we are parsing.
-//
-//
-// Symbol *exe_stsym_symbol = exe_symbol;
-// // First we find the non-stab entry that corresponds to the N_STSYM in the .o file
-// Symbol *oso_stsym_symbol = oso_symtab->FindFirstSymbolWithNameAndType(exe_symbol->GetMangled().GetName(), eSymbolTypeData);
-// if (exe_stsym_symbol && oso_stsym_symbol)
-// {
-// // If we found the symbol, then we
-// Section* exe_stsym_section = const_cast(exe_stsym_symbol->GetAddressRangePtr()->GetBaseAddress().GetSection());
-// Section* oso_stsym_section = const_cast(oso_stsym_symbol->GetAddressRangePtr()->GetBaseAddress().GetSection());
-// if (oso_stsym_section)
-// {
-// // The load address of the symbol will use the section in the
-// // executable that contains the debug map that corresponds to
-// // the N_FUN symbol. We set the offset to reflect the offset
-// // into that section since we are creating a new section.
-// AddressRange stsym_load_range(exe_stsym_section, exe_stsym_symbol->GetValue().GetFileAddress() - exe_stsym_section->GetFileAddress(), 1);
-// // We need the symbol's section offset address from the .o file, but
-// // we need a non-zero size.
-// AddressRange stsym_file_range(exe_stsym_symbol->GetAddressRangePtr()->GetBaseAddress().GetSection(), exe_stsym_symbol->GetAddressRangePtr()->GetBaseAddress().GetOffset(), 1);
-//
-// // Now we create a section that we will add as a child of the
-// // section in which the .o symbol (the N_FUN) exists.
-//
-//// TODO: mimic what I did for N_FUN if that works...
-//// // We use the 1 byte for the size because we don't know the
-//// // size of the global symbol without seeing the DWARF.
-//// SectionSP oso_fun_section_sp (new Section ( NULL, oso_module, // Module (the .o file)
-//// sect_id++, // Section ID starts at 0x10000 and increments so the section IDs don't overlap with the standard mach IDs
-//// exe_symbol->GetMangled().GetName(),// Name the section the same as the symbol for which is was generated!
-//// // &stsym_load_range, // Load offset is the offset into the executable section for the N_FUN from the debug map
-//// &stsym_file_range, // File section/offset is just the same os the symbol on the .o file
-//// 0, 0, 0));
-////
-//// // Now we add the new section to the .o file's sections as a child
-//// // of the section in which the N_SECT symbol exists.
-//// oso_stsym_section->GetChildren().AddSection(oso_fun_section_sp);
-//// comp_unit_info->debug_map_sections_sp->AddSection(oso_fun_section_sp);
-// }
-// }
-// }
-// break;
}
}
}
Modified: lldb/trunk/source/Symbol/ObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ObjectFile.cpp?rev=144489&r1=144488&r2=144489&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ObjectFile.cpp (original)
+++ lldb/trunk/source/Symbol/ObjectFile.cpp Sat Nov 12 22:15:56 2011
@@ -238,7 +238,6 @@
{
case eSymbolTypeAny: return eAddressClassUnknown;
case eSymbolTypeAbsolute: return eAddressClassUnknown;
- case eSymbolTypeExtern: return eAddressClassUnknown;
case eSymbolTypeCode: return eAddressClassCode;
case eSymbolTypeTrampoline: return eAddressClassCode;
case eSymbolTypeData: return eAddressClassData;
Modified: lldb/trunk/source/Symbol/Symbol.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Symbol.cpp?rev=144489&r1=144488&r2=144489&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Symbol.cpp (original)
+++ lldb/trunk/source/Symbol/Symbol.cpp Sat Nov 12 22:15:56 2011
@@ -317,7 +317,6 @@
{
ENUM_TO_CSTRING(Invalid);
ENUM_TO_CSTRING(Absolute);
- ENUM_TO_CSTRING(Extern);
ENUM_TO_CSTRING(Code);
ENUM_TO_CSTRING(Data);
ENUM_TO_CSTRING(Trampoline);
Modified: lldb/trunk/test/lang/c/global_variables/TestGlobalVariables.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/c/global_variables/TestGlobalVariables.py?rev=144489&r1=144488&r2=144489&view=diff
==============================================================================
--- lldb/trunk/test/lang/c/global_variables/TestGlobalVariables.py (original)
+++ lldb/trunk/test/lang/c/global_variables/TestGlobalVariables.py Sat Nov 12 22:15:56 2011
@@ -53,8 +53,9 @@
substrs = ['GLOBAL: (int) g_file_global_int = 42',
'GLOBAL: (const char *) g_file_global_cstr',
'"g_file_global_cstr"',
- 'GLOBAL: (const char *) g_file_static_cstr',
- '"g_file_static_cstr"'])
+ 'STATIC: (const char *) g_file_static_cstr',
+ '"g_file_static_cstr"',
+ 'GLOBAL: (int) g_common_1 = 21'])
# 'frame variable' should support address-of operator.
self.runCmd("frame variable &g_file_global_int")
Modified: lldb/trunk/test/lang/c/global_variables/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/c/global_variables/main.c?rev=144489&r1=144488&r2=144489&view=diff
==============================================================================
--- lldb/trunk/test/lang/c/global_variables/main.c (original)
+++ lldb/trunk/test/lang/c/global_variables/main.c Sat Nov 12 22:15:56 2011
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
#include
+int g_common_1; // Not initialized on purpose to cause it to be undefined external in .o file
int g_file_global_int = 42;
const char *g_file_global_cstr = "g_file_global_cstr";
static const char *g_file_static_cstr = "g_file_static_cstr";
@@ -15,7 +16,8 @@
extern int g_a;
int main (int argc, char const *argv[])
{
+ g_common_1 = g_file_global_int / 2;
static const char *g_func_static_cstr = "g_func_static_cstr";
printf ("%s %s\n", g_file_global_cstr, g_file_static_cstr);
- return g_file_global_int + g_a; // Set break point at this line. //// break $source:$line; continue; var -global g_a -global g_global_int
+ return g_file_global_int + g_a + g_common_1; // Set break point at this line. //// break $source:$line; continue; var -global g_a -global g_global_int
}
Modified: lldb/trunk/test/lldbutil.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbutil.py?rev=144489&r1=144488&r2=144489&view=diff
==============================================================================
--- lldb/trunk/test/lldbutil.py (original)
+++ lldb/trunk/test/lldbutil.py Sat Nov 12 22:15:56 2011
@@ -190,8 +190,6 @@
return "invalid"
elif enum == lldb.eSymbolTypeAbsolute:
return "absolute"
- elif enum == lldb.eSymbolTypeExtern:
- return "extern"
elif enum == lldb.eSymbolTypeCode:
return "code"
elif enum == lldb.eSymbolTypeData:
From gclayton at apple.com Sun Nov 13 00:57:32 2011
From: gclayton at apple.com (Greg Clayton)
Date: Sun, 13 Nov 2011 06:57:32 -0000
Subject: [Lldb-commits] [lldb] r144493 - in /lldb/trunk: include/lldb/API/
include/lldb/Symbol/ scripts/Python/ scripts/Python/interface/ source/API/
source/Symbol/
Message-ID: <20111113065732.CAE541BE001@llvm.org>
Author: gclayton
Date: Sun Nov 13 00:57:31 2011
New Revision: 144493
URL: http://llvm.org/viewvc/llvm-project?rev=144493&view=rev
Log:
Fixed an issues with the SBType and SBTypeMember classes:
- Fixed SBType to be able to dump itself from python
- Fixed SBType::GetNumberOfFields() to return the correct value for objective C interfaces
- Fixed SBTypeMember to be able to dump itself from python
- Fixed the SBTypeMember ability to get a field offset in bytes (the value
being returned was wrong)
- Added the SBTypeMember ability to get a field offset in bits
Cleaned up a lot of the Stream usage in the SB API files.
Modified:
lldb/trunk/include/lldb/API/SBStream.h
lldb/trunk/include/lldb/API/SBTarget.h
lldb/trunk/include/lldb/API/SBType.h
lldb/trunk/include/lldb/Symbol/ClangASTContext.h
lldb/trunk/include/lldb/Symbol/Type.h
lldb/trunk/scripts/Python/interface/SBTarget.i
lldb/trunk/scripts/Python/interface/SBType.i
lldb/trunk/scripts/Python/python-extensions.swig
lldb/trunk/source/API/SBAddress.cpp
lldb/trunk/source/API/SBBlock.cpp
lldb/trunk/source/API/SBBreakpointLocation.cpp
lldb/trunk/source/API/SBCommandReturnObject.cpp
lldb/trunk/source/API/SBCompileUnit.cpp
lldb/trunk/source/API/SBData.cpp
lldb/trunk/source/API/SBDebugger.cpp
lldb/trunk/source/API/SBEvent.cpp
lldb/trunk/source/API/SBFileSpec.cpp
lldb/trunk/source/API/SBFileSpecList.cpp
lldb/trunk/source/API/SBFrame.cpp
lldb/trunk/source/API/SBLineEntry.cpp
lldb/trunk/source/API/SBModule.cpp
lldb/trunk/source/API/SBProcess.cpp
lldb/trunk/source/API/SBSection.cpp
lldb/trunk/source/API/SBSymbol.cpp
lldb/trunk/source/API/SBSymbolContext.cpp
lldb/trunk/source/API/SBTarget.cpp
lldb/trunk/source/API/SBThread.cpp
lldb/trunk/source/API/SBType.cpp
lldb/trunk/source/API/SBValue.cpp
lldb/trunk/source/API/SBWatchpoint.cpp
lldb/trunk/source/Symbol/ClangASTContext.cpp
lldb/trunk/source/Symbol/ClangASTType.cpp
lldb/trunk/source/Symbol/Type.cpp
Modified: lldb/trunk/include/lldb/API/SBStream.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBStream.h?rev=144493&r1=144492&r2=144493&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBStream.h (original)
+++ lldb/trunk/include/lldb/API/SBStream.h Sun Nov 13 00:57:31 2011
@@ -64,18 +64,25 @@
friend class SBCommandReturnObject;
friend class SBCompileUnit;
friend class SBData;
+ friend class SBDebugger;
friend class SBEvent;
+ friend class SBFileSpec;
+ friend class SBFileSpecList;
friend class SBFrame;
friend class SBFunction;
friend class SBInstruction;
friend class SBInstructionList;
+ friend class SBLineEntry;
friend class SBModule;
+ friend class SBProcess;
friend class SBSection;
friend class SBSourceManager;
friend class SBSymbol;
friend class SBSymbolContext;
friend class SBTarget;
friend class SBThread;
+ friend class SBType;
+ friend class SBTypeMember;
friend class SBValue;
friend class SBWatchpoint;
Modified: lldb/trunk/include/lldb/API/SBTarget.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTarget.h?rev=144493&r1=144492&r2=144493&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBTarget.h (original)
+++ lldb/trunk/include/lldb/API/SBTarget.h Sun Nov 13 00:57:31 2011
@@ -496,13 +496,8 @@
#endif
-#ifndef SWIG
bool
GetDescription (lldb::SBStream &description, lldb::DescriptionLevel description_level);
-#endif
-
- bool
- GetDescription (lldb::SBStream &description, lldb::DescriptionLevel description_level) const;
protected:
friend class SBAddress;
Modified: lldb/trunk/include/lldb/API/SBType.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBType.h?rev=144493&r1=144492&r2=144493&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBType.h (original)
+++ lldb/trunk/include/lldb/API/SBType.h Sun Nov 13 00:57:31 2011
@@ -40,7 +40,14 @@
GetType ();
uint64_t
- GetOffsetByteSize();
+ GetOffsetInBytes();
+
+ uint64_t
+ GetOffsetInBits();
+
+ bool
+ GetDescription (lldb::SBStream &description,
+ lldb::DescriptionLevel description_level);
protected:
friend class SBType;
@@ -127,6 +134,10 @@
static bool
IsPointerType (void * clang_type);
+ bool
+ GetDescription (lldb::SBStream &description,
+ lldb::DescriptionLevel description_level);
+
protected:
#ifndef SWIG
Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=144493&r1=144492&r2=144493&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Sun Nov 13 00:57:31 2011
@@ -513,20 +513,20 @@
GetDirectBaseClassAtIndex (clang::ASTContext *ast,
lldb::clang_type_t clang_type,
uint32_t idx,
- uint32_t *byte_offset_ptr);
+ uint32_t *bit_offset_ptr);
static lldb::clang_type_t
GetVirtualBaseClassAtIndex (clang::ASTContext *ast,
lldb::clang_type_t clang_type,
uint32_t idx,
- uint32_t *byte_offset_ptr);
+ uint32_t *bit_offset_ptr);
static lldb::clang_type_t
GetFieldAtIndex (clang::ASTContext *ast,
lldb::clang_type_t clang_type,
uint32_t idx,
std::string& name,
- uint32_t *byte_offset_ptr);
+ uint32_t *bit_offset_ptr);
static uint32_t
GetNumPointeeChildren (lldb::clang_type_t clang_type);
Modified: lldb/trunk/include/lldb/Symbol/Type.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Type.h?rev=144493&r1=144492&r2=144493&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/Type.h (original)
+++ lldb/trunk/include/lldb/Symbol/Type.h Sun Nov 13 00:57:31 2011
@@ -355,6 +355,11 @@
lldb::clang_type_t
GetOpaqueQualType();
+ bool
+ GetDescription (lldb_private::Stream &strm,
+ lldb::DescriptionLevel description_level);
+
+
private:
ClangASTType m_clang_ast_type;
lldb::TypeSP m_type_sp;
Modified: lldb/trunk/scripts/Python/interface/SBTarget.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBTarget.i?rev=144493&r1=144492&r2=144493&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBTarget.i (original)
+++ lldb/trunk/scripts/Python/interface/SBTarget.i Sun Nov 13 00:57:31 2011
@@ -472,7 +472,7 @@
GetBroadcaster () const;
bool
- GetDescription (lldb::SBStream &description, lldb::DescriptionLevel description_level) const;
+ GetDescription (lldb::SBStream &description, lldb::DescriptionLevel description_level);
};
} // namespace lldb
Modified: lldb/trunk/scripts/Python/interface/SBType.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBType.i?rev=144493&r1=144492&r2=144493&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBType.i (original)
+++ lldb/trunk/scripts/Python/interface/SBType.i Sun Nov 13 00:57:31 2011
@@ -32,8 +32,11 @@
GetType ();
uint64_t
- GetOffsetByteSize();
-
+ GetOffsetInBytes();
+
+ uint64_t
+ GetOffsetInBits();
+
protected:
std::auto_ptr m_opaque_ap;
};
Modified: lldb/trunk/scripts/Python/python-extensions.swig
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-extensions.swig?rev=144493&r1=144492&r2=144493&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/python-extensions.swig (original)
+++ lldb/trunk/scripts/Python/python-extensions.swig Sun Nov 13 00:57:31 2011
@@ -146,6 +146,20 @@
return PyString_FromString (description.GetData());
}
}
+%extend lldb::SBType {
+ PyObject *lldb::SBType::__repr__ (){
+ lldb::SBStream description;
+ $self->GetDescription (description, lldb::eDescriptionLevelBrief);
+ return PyString_FromString (description.GetData());
+ }
+}
+%extend lldb::SBTypeMember {
+ PyObject *lldb::SBTypeMember::__repr__ (){
+ lldb::SBStream description;
+ $self->GetDescription (description, lldb::eDescriptionLevelBrief);
+ return PyString_FromString (description.GetData());
+ }
+}
%extend lldb::SBThread {
PyObject *lldb::SBThread::__repr__ (){
lldb::SBStream description;
Modified: lldb/trunk/source/API/SBAddress.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBAddress.cpp?rev=144493&r1=144492&r2=144493&view=diff
==============================================================================
--- lldb/trunk/source/API/SBAddress.cpp (original)
+++ lldb/trunk/source/API/SBAddress.cpp Sun Nov 13 00:57:31 2011
@@ -277,11 +277,11 @@
{
// Call "ref()" on the stream to make sure it creates a backing stream in
// case there isn't one already...
- description.ref();
+ Stream &strm = description.ref();
if (m_opaque_ap.get())
- m_opaque_ap->GetAddress().Dump (description.get(), NULL, Address::DumpStyleModuleWithFileAddress, Address::DumpStyleInvalid, 4);
+ m_opaque_ap->GetAddress().Dump (&strm, NULL, Address::DumpStyleModuleWithFileAddress, Address::DumpStyleInvalid, 4);
else
- description.Printf ("No value");
+ strm.PutCString ("No value");
return true;
}
Modified: lldb/trunk/source/API/SBBlock.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBlock.cpp?rev=144493&r1=144492&r2=144493&view=diff
==============================================================================
--- lldb/trunk/source/API/SBBlock.cpp (original)
+++ lldb/trunk/source/API/SBBlock.cpp Sun Nov 13 00:57:31 2011
@@ -171,24 +171,26 @@
bool
SBBlock::GetDescription (SBStream &description)
{
+ Stream &strm = description.ref();
+
if (m_opaque_ptr)
{
lldb::user_id_t id = m_opaque_ptr->GetID();
- description.Printf ("Block: {id: %llu} ", id);
+ strm.Printf ("Block: {id: %llu} ", id);
if (IsInlined())
{
- description.Printf (" (inlined, '%s') ", GetInlinedName());
+ strm.Printf (" (inlined, '%s') ", GetInlinedName());
}
lldb_private::SymbolContext sc;
m_opaque_ptr->CalculateSymbolContext (&sc);
if (sc.function)
{
- m_opaque_ptr->DumpAddressRanges (description.get(),
+ m_opaque_ptr->DumpAddressRanges (&strm,
sc.function->GetAddressRange().GetBaseAddress().GetFileAddress());
}
}
else
- description.Printf ("No value");
+ strm.PutCString ("No value");
return true;
}
Modified: lldb/trunk/source/API/SBBreakpointLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpointLocation.cpp?rev=144493&r1=144492&r2=144493&view=diff
==============================================================================
--- lldb/trunk/source/API/SBBreakpointLocation.cpp (original)
+++ lldb/trunk/source/API/SBBreakpointLocation.cpp Sun Nov 13 00:57:31 2011
@@ -275,15 +275,16 @@
bool
SBBreakpointLocation::GetDescription (SBStream &description, DescriptionLevel level)
{
+ Stream &strm = description.ref();
+
if (m_opaque_sp)
{
Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
- description.ref();
- m_opaque_sp->GetDescription (description.get(), level);
- description.get()->EOL();
+ m_opaque_sp->GetDescription (&strm, level);
+ strm.EOL();
}
else
- description.Printf ("No value");
+ strm.PutCString ("No value");
return true;
}
Modified: lldb/trunk/source/API/SBCommandReturnObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandReturnObject.cpp?rev=144493&r1=144492&r2=144493&view=diff
==============================================================================
--- lldb/trunk/source/API/SBCommandReturnObject.cpp (original)
+++ lldb/trunk/source/API/SBCommandReturnObject.cpp Sun Nov 13 00:57:31 2011
@@ -221,27 +221,29 @@
bool
SBCommandReturnObject::GetDescription (SBStream &description)
{
+ Stream &strm = description.ref();
+
if (m_opaque_ap.get())
{
description.Printf ("Status: ");
lldb::ReturnStatus status = m_opaque_ap->GetStatus();
if (status == lldb::eReturnStatusStarted)
- description.Printf ("Started");
+ strm.PutCString ("Started");
else if (status == lldb::eReturnStatusInvalid)
- description.Printf ("Invalid");
+ strm.PutCString ("Invalid");
else if (m_opaque_ap->Succeeded())
- description.Printf ("Success");
+ strm.PutCString ("Success");
else
- description.Printf ("Fail");
+ strm.PutCString ("Fail");
if (GetOutputSize() > 0)
- description.Printf ("\nOutput Message:\n%s", GetOutput());
+ strm.Printf ("\nOutput Message:\n%s", GetOutput());
if (GetErrorSize() > 0)
- description.Printf ("\nError Message:\n%s", GetError());
+ strm.Printf ("\nError Message:\n%s", GetError());
}
else
- description.Printf ("No value");
+ strm.PutCString ("No value");
return true;
}
Modified: lldb/trunk/source/API/SBCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCompileUnit.cpp?rev=144493&r1=144492&r2=144493&view=diff
==============================================================================
--- lldb/trunk/source/API/SBCompileUnit.cpp (original)
+++ lldb/trunk/source/API/SBCompileUnit.cpp Sun Nov 13 00:57:31 2011
@@ -189,13 +189,14 @@
bool
SBCompileUnit::GetDescription (SBStream &description)
{
+ Stream &strm = description.ref();
+
if (m_opaque_ptr)
{
- description.ref();
- m_opaque_ptr->Dump (description.get(), false);
+ m_opaque_ptr->Dump (&strm, false);
}
else
- description.Printf ("No Value");
+ strm.PutCString ("No value");
return true;
}
Modified: lldb/trunk/source/API/SBData.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBData.cpp?rev=144493&r1=144492&r2=144493&view=diff
==============================================================================
--- lldb/trunk/source/API/SBData.cpp (original)
+++ lldb/trunk/source/API/SBData.cpp Sun Nov 13 00:57:31 2011
@@ -13,6 +13,8 @@
#include "lldb/Core/DataExtractor.h"
#include "lldb/Core/Log.h"
+#include "lldb/Core/Stream.h"
+
using namespace lldb;
using namespace lldb_private;
@@ -414,21 +416,22 @@
bool
SBData::GetDescription (lldb::SBStream &description, lldb::addr_t base_addr)
{
+ Stream &strm = description.ref();
+
if (m_opaque_sp)
{
- description.ref();
- m_opaque_sp->Dump(description.get(),
- 0,
- lldb::eFormatBytesWithASCII,
- 1,
- m_opaque_sp->GetByteSize(),
- 16,
- base_addr,
- 0,
- 0);
+ m_opaque_sp->Dump (&strm,
+ 0,
+ lldb::eFormatBytesWithASCII,
+ 1,
+ m_opaque_sp->GetByteSize(),
+ 16,
+ base_addr,
+ 0,
+ 0);
}
else
- description.Printf ("No Value");
+ strm.PutCString ("No value");
return true;
}
Modified: lldb/trunk/source/API/SBDebugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBDebugger.cpp?rev=144493&r1=144492&r2=144493&view=diff
==============================================================================
--- lldb/trunk/source/API/SBDebugger.cpp (original)
+++ lldb/trunk/source/API/SBDebugger.cpp Sun Nov 13 00:57:31 2011
@@ -965,14 +965,16 @@
bool
SBDebugger::GetDescription (SBStream &description)
{
+ Stream &strm = description.ref();
+
if (m_opaque_sp)
{
const char *name = m_opaque_sp->GetInstanceName().AsCString();
user_id_t id = m_opaque_sp->GetID();
- description.Printf ("Debugger (instance: \"%s\", id: %llu)", name, id);
+ strm.Printf ("Debugger (instance: \"%s\", id: %llu)", name, id);
}
else
- description.Printf ("No value");
+ strm.PutCString ("No value");
return true;
}
Modified: lldb/trunk/source/API/SBEvent.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBEvent.cpp?rev=144493&r1=144492&r2=144493&view=diff
==============================================================================
--- lldb/trunk/source/API/SBEvent.cpp (original)
+++ lldb/trunk/source/API/SBEvent.cpp Sun Nov 13 00:57:31 2011
@@ -205,13 +205,14 @@
bool
SBEvent::GetDescription (SBStream &description)
{
+ Stream &strm = description.ref();
+
if (get())
{
- description.ref();
- m_opaque_ptr->Dump (description.get());
+ m_opaque_ptr->Dump (&strm);
}
else
- description.Printf ("No value");
+ strm.PutCString ("No value");
return true;
}
@@ -219,13 +220,14 @@
bool
SBEvent::GetDescription (SBStream &description) const
{
+ Stream &strm = description.ref();
+
if (get())
{
- description.ref();
- m_opaque_ptr->Dump (description.get());
+ m_opaque_ptr->Dump (&strm);
}
else
- description.Printf ("No value");
+ strm.PutCString ("No value");
return true;
}
Modified: lldb/trunk/source/API/SBFileSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFileSpec.cpp?rev=144493&r1=144492&r2=144493&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFileSpec.cpp (original)
+++ lldb/trunk/source/API/SBFileSpec.cpp Sun Nov 13 00:57:31 2011
@@ -13,6 +13,7 @@
#include "lldb/API/SBStream.h"
#include "lldb/Host/FileSpec.h"
#include "lldb/Core/Log.h"
+#include "lldb/Core/Stream.h"
using namespace lldb;
using namespace lldb_private;
@@ -200,14 +201,15 @@
bool
SBFileSpec::GetDescription (SBStream &description) const
{
+ Stream &strm = description.ref();
if (m_opaque_ap.get())
{
char path[PATH_MAX];
if (m_opaque_ap->GetPath(path, sizeof(path)))
- description.Printf ("%s", path);
+ strm.PutCString (path);
}
else
- description.Printf ("No value");
+ strm.PutCString ("No value");
return true;
}
Modified: lldb/trunk/source/API/SBFileSpecList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFileSpecList.cpp?rev=144493&r1=144492&r2=144493&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFileSpecList.cpp (original)
+++ lldb/trunk/source/API/SBFileSpecList.cpp Sun Nov 13 00:57:31 2011
@@ -14,6 +14,7 @@
#include "lldb/API/SBStream.h"
#include "lldb/Core/FileSpecList.h"
#include "lldb/Core/Log.h"
+#include "lldb/Core/Stream.h"
#include "lldb/Host/FileSpec.h"
using namespace lldb;
@@ -121,19 +122,21 @@
bool
SBFileSpecList::GetDescription (SBStream &description) const
{
+ Stream &strm = description.ref();
+
if (m_opaque_ap.get())
{
uint32_t num_files = m_opaque_ap->GetSize();
- description.Printf ("%d files: ", num_files);
+ strm.Printf ("%d files: ", num_files);
for (uint32_t i = 0; i < num_files; i++)
{
char path[PATH_MAX];
if (m_opaque_ap->GetFileSpecAtIndex(i).GetPath(path, sizeof(path)))
- description.Printf ("\n %s", path);
+ strm.Printf ("\n %s", path);
}
}
else
- description.Printf ("No value");
+ strm.PutCString ("No value");
return true;
}
Modified: lldb/trunk/source/API/SBFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=144493&r1=144492&r2=144493&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFrame.cpp (original)
+++ lldb/trunk/source/API/SBFrame.cpp Sun Nov 13 00:57:31 2011
@@ -708,14 +708,15 @@
bool
SBFrame::GetDescription (SBStream &description)
{
+ Stream &strm = description.ref();
+
if (m_opaque_sp)
{
Mutex::Locker api_locker (m_opaque_sp->GetThread().GetProcess().GetTarget().GetAPIMutex());
- Stream &s = description.ref();
- m_opaque_sp->DumpUsingSettingsFormat (&s);
+ m_opaque_sp->DumpUsingSettingsFormat (&strm);
}
else
- description.Printf ("No value");
+ strm.PutCString ("No value");
return true;
}
Modified: lldb/trunk/source/API/SBLineEntry.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBLineEntry.cpp?rev=144493&r1=144492&r2=144493&view=diff
==============================================================================
--- lldb/trunk/source/API/SBLineEntry.cpp (original)
+++ lldb/trunk/source/API/SBLineEntry.cpp Sun Nov 13 00:57:31 2011
@@ -225,16 +225,18 @@
bool
SBLineEntry::GetDescription (SBStream &description)
{
+ Stream &strm = description.ref();
+
if (m_opaque_ap.get())
{
char file_path[PATH_MAX*2];
m_opaque_ap->file.GetPath (file_path, sizeof (file_path));
- description.Printf ("%s:%u", file_path, GetLine());
+ strm.Printf ("%s:%u", file_path, GetLine());
if (GetColumn() > 0)
- description.Printf (":%u", GetColumn());
+ strm.Printf (":%u", GetColumn());
}
else
- description.Printf ("No value");
+ strm.PutCString ("No value");
return true;
}
Modified: lldb/trunk/source/API/SBModule.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBModule.cpp?rev=144493&r1=144492&r2=144493&view=diff
==============================================================================
--- lldb/trunk/source/API/SBModule.cpp (original)
+++ lldb/trunk/source/API/SBModule.cpp Sun Nov 13 00:57:31 2011
@@ -255,13 +255,14 @@
bool
SBModule::GetDescription (SBStream &description)
{
+ Stream &strm = description.ref();
+
if (m_opaque_sp)
{
- description.ref();
- m_opaque_sp->GetDescription (description.get());
+ m_opaque_sp->GetDescription (&strm);
}
else
- description.Printf ("No value");
+ strm.PutCString ("No value");
return true;
}
Modified: lldb/trunk/source/API/SBProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBProcess.cpp?rev=144493&r1=144492&r2=144493&view=diff
==============================================================================
--- lldb/trunk/source/API/SBProcess.cpp (original)
+++ lldb/trunk/source/API/SBProcess.cpp Sun Nov 13 00:57:31 2011
@@ -814,6 +814,8 @@
bool
SBProcess::GetDescription (SBStream &description)
{
+ Stream &strm = description.ref();
+
if (m_opaque_sp)
{
char path[PATH_MAX];
@@ -823,15 +825,15 @@
if (exe_module)
exe_name = exe_module->GetFileSpec().GetFilename().AsCString();
- description.Printf ("SBProcess: pid = %llu, state = %s, threads = %d%s%s",
- m_opaque_sp->GetID(),
- lldb_private::StateAsCString (GetState()),
- GetNumThreads(),
- exe_name ? ", executable = " : "",
- exe_name ? exe_name : "");
+ strm.Printf ("SBProcess: pid = %llu, state = %s, threads = %d%s%s",
+ m_opaque_sp->GetID(),
+ lldb_private::StateAsCString (GetState()),
+ GetNumThreads(),
+ exe_name ? ", executable = " : "",
+ exe_name ? exe_name : "");
}
else
- description.Printf ("No value");
+ strm.PutCString ("No value");
return true;
}
Modified: lldb/trunk/source/API/SBSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSection.cpp?rev=144493&r1=144492&r2=144493&view=diff
==============================================================================
--- lldb/trunk/source/API/SBSection.cpp (original)
+++ lldb/trunk/source/API/SBSection.cpp Sun Nov 13 00:57:31 2011
@@ -326,16 +326,18 @@
bool
SBSection::GetDescription (SBStream &description)
{
+ Stream &strm = description.ref();
+
if (IsValid())
{
const Section *section = m_opaque_ap->GetSection();
const addr_t file_addr = section->GetFileAddress();
- description.Printf ("[0x%16.16llx-0x%16.16llx) ", file_addr, file_addr + section->GetByteSize());
- section->DumpName(description.get());
+ strm.Printf ("[0x%16.16llx-0x%16.16llx) ", file_addr, file_addr + section->GetByteSize());
+ section->DumpName(&strm);
}
else
{
- description.Printf ("No value");
+ strm.PutCString ("No value");
}
return true;
Modified: lldb/trunk/source/API/SBSymbol.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSymbol.cpp?rev=144493&r1=144492&r2=144493&view=diff
==============================================================================
--- lldb/trunk/source/API/SBSymbol.cpp (original)
+++ lldb/trunk/source/API/SBSymbol.cpp Sun Nov 13 00:57:31 2011
@@ -100,14 +100,15 @@
bool
SBSymbol::GetDescription (SBStream &description)
{
+ Stream &strm = description.ref();
+
if (m_opaque_ptr)
{
- description.ref();
- m_opaque_ptr->GetDescription (description.get(),
+ m_opaque_ptr->GetDescription (&strm,
lldb::eDescriptionLevelFull, NULL);
}
else
- description.Printf ("No value");
+ strm.PutCString ("No value");
return true;
}
Modified: lldb/trunk/source/API/SBSymbolContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSymbolContext.cpp?rev=144493&r1=144492&r2=144493&view=diff
==============================================================================
--- lldb/trunk/source/API/SBSymbolContext.cpp (original)
+++ lldb/trunk/source/API/SBSymbolContext.cpp Sun Nov 13 00:57:31 2011
@@ -254,13 +254,14 @@
bool
SBSymbolContext::GetDescription (SBStream &description)
{
+ Stream &strm = description.ref();
+
if (m_opaque_ap.get())
{
- description.ref();
- m_opaque_ap->GetDescription (description.get(), lldb::eDescriptionLevelFull, NULL);
+ m_opaque_ap->GetDescription (&strm, lldb::eDescriptionLevelFull, NULL);
}
else
- description.Printf ("No value");
+ strm.PutCString ("No value");
return true;
}
Modified: lldb/trunk/source/API/SBTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=144493&r1=144492&r2=144493&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTarget.cpp (original)
+++ lldb/trunk/source/API/SBTarget.cpp Sun Nov 13 00:57:31 2011
@@ -1152,32 +1152,18 @@
bool
SBTarget::GetDescription (SBStream &description, lldb::DescriptionLevel description_level)
{
- if (m_opaque_sp)
- {
- description.ref();
- m_opaque_sp->Dump (description.get(), description_level);
- }
- else
- description.Printf ("No value");
-
- return true;
-}
+ Stream &strm = description.ref();
-bool
-SBTarget::GetDescription (SBStream &description, lldb::DescriptionLevel description_level) const
-{
if (m_opaque_sp)
{
- description.ref();
- m_opaque_sp->Dump (description.get(), description_level);
+ m_opaque_sp->Dump (&strm, description_level);
}
else
- description.Printf ("No value");
+ strm.PutCString ("No value");
return true;
}
-
uint32_t
SBTarget::FindFunctions (const char *name,
uint32_t name_type_mask,
Modified: lldb/trunk/source/API/SBThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBThread.cpp?rev=144493&r1=144492&r2=144493&view=diff
==============================================================================
--- lldb/trunk/source/API/SBThread.cpp (original)
+++ lldb/trunk/source/API/SBThread.cpp Sun Nov 13 00:57:31 2011
@@ -951,13 +951,14 @@
bool
SBThread::GetDescription (SBStream &description) const
{
+ Stream &strm = description.ref();
+
if (m_opaque_sp)
{
- StreamString strm;
- description.Printf("SBThread: tid = 0x%4.4llx", m_opaque_sp->GetID());
+ strm.Printf("SBThread: tid = 0x%4.4llx", m_opaque_sp->GetID());
}
else
- description.Printf ("No value");
+ strm.PutCString ("No value");
return true;
}
Modified: lldb/trunk/source/API/SBType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBType.cpp?rev=144493&r1=144492&r2=144493&view=diff
==============================================================================
--- lldb/trunk/source/API/SBType.cpp (original)
+++ lldb/trunk/source/API/SBType.cpp Sun Nov 13 00:57:31 2011
@@ -18,6 +18,7 @@
#include "lldb/API/SBStream.h"
#include "lldb/Core/ConstString.h"
#include "lldb/Core/Log.h"
+#include "lldb/Core/Stream.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/ClangASTType.h"
#include "lldb/Symbol/Type.h"
@@ -342,6 +343,23 @@
return 0;
}
+bool
+SBType::GetDescription (SBStream &description, lldb::DescriptionLevel description_level)
+{
+ Stream &strm = description.ref();
+
+ if (m_opaque_sp)
+ {
+ m_opaque_sp->GetDescription (strm, description_level);
+ }
+ else
+ strm.PutCString ("No value");
+
+ return true;
+}
+
+
+
SBTypeMember
SBType::GetDirectBaseClassAtIndex (uint32_t idx)
{
@@ -349,12 +367,12 @@
if (IsValid())
{
clang::ASTContext* ast = m_opaque_sp->GetASTContext();
- uint32_t byte_offset = 0;
- clang_type_t clang_type = ClangASTContext::GetDirectBaseClassAtIndex (ast, m_opaque_sp->GetOpaqueQualType(), idx, &byte_offset);
+ uint32_t bit_offset = 0;
+ clang_type_t clang_type = ClangASTContext::GetDirectBaseClassAtIndex (ast, m_opaque_sp->GetOpaqueQualType(), idx, &bit_offset);
if (clang_type)
{
TypeImplSP type_impl_sp (new TypeImpl(ClangASTType (ast, clang_type)));
- sb_type_member.reset (new TypeMemberImpl (type_impl_sp, byte_offset));
+ sb_type_member.reset (new TypeMemberImpl (type_impl_sp, bit_offset));
}
}
return sb_type_member;
@@ -367,13 +385,13 @@
SBTypeMember sb_type_member;
if (IsValid())
{
- uint32_t byte_offset = 0;
+ uint32_t bit_offset = 0;
clang::ASTContext* ast = m_opaque_sp->GetASTContext();
- clang_type_t clang_type = ClangASTContext::GetVirtualBaseClassAtIndex (ast, m_opaque_sp->GetOpaqueQualType(), idx, &byte_offset);
+ clang_type_t clang_type = ClangASTContext::GetVirtualBaseClassAtIndex (ast, m_opaque_sp->GetOpaqueQualType(), idx, &bit_offset);
if (clang_type)
{
TypeImplSP type_impl_sp (new TypeImpl(ClangASTType (ast, clang_type)));
- sb_type_member.reset (new TypeMemberImpl (type_impl_sp, byte_offset));
+ sb_type_member.reset (new TypeMemberImpl (type_impl_sp, bit_offset));
}
}
return sb_type_member;
@@ -385,17 +403,17 @@
SBTypeMember sb_type_member;
if (IsValid())
{
- uint32_t byte_offset = 0;
+ uint32_t bit_offset = 0;
clang::ASTContext* ast = m_opaque_sp->GetASTContext();
std::string name_sstr;
- clang_type_t clang_type = ClangASTContext::GetFieldAtIndex (ast, m_opaque_sp->GetOpaqueQualType(), idx, name_sstr, &byte_offset);
+ clang_type_t clang_type = ClangASTContext::GetFieldAtIndex (ast, m_opaque_sp->GetOpaqueQualType(), idx, name_sstr, &bit_offset);
if (clang_type)
{
ConstString name;
if (!name_sstr.empty())
name.SetCString(name_sstr.c_str());
TypeImplSP type_impl_sp (new TypeImpl(ClangASTType (ast, clang_type)));
- sb_type_member.reset (new TypeMemberImpl (type_impl_sp, byte_offset, name));
+ sb_type_member.reset (new TypeMemberImpl (type_impl_sp, bit_offset, name));
}
}
return sb_type_member;
@@ -545,13 +563,46 @@
}
uint64_t
-SBTypeMember::GetOffsetByteSize()
+SBTypeMember::GetOffsetInBytes()
{
if (m_opaque_ap.get())
return (m_opaque_ap->GetBitOffset() + 7) / 8u;
return 0;
}
+uint64_t
+SBTypeMember::GetOffsetInBits()
+{
+ if (m_opaque_ap.get())
+ return m_opaque_ap->GetBitOffset();
+ return 0;
+}
+
+bool
+SBTypeMember::GetDescription (lldb::SBStream &description, lldb::DescriptionLevel description_level)
+{
+ Stream &strm = description.ref();
+
+ if (m_opaque_ap.get())
+ {
+ const uint32_t byte_offset = (m_opaque_ap->GetBitOffset() + 7) / 8u;
+ const char *name = m_opaque_ap->GetName().GetCString();
+ strm.Printf ("+%u: (", byte_offset);
+
+ TypeImplSP type_impl_sp (m_opaque_ap->GetTypeImpl());
+ if (type_impl_sp)
+ type_impl_sp->GetDescription(strm, description_level);
+
+ strm.Printf (") %s", name);
+ }
+ else
+ {
+ strm.PutCString ("No value");
+ }
+ return true;
+}
+
+
void
SBTypeMember::reset(TypeMemberImpl *type_member_impl)
{
Modified: lldb/trunk/source/API/SBValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValue.cpp?rev=144493&r1=144492&r2=144493&view=diff
==============================================================================
--- lldb/trunk/source/API/SBValue.cpp (original)
+++ lldb/trunk/source/API/SBValue.cpp Sun Nov 13 00:57:31 2011
@@ -917,25 +917,14 @@
bool
SBValue::GetDescription (SBStream &description)
{
+ Stream &strm = description.ref();
+
if (m_opaque_sp)
{
- /*uint32_t ptr_depth = 0;
- uint32_t curr_depth = 0;
- uint32_t max_depth = UINT32_MAX;
- bool show_types = false;
- bool show_location = false;
- bool use_objc = false;
- lldb::DynamicValueType use_dynamic = eNoDynamicValues;
- bool scope_already_checked = false;
- bool flat_output = false;
- bool use_synthetic = true;
- uint32_t no_summary_depth = 0;
- bool ignore_cap = false;*/
- ValueObject::DumpValueObject (description.ref(),
- m_opaque_sp.get());
+ ValueObject::DumpValueObject (strm, m_opaque_sp.get());
}
else
- description.Printf ("No value");
+ strm.PutCString ("No value");
return true;
}
Modified: lldb/trunk/source/API/SBWatchpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBWatchpoint.cpp?rev=144493&r1=144492&r2=144493&view=diff
==============================================================================
--- lldb/trunk/source/API/SBWatchpoint.cpp (original)
+++ lldb/trunk/source/API/SBWatchpoint.cpp Sun Nov 13 00:57:31 2011
@@ -229,15 +229,16 @@
bool
SBWatchpoint::GetDescription (SBStream &description, DescriptionLevel level)
{
+ Stream &strm = description.ref();
+
if (m_opaque_sp)
{
Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
- description.ref();
- m_opaque_sp->GetDescription (description.get(), level);
- description.get()->EOL();
+ m_opaque_sp->GetDescription (&strm, level);
+ strm.EOL();
}
else
- description.Printf ("No value");
+ strm.PutCString ("No value");
return true;
}
Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=144493&r1=144492&r2=144493&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Sun Nov 13 00:57:31 2011
@@ -2844,6 +2844,21 @@
count = ClangASTContext::GetNumFields (ast, cast(qual_type)->getNamedType().getAsOpaquePtr());
break;
+ case clang::Type::ObjCObject:
+ case clang::Type::ObjCInterface:
+ if (GetCompleteQualType (ast, qual_type))
+ {
+ const ObjCObjectType *objc_class_type = dyn_cast(qual_type.getTypePtr());
+ if (objc_class_type)
+ {
+ ObjCInterfaceDecl *class_interface_decl = objc_class_type->getInterface();
+
+ if (class_interface_decl)
+ count = class_interface_decl->ivar_size();
+ }
+ }
+ break;
+
default:
break;
}
@@ -2854,7 +2869,7 @@
ClangASTContext::GetDirectBaseClassAtIndex (clang::ASTContext *ast,
clang_type_t clang_type,
uint32_t idx,
- uint32_t *byte_offset_ptr)
+ uint32_t *bit_offset_ptr)
{
if (clang_type == NULL)
return 0;
@@ -2877,14 +2892,14 @@
{
if (curr_idx == idx)
{
- if (byte_offset_ptr)
+ if (bit_offset_ptr)
{
const ASTRecordLayout &record_layout = ast->getASTRecordLayout(cxx_record_decl);
const CXXRecordDecl *base_class_decl = cast(base_class->getType()->getAs()->getDecl());
// if (base_class->isVirtual())
-// *byte_offset_ptr = record_layout.getVBaseClassOffset(base_class_decl).getQuantity() * 8;
+// *bit_offset_ptr = record_layout.getVBaseClassOffset(base_class_decl).getQuantity() * 8;
// else
- *byte_offset_ptr = record_layout.getBaseClassOffset(base_class_decl).getQuantity() * 8;
+ *bit_offset_ptr = record_layout.getBaseClassOffset(base_class_decl).getQuantity() * 8;
}
return base_class->getType().getAsOpaquePtr();
}
@@ -2907,8 +2922,8 @@
ObjCInterfaceDecl *superclass_interface_decl = class_interface_decl->getSuperClass();
if (superclass_interface_decl)
{
- if (byte_offset_ptr)
- *byte_offset_ptr = 0;
+ if (bit_offset_ptr)
+ *bit_offset_ptr = 0;
return ast->getObjCInterfaceType(superclass_interface_decl).getAsOpaquePtr();
}
}
@@ -2921,13 +2936,13 @@
return ClangASTContext::GetDirectBaseClassAtIndex (ast,
cast(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr(),
idx,
- byte_offset_ptr);
+ bit_offset_ptr);
case clang::Type::Elaborated:
return ClangASTContext::GetDirectBaseClassAtIndex (ast,
cast(qual_type)->getNamedType().getAsOpaquePtr(),
idx,
- byte_offset_ptr);
+ bit_offset_ptr);
default:
break;
@@ -2939,7 +2954,7 @@
ClangASTContext::GetVirtualBaseClassAtIndex (clang::ASTContext *ast,
clang_type_t clang_type,
uint32_t idx,
- uint32_t *byte_offset_ptr)
+ uint32_t *bit_offset_ptr)
{
if (clang_type == NULL)
return 0;
@@ -2962,11 +2977,11 @@
{
if (curr_idx == idx)
{
- if (byte_offset_ptr)
+ if (bit_offset_ptr)
{
const ASTRecordLayout &record_layout = ast->getASTRecordLayout(cxx_record_decl);
const CXXRecordDecl *base_class_decl = cast(base_class->getType()->getAs()->getDecl());
- *byte_offset_ptr = record_layout.getVBaseClassOffset(base_class_decl).getQuantity() * 8;
+ *bit_offset_ptr = record_layout.getVBaseClassOffset(base_class_decl).getQuantity() * 8;
}
return base_class->getType().getAsOpaquePtr();
@@ -2980,13 +2995,13 @@
return ClangASTContext::GetVirtualBaseClassAtIndex (ast,
cast(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr(),
idx,
- byte_offset_ptr);
+ bit_offset_ptr);
case clang::Type::Elaborated:
return ClangASTContext::GetVirtualBaseClassAtIndex (ast,
cast(qual_type)->getNamedType().getAsOpaquePtr(),
idx,
- byte_offset_ptr);
+ bit_offset_ptr);
default:
break;
@@ -2999,7 +3014,7 @@
clang_type_t clang_type,
uint32_t idx,
std::string& name,
- uint32_t *byte_offset_ptr)
+ uint32_t *bit_offset_ptr)
{
if (clang_type == NULL)
return 0;
@@ -3025,10 +3040,10 @@
// Figure out the type byte size (field_type_info.first) and
// alignment (field_type_info.second) from the AST context.
- if (byte_offset_ptr)
+ if (bit_offset_ptr)
{
const ASTRecordLayout &record_layout = ast->getASTRecordLayout(record_decl);
- *byte_offset_ptr = (record_layout.getFieldOffset (field_idx) + 7) / 8;
+ *bit_offset_ptr = record_layout.getFieldOffset (field_idx);
}
return field->getType().getAsOpaquePtr();
@@ -3064,10 +3079,10 @@
name.assign(ivar_decl->getNameAsString());
- if (byte_offset_ptr)
+ if (bit_offset_ptr)
{
const ASTRecordLayout &interface_layout = ast->getASTObjCInterfaceLayout(class_interface_decl);
- *byte_offset_ptr = (interface_layout.getFieldOffset (ivar_idx) + 7)/8;
+ *bit_offset_ptr = interface_layout.getFieldOffset (ivar_idx);
}
return ivar_qual_type.getAsOpaquePtr();
@@ -3085,14 +3100,14 @@
cast(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr(),
idx,
name,
- byte_offset_ptr);
+ bit_offset_ptr);
case clang::Type::Elaborated:
return ClangASTContext::GetFieldAtIndex (ast,
cast(qual_type)->getNamedType().getAsOpaquePtr(),
idx,
name,
- byte_offset_ptr);
+ bit_offset_ptr);
default:
break;
Modified: lldb/trunk/source/Symbol/ClangASTType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTType.cpp?rev=144493&r1=144492&r2=144493&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTType.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTType.cpp Sun Nov 13 00:57:31 2011
@@ -1272,46 +1272,64 @@
llvm::SmallVector buf;
llvm::raw_svector_ostream llvm_ostrm (buf);
- const clang::TagType *tag_type = llvm::dyn_cast(qual_type.getTypePtr());
- if (tag_type)
+ const clang::Type::TypeClass type_class = qual_type->getTypeClass();
+ switch (type_class)
{
- clang::TagDecl *tag_decl = tag_type->getDecl();
- if (tag_decl)
- tag_decl->print(llvm_ostrm, 0);
- }
- else
- {
- const clang::Type::TypeClass type_class = qual_type->getTypeClass();
- switch (type_class)
+ case clang::Type::ObjCObject:
+ case clang::Type::ObjCInterface:
+ if (ClangASTContext::GetCompleteType (ast_context, clang_type))
{
- case clang::Type::ObjCObject:
- case clang::Type::ObjCInterface:
- {
- const clang::ObjCObjectType *objc_class_type = llvm::dyn_cast(qual_type.getTypePtr());
- assert (objc_class_type);
- if (objc_class_type)
- {
- clang::ObjCInterfaceDecl *class_interface_decl = objc_class_type->getInterface();
- if (class_interface_decl)
- class_interface_decl->print(llvm_ostrm, ast_context->getPrintingPolicy(), s->GetIndentLevel());
- }
+ const clang::ObjCObjectType *objc_class_type = llvm::dyn_cast(qual_type.getTypePtr());
+ assert (objc_class_type);
+ if (objc_class_type)
+ {
+ clang::ObjCInterfaceDecl *class_interface_decl = objc_class_type->getInterface();
+ if (class_interface_decl)
+ class_interface_decl->print(llvm_ostrm, ast_context->getPrintingPolicy(), s->GetIndentLevel());
}
- break;
-
- case clang::Type::Typedef:
+ }
+ break;
+
+ case clang::Type::Typedef:
+ {
+ const clang::TypedefType *typedef_type = qual_type->getAs();
+ if (typedef_type)
{
- const clang::TypedefType *typedef_type = qual_type->getAs();
- if (typedef_type)
+ const clang::TypedefNameDecl *typedef_decl = typedef_type->getDecl();
+ std::string clang_typedef_name (typedef_decl->getQualifiedNameAsString());
+ if (!clang_typedef_name.empty())
{
- const clang::TypedefNameDecl *typedef_decl = typedef_type->getDecl();
- std::string clang_typedef_name (typedef_decl->getQualifiedNameAsString());
- if (!clang_typedef_name.empty())
- s->PutCString (clang_typedef_name.c_str());
+ s->PutCString ("typedef ");
+ s->PutCString (clang_typedef_name.c_str());
}
}
- break;
+ }
+ break;
- default:
+ case clang::Type::Record:
+ if (ClangASTContext::GetCompleteType (ast_context, clang_type))
+ {
+ const clang::RecordType *record_type = llvm::cast(qual_type.getTypePtr());
+ const clang::RecordDecl *record_decl = record_type->getDecl();
+ const clang::CXXRecordDecl *cxx_record_decl = llvm::dyn_cast(record_decl);
+
+ if (cxx_record_decl)
+ cxx_record_decl->print(llvm_ostrm, ast_context->getPrintingPolicy(), s->GetIndentLevel());
+ else
+ record_decl->print(llvm_ostrm, ast_context->getPrintingPolicy(), s->GetIndentLevel());
+ }
+ break;
+
+ default:
+ {
+ const clang::TagType *tag_type = llvm::dyn_cast(qual_type.getTypePtr());
+ if (tag_type)
+ {
+ clang::TagDecl *tag_decl = tag_type->getDecl();
+ if (tag_decl)
+ tag_decl->print(llvm_ostrm, 0);
+ }
+ else
{
std::string clang_type_name(qual_type.getAsString());
if (!clang_type_name.empty())
Modified: lldb/trunk/source/Symbol/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Type.cpp?rev=144493&r1=144492&r2=144493&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Type.cpp (original)
+++ lldb/trunk/source/Symbol/Type.cpp Sun Nov 13 00:57:31 2011
@@ -777,3 +777,21 @@
return m_clang_ast_type.GetOpaqueQualType();
}
+
+bool
+TypeImpl::GetDescription (lldb_private::Stream &strm,
+ lldb::DescriptionLevel description_level)
+{
+ if (m_clang_ast_type.IsValid())
+ {
+ ClangASTType::DumpTypeDescription (m_clang_ast_type.GetASTContext(),
+ m_clang_ast_type.GetOpaqueQualType(),
+ &strm);
+ }
+ else
+ {
+ strm.PutCString ("No value");
+ }
+ return true;
+}
+