[Lldb-commits] [lldb] r137338 - in /lldb/trunk: lldb.xcodeproj/project.pbxproj llvm.zip scripts/build-llvm.pl scripts/checkpoint-llvm.pl test/lang/c/function_types/TestFunctionTypes.py
Sean Callanan
scallanan at apple.com
Thu Aug 11 13:11:19 PDT 2011
Author: spyffe
Date: Thu Aug 11 15:11:18 2011
New Revision: 137338
URL: http://llvm.org/viewvc/llvm-project?rev=137338&view=rev
Log:
Updated LLVM/Clang to to pick up fixes for a
problem in which the following cast:
–
expr (int (*)(const char*, ...))printf
-
caused a crash. This had several causes:
- First, Clang did not support implicit
casts of a function of unknown type to
a function pointer.
- Second, after this was fixed, the
Clang AST importer did not support
importing function pointer types
produced by resolving these casts.
These two problems are now resolved, and
I have added a test case to verify that
they work. I also did a little bit of
build-system cleanup because we now use
libEnhancedDisassembly.a instead of the
.dylib.
Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/llvm.zip
lldb/trunk/scripts/build-llvm.pl
lldb/trunk/scripts/checkpoint-llvm.pl
lldb/trunk/test/lang/c/function_types/TestFunctionTypes.py
Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=137338&r1=137337&r2=137338&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu Aug 11 15:11:18 2011
@@ -2842,7 +2842,6 @@
);
name = "Build llvm and clang";
outputPaths = (
- "$(CONFIGURATION_BUILD_DIR)/libEnhancedDisassembly.dylib",
"$(LLVM_BUILD_DIR)/libllvmclang.a",
);
runOnlyForDeploymentPostprocessing = 0;
Modified: lldb/trunk/llvm.zip
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/llvm.zip?rev=137338&r1=137337&r2=137338&view=diff
==============================================================================
Binary files - no diff available.
Modified: lldb/trunk/scripts/build-llvm.pl
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/build-llvm.pl?rev=137338&r1=137337&r2=137338&view=diff
==============================================================================
--- lldb/trunk/scripts/build-llvm.pl (original)
+++ lldb/trunk/scripts/build-llvm.pl Thu Aug 11 15:11:18 2011
@@ -16,13 +16,13 @@
our $llvm_srcroot = $ENV{SCRIPT_INPUT_FILE_0};
our $llvm_dstroot = $ENV{SCRIPT_INPUT_FILE_1};
-our $llvm_clang_outfile = $ENV{SCRIPT_OUTPUT_FILE_1};
+our $llvm_clang_outfile = $ENV{SCRIPT_OUTPUT_FILE_0};
our ($llvm_clang_basename, $llvm_clang_dirname) = fileparse ($llvm_clang_outfile);
our @llvm_clang_slices; # paths to the single architecture static libraries (archives)
our $llvm_configuration = $ENV{LLVM_CONFIGURATION};
-our $llvm_revision = "136552";
+our $llvm_revision = "137311";
our $llvm_source_dir = "$ENV{SRCROOT}";
our @archs = split (/\s+/, $ENV{ARCHS});
Modified: lldb/trunk/scripts/checkpoint-llvm.pl
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/checkpoint-llvm.pl?rev=137338&r1=137337&r2=137338&view=diff
==============================================================================
--- lldb/trunk/scripts/checkpoint-llvm.pl (original)
+++ lldb/trunk/scripts/checkpoint-llvm.pl Thu Aug 11 15:11:18 2011
@@ -90,7 +90,6 @@
}
do_command ("cp '$llvm_build_dir/libllvmclang.a' '$llvm_checkpoint_dir'", "Copying libllvmclang.a", 1);
- do_command ("cp '$lldb_build_dir/libEnhancedDisassembly.dylib' '$llvm_checkpoint_dir'", "Copying libEnhancedDisassembly.dylib", 1);
do_command ("rm -rf '$llvm_zip_file'", "Removing old llvm checkpoint file '$llvm_zip_file'", 1);
do_command ("(cd '$temp_dir' ; zip -r '$llvm_zip_file' 'llvm')", "Zipping llvm checkpoint directory '$llvm_checkpoint_dir' to '$llvm_zip_file'", 1);
}
Modified: lldb/trunk/test/lang/c/function_types/TestFunctionTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/c/function_types/TestFunctionTypes.py?rev=137338&r1=137337&r2=137338&view=diff
==============================================================================
--- lldb/trunk/test/lang/c/function_types/TestFunctionTypes.py (original)
+++ lldb/trunk/test/lang/c/function_types/TestFunctionTypes.py Thu Aug 11 15:11:18 2011
@@ -19,6 +19,17 @@
"""Test 'callback' has function ptr type, then break on the function."""
self.buildDwarf()
self.function_types()
+
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ def test_pointers_with_dsym(self):
+ """Test that a function pointer to 'printf' works and can be called."""
+ self.buildDsym()
+ self.function_pointers()
+
+ def test_pointers_with_dwarf(self):
+ """Test that a function pointer to 'printf' works and can be called."""
+ self.buildDwarf()
+ self.function_pointers()
def setUp(self):
# Call super's setUp().
@@ -26,27 +37,31 @@
# Find the line number to break inside main().
self.line = line_number('main.c', '// Set break point at this line.')
- def function_types(self):
- """Test 'callback' has function ptr type, then break on the function."""
+ def runToBreakpoint(self):
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
-
+
# Break inside the main.
self.expect("breakpoint set -f main.c -l %d" % self.line,
BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.c', line = %d, locations = 1" %
- self.line)
-
+ startstr = "Breakpoint created: 1: file ='main.c', line = %d, locations = 1" %
+ self.line)
+
self.runCmd("run", RUN_SUCCEEDED)
-
+
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
-
+ substrs = ['stopped',
+ 'stop reason = breakpoint'])
+
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs = [' resolved, hit count = 1'])
+
+ def function_types(self):
+ """Test 'callback' has function ptr type, then break on the function."""
+
+ self.runToBreakpoint()
# Check that the 'callback' variable display properly.
self.expect("frame variable -T callback", VARIABLES_DISPLAYED_CORRECTLY,
@@ -61,6 +76,19 @@
substrs = ['a.out`string_not_empty',
'stop reason = breakpoint'])
+ def function_pointers(self):
+ """Test that a function pointer to 'printf' works and can be called."""
+
+ self.runToBreakpoint()
+
+ self.expect("expr string_not_empty",
+ substrs = ['(int (*)(const char *)) $0 = ', '(a.out`'])
+
+ self.expect("expr (int (*)(const char*, ...))printf",
+ substrs = ['(int (*)(const char *, ...)) $1 = ', '(libSystem.'])
+
+ self.expect("expr $1(\"Hello world\\n\")",
+ startstr = '(int) $2 = 12')
if __name__ == '__main__':
import atexit
More information about the lldb-commits
mailing list