From johnny.chen at apple.com Mon Dec 19 13:38:10 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 19 Dec 2011 19:38:10 -0000 Subject: [Lldb-commits] [lldb] r146890 - in /lldb/trunk: scripts/Python/interface/SBThread.i test/python_api/thread/TestThreadAPI.py Message-ID: <20111219193810.2C3B51BE003@llvm.org> Author: johnny Date: Mon Dec 19 13:38:09 2011 New Revision: 146890 URL: http://llvm.org/viewvc/llvm-project?rev=146890&view=rev Log: Fix Python docstring for SBThread.GetStopDescription(). Modified: lldb/trunk/scripts/Python/interface/SBThread.i lldb/trunk/test/python_api/thread/TestThreadAPI.py Modified: lldb/trunk/scripts/Python/interface/SBThread.i URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBThread.i?rev=146890&r1=146889&r2=146890&view=diff ============================================================================== --- lldb/trunk/scripts/Python/interface/SBThread.i (original) +++ lldb/trunk/scripts/Python/interface/SBThread.i Mon Dec 19 13:38:09 2011 @@ -79,6 +79,10 @@ uint64_t GetStopReasonDataAtIndex(uint32_t idx); + %feature("autodoc", " + Pass only an (int)length and expect to get a Python string describing the + stop reason. + ") GetStopDescription; size_t GetStopDescription (char *dst, size_t dst_len); Modified: lldb/trunk/test/python_api/thread/TestThreadAPI.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/thread/TestThreadAPI.py?rev=146890&r1=146889&r2=146890&view=diff ============================================================================== --- lldb/trunk/test/python_api/thread/TestThreadAPI.py (original) +++ lldb/trunk/test/python_api/thread/TestThreadAPI.py Mon Dec 19 13:38:09 2011 @@ -148,7 +148,7 @@ #self.runCmd("process status") # Due to the typemap magic (see lldb.swig), we pass in an (int)length to GetStopDescription - # and expect to get a Python string as the result object! + # and expect to get a Python string as the return object! # The 100 is just an arbitrary number specifying the buffer size. stop_description = thread.GetStopDescription(100) self.expect(stop_description, exe=False, From scallanan at apple.com Mon Dec 19 13:38:39 2011 From: scallanan at apple.com (Sean Callanan) Date: Mon, 19 Dec 2011 19:38:39 -0000 Subject: [Lldb-commits] [lldb] r146891 - in /lldb/trunk: source/Expression/ClangASTSource.cpp test/lang/objc/objc-builtin-types/ test/lang/objc/objc-builtin-types/Makefile test/lang/objc/objc-builtin-types/TestObjCBuiltinTypes.py test/lang/objc/objc-builtin-types/main.cpp Message-ID: <20111219193839.BD1661BE003@llvm.org> Author: spyffe Date: Mon Dec 19 13:38:39 2011 New Revision: 146891 URL: http://llvm.org/viewvc/llvm-project?rev=146891&view=rev Log: Added some strength to the checks that prevent "id" from being found by the parser as an externally-defined type. Before, "id" would sometimes make it through if it was defined in a namespace, but this sometimes caused confusion, for example when it conflicted with std::locale::id. Added: lldb/trunk/test/lang/objc/objc-builtin-types/ lldb/trunk/test/lang/objc/objc-builtin-types/Makefile lldb/trunk/test/lang/objc/objc-builtin-types/TestObjCBuiltinTypes.py lldb/trunk/test/lang/objc/objc-builtin-types/main.cpp Modified: lldb/trunk/source/Expression/ClangASTSource.cpp Modified: lldb/trunk/source/Expression/ClangASTSource.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangASTSource.cpp?rev=146891&r1=146890&r2=146891&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangASTSource.cpp (original) +++ lldb/trunk/source/Expression/ClangASTSource.cpp Mon Dec 19 13:38:39 2011 @@ -574,12 +574,13 @@ TypeList types; SymbolContext null_sc; + if (name == id_name || name == Class_name) + break; + if (module_sp && namespace_decl) module_sp->FindTypes(null_sc, name, &namespace_decl, true, 1, types); - else if(name != id_name && name != Class_name) + else m_target->GetImages().FindTypes(null_sc, name, true, 1, types); - else - break; if (types.GetSize()) { Added: lldb/trunk/test/lang/objc/objc-builtin-types/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/objc-builtin-types/Makefile?rev=146891&view=auto ============================================================================== --- lldb/trunk/test/lang/objc/objc-builtin-types/Makefile (added) +++ lldb/trunk/test/lang/objc/objc-builtin-types/Makefile Mon Dec 19 13:38:39 2011 @@ -0,0 +1,5 @@ +LEVEL = ../../../make + +CXX_SOURCES := main.cpp + +include $(LEVEL)/Makefile.rules Added: lldb/trunk/test/lang/objc/objc-builtin-types/TestObjCBuiltinTypes.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/objc-builtin-types/TestObjCBuiltinTypes.py?rev=146891&view=auto ============================================================================== --- lldb/trunk/test/lang/objc/objc-builtin-types/TestObjCBuiltinTypes.py (added) +++ lldb/trunk/test/lang/objc/objc-builtin-types/TestObjCBuiltinTypes.py Mon Dec 19 13:38:39 2011 @@ -0,0 +1,69 @@ +"""Test that the expression parser doesn't get confused by 'id' and 'Class'""" + +import os, time +import unittest2 +import lldb +import lldbutil +from lldbtest import * + +class TestObjCBuiltinTypes(TestBase): + + mydir = os.path.join("lang", "objc", "objc-builtin-types") + + @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") + @python_api_test + + def test_with_dsym_and_python_api(self): + """Test expression parser respect for ObjC built-in types.""" + self.buildDsym() + self.objc_builtin_types() + + @python_api_test + def test_with_dwarf_and_python_api(self): + """Test expression parser respect for ObjC built-in types.""" + self.buildDwarf() + self.objc_builtin_types() + + def setUp(self): + # Call super's setUp(). + TestBase.setUp(self) + # Find the line numbers to break inside main(). + self.main_source = "main.cpp" + self.break_line = line_number(self.main_source, '// Set breakpoint here.') + + # [regression] Can't print ivar value: error: reference to 'id' is ambiguous + def objc_builtin_types(self): + """Test expression parser respect for ObjC built-in types.""" + exe = os.path.join(os.getcwd(), "a.out") + + target = self.dbg.CreateTarget(exe) + self.assertTrue(target, VALID_TARGET) + + bpt = target.BreakpointCreateByLocation(self.main_source, self.break_line) + self.assertTrue(bpt, VALID_BREAKPOINT) + + # Now launch the process, and do not stop at entry point. + process = target.LaunchSimple (None, None, os.getcwd()) + + self.assertTrue(process, PROCESS_IS_VALID) + + # The stop reason of the thread should be breakpoint. + thread_list = lldbutil.get_threads_stopped_at_breakpoint (process, bpt) + + # Make sure we stopped at the first breakpoint. + self.assertTrue (len(thread_list) != 0, "No thread stopped at our breakpoint.") + self.assertTrue (len(thread_list) == 1, "More than one thread stopped at our breakpoint.") + + # Now make sure we can call a function in the class method we've stopped in. + frame = thread_list[0].GetFrameAtIndex(0) + self.assertTrue (frame, "Got a valid frame 0 frame.") + + self.expect("expr (foo)", patterns = ["\(ns::id\) \$.* = 0"]) + + self.expect("expr id my_id = 0; my_id", patterns = ["\(id\) \$.* = 0x0"]) + +if __name__ == '__main__': + import atexit + lldb.SBDebugger.Initialize() + atexit.register(lambda: lldb.SBDebugger.Terminate()) + unittest2.main() Added: lldb/trunk/test/lang/objc/objc-builtin-types/main.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/objc-builtin-types/main.cpp?rev=146891&view=auto ============================================================================== --- lldb/trunk/test/lang/objc/objc-builtin-types/main.cpp (added) +++ lldb/trunk/test/lang/objc/objc-builtin-types/main.cpp Mon Dec 19 13:38:39 2011 @@ -0,0 +1,9 @@ +namespace ns { + typedef int id; +}; + +int main() +{ + ns::id foo = 0; + return foo; // Set breakpoint here. +} From johnny.chen at apple.com Mon Dec 19 14:16:22 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 19 Dec 2011 20:16:22 -0000 Subject: [Lldb-commits] [lldb] r146899 - in /lldb/trunk: source/API/SBModule.cpp source/API/SBSection.cpp test/python_api/module_section/TestModuleAndSection.py Message-ID: <20111219201622.9C6851BE003@llvm.org> Author: johnny Date: Mon Dec 19 14:16:22 2011 New Revision: 146899 URL: http://llvm.org/viewvc/llvm-project?rev=146899&view=rev Log: Work in progress for: rdar://problem/10577182 Audit lldb API impl for places where we need to perform a NULL check Add NULL checks for SBModule and SBSection APIs. Modified: lldb/trunk/source/API/SBModule.cpp lldb/trunk/source/API/SBSection.cpp lldb/trunk/test/python_api/module_section/TestModuleAndSection.py Modified: lldb/trunk/source/API/SBModule.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBModule.cpp?rev=146899&r1=146898&r2=146899&view=diff ============================================================================== --- lldb/trunk/source/API/SBModule.cpp (original) +++ lldb/trunk/source/API/SBModule.cpp Mon Dec 19 14:16:22 2011 @@ -342,7 +342,7 @@ { if (!append) sc_list.Clear(); - if (m_opaque_sp) + if (name && m_opaque_sp) { const bool symbols_ok = true; return m_opaque_sp->FindFunctions (ConstString(name), @@ -360,7 +360,7 @@ SBModule::FindGlobalVariables (SBTarget &target, const char *name, uint32_t max_matches) { SBValueList sb_value_list; - if (m_opaque_sp) + if (name && m_opaque_sp) { VariableList variable_list; const uint32_t match_count = m_opaque_sp->FindGlobalVariables (ConstString (name), @@ -389,10 +389,10 @@ } lldb::SBType -SBModule::FindFirstType (const char* name_cstr) +SBModule::FindFirstType (const char *name_cstr) { SBType sb_type; - if (IsValid()) + if (name_cstr && IsValid()) { SymbolContext sc; TypeList type_list; @@ -413,12 +413,12 @@ } lldb::SBTypeList -SBModule::FindTypes (const char* type) +SBModule::FindTypes (const char *type) { SBTypeList retval; - if (IsValid()) + if (type && IsValid()) { SymbolContext sc; TypeList type_list; @@ -449,7 +449,7 @@ { SBSection sb_section; - if (IsValid()) + if (sect_name && IsValid()) { ObjectFile *objfile = m_opaque_sp->GetObjectFile(); if (objfile) Modified: lldb/trunk/source/API/SBSection.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSection.cpp?rev=146899&r1=146898&r2=146899&view=diff ============================================================================== --- lldb/trunk/source/API/SBSection.cpp (original) +++ lldb/trunk/source/API/SBSection.cpp Mon Dec 19 14:16:22 2011 @@ -142,7 +142,7 @@ SBSection::FindSubSection (const char *sect_name) { lldb::SBSection sb_section; - if (IsValid()) + if (sect_name && IsValid()) { ConstString const_sect_name(sect_name); sb_section.SetSection(m_opaque_ap->GetSection()->GetChildren ().FindSectionByName(const_sect_name).get()); Modified: lldb/trunk/test/python_api/module_section/TestModuleAndSection.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/module_section/TestModuleAndSection.py?rev=146899&r1=146898&r2=146899&view=diff ============================================================================== --- lldb/trunk/test/python_api/module_section/TestModuleAndSection.py (original) +++ lldb/trunk/test/python_api/module_section/TestModuleAndSection.py Mon Dec 19 14:16:22 2011 @@ -19,6 +19,12 @@ self.buildDefault() self.module_and_section() + @python_api_test + def test_module_and_section_boundary_condition(self): + """Test module and section APIs by passing None when it expects a Python string.""" + self.buildDefault() + self.module_and_section_boundary_condition() + def module_and_section(self): exe = os.path.join(os.getcwd(), "a.out") @@ -56,6 +62,43 @@ print INDENT2 + repr(sym) print INDENT2 + "symbol type: %s" % symbol_type_to_str(sym.GetType()) + def module_and_section_boundary_condition(self): + exe = os.path.join(os.getcwd(), "a.out") + + target = self.dbg.CreateTarget(exe) + self.assertTrue(target, VALID_TARGET) + self.assertTrue(target.GetNumModules() > 0) + + # Hide stdout if not running with '-t' option. + if not self.TraceOn(): + self.HideStdout() + + print "Number of modules for the target: %d" % target.GetNumModules() + for module in target.module_iter(): + print module + + # Get the executable module at index 0. + exe_module = target.GetModuleAtIndex(0) + + print "Exe module: %s" % repr(exe_module) + print "Number of sections: %d" % exe_module.GetNumSections() + + # Boundary condition testings. Should not crash lldb! + exe_module.FindFirstType(None) + exe_module.FindTypes(None) + exe_module.FindGlobalVariables(target, None, 1) + exe_module.FindFunctions(None, 0, True, lldb.SBSymbolContextList()) + exe_module.FindSection(None) + + # Get the section at index 1. + if exe_module.GetNumSections() > 1: + sec1 = exe_module.GetSectionAtIndex(1) + print sec1 + else: + sec1 = None + + if sec1: + sec1.FindSubSection(None) if __name__ == '__main__': import atexit From jingham at apple.com Mon Dec 19 14:39:45 2011 From: jingham at apple.com (Jim Ingham) Date: Mon, 19 Dec 2011 20:39:45 -0000 Subject: [Lldb-commits] [lldb] r146902 - in /lldb/trunk: include/lldb/API/SBModule.h include/lldb/API/SBValue.h include/lldb/API/SBValueList.h scripts/Python/interface/SBModule.i scripts/Python/interface/SBValue.i scripts/Python/interface/SBValueList.i source/API/SBModule.cpp source/API/SBValue.cpp source/API/SBValueList.cpp Message-ID: <20111219203945.4EF851BE003@llvm.org> Author: jingham Date: Mon Dec 19 14:39:44 2011 New Revision: 146902 URL: http://llvm.org/viewvc/llvm-project?rev=146902&view=rev Log: Add needed Clear methods. Modified: lldb/trunk/include/lldb/API/SBModule.h lldb/trunk/include/lldb/API/SBValue.h lldb/trunk/include/lldb/API/SBValueList.h lldb/trunk/scripts/Python/interface/SBModule.i lldb/trunk/scripts/Python/interface/SBValue.i lldb/trunk/scripts/Python/interface/SBValueList.i lldb/trunk/source/API/SBModule.cpp lldb/trunk/source/API/SBValue.cpp lldb/trunk/source/API/SBValueList.cpp Modified: lldb/trunk/include/lldb/API/SBModule.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBModule.h?rev=146902&r1=146901&r2=146902&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBModule.h (original) +++ lldb/trunk/include/lldb/API/SBModule.h Mon Dec 19 14:39:44 2011 @@ -36,6 +36,9 @@ bool IsValid () const; + void + Clear(); + //------------------------------------------------------------------ /// Get const accessor for the module file specification. /// @@ -166,7 +169,7 @@ lldb::SBTypeList FindTypes (const char* type); - + private: friend class SBAddress; friend class SBFrame; Modified: lldb/trunk/include/lldb/API/SBValue.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBValue.h?rev=146902&r1=146901&r2=146902&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBValue.h (original) +++ lldb/trunk/include/lldb/API/SBValue.h Mon Dec 19 14:39:44 2011 @@ -34,6 +34,9 @@ bool IsValid(); + void + Clear(); + SBError GetError(); Modified: lldb/trunk/include/lldb/API/SBValueList.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBValueList.h?rev=146902&r1=146901&r2=146902&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBValueList.h (original) +++ lldb/trunk/include/lldb/API/SBValueList.h Mon Dec 19 14:39:44 2011 @@ -26,6 +26,9 @@ bool IsValid() const; + + void + Clear(); void Append (const lldb::SBValue &val_obj); Modified: lldb/trunk/scripts/Python/interface/SBModule.i URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBModule.i?rev=146902&r1=146901&r2=146902&view=diff ============================================================================== --- lldb/trunk/scripts/Python/interface/SBModule.i (original) +++ lldb/trunk/scripts/Python/interface/SBModule.i Mon Dec 19 14:39:44 2011 @@ -103,6 +103,9 @@ bool IsValid () const; + void + Clear(); + %feature("docstring", " //------------------------------------------------------------------ /// Get const accessor for the module file specification. Modified: lldb/trunk/scripts/Python/interface/SBValue.i URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBValue.i?rev=146902&r1=146901&r2=146902&view=diff ============================================================================== --- lldb/trunk/scripts/Python/interface/SBValue.i (original) +++ lldb/trunk/scripts/Python/interface/SBValue.i Mon Dec 19 14:39:44 2011 @@ -67,6 +67,9 @@ bool IsValid(); + void + Clear(); + SBError GetError(); Modified: lldb/trunk/scripts/Python/interface/SBValueList.i URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBValueList.i?rev=146902&r1=146901&r2=146902&view=diff ============================================================================== --- lldb/trunk/scripts/Python/interface/SBValueList.i (original) +++ lldb/trunk/scripts/Python/interface/SBValueList.i Mon Dec 19 14:39:44 2011 @@ -78,6 +78,9 @@ bool IsValid() const; + + void + Clear(); void Append (const lldb::SBValue &val_obj); Modified: lldb/trunk/source/API/SBModule.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBModule.cpp?rev=146902&r1=146901&r2=146902&view=diff ============================================================================== --- lldb/trunk/source/API/SBModule.cpp (original) +++ lldb/trunk/source/API/SBModule.cpp Mon Dec 19 14:39:44 2011 @@ -58,6 +58,12 @@ return m_opaque_sp.get() != NULL; } +void +SBModule::Clear() +{ + m_opaque_sp.reset(); +} + SBFileSpec SBModule::GetFileSpec () const { Modified: lldb/trunk/source/API/SBValue.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValue.cpp?rev=146902&r1=146901&r2=146902&view=diff ============================================================================== --- lldb/trunk/source/API/SBValue.cpp (original) +++ lldb/trunk/source/API/SBValue.cpp Mon Dec 19 14:39:44 2011 @@ -75,6 +75,12 @@ return m_opaque_sp.get() != NULL; } +void +SBValue::Clear() +{ + m_opaque_sp.reset(); +} + SBError SBValue::GetError() { Modified: lldb/trunk/source/API/SBValueList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValueList.cpp?rev=146902&r1=146901&r2=146902&view=diff ============================================================================== --- lldb/trunk/source/API/SBValueList.cpp (original) +++ lldb/trunk/source/API/SBValueList.cpp Mon Dec 19 14:39:44 2011 @@ -64,6 +64,12 @@ return (m_opaque_ap.get() != NULL); } +void +SBValueList::Clear() +{ + m_opaque_ap.reset(); +} + const SBValueList & SBValueList::operator = (const SBValueList &rhs) { From bugzilla-daemon at llvm.org Mon Dec 19 15:05:50 2011 From: bugzilla-daemon at llvm.org (bugzilla-daemon at llvm.org) Date: Mon, 19 Dec 2011 21:05:50 +0000 Subject: [Lldb-commits] [Bug 11618] New: lldb::SBValue::AddressOf does not work on dereferenced registers in synthetic children provider Message-ID: http://llvm.org/bugs/show_bug.cgi?id=11618 Bug #: 11618 Summary: lldb::SBValue::AddressOf does not work on dereferenced registers in synthetic children provider Product: lldb Version: unspecified Platform: Macintosh OS/Version: MacOS X Status: NEW Severity: normal Priority: P Component: All Bugs AssignedTo: lldb-commits at cs.uiuc.edu ReportedBy: nathanhowell at hotmail.com Classification: Unclassified The AddressOf operator now works properly on integers and local variables but doesn't seem to work with registers. (lldb) register read r14 r14 = 0x0000000100504151 # works properly here using the value in the register (lldb) print *(StgClosure*)0x0000000100504151 (StgClosure) $7 = { (StgInfoTable_) base_GHC.Arr_STArray_con_info = { (StgHalfWord) type = 1 (char *) &description = 0x00000001000eceb0 "base:GHC.Arr.STArray" } (StgClosure) *arg0 = { (StgInfoTable_) ghc-prim_GHC.Types_I#_static_info = { (StgHalfWord) type = 8 (char *) &description = 0x00000001000efeb8 "ghc-prim:GHC.Types.I#" } (unsigned long) arg0 = 0 } (StgClosure) *arg1 = { (StgInfoTable_) ghc-prim_GHC.Types_I#_static_info = { (StgHalfWord) type = 8 (char *) &description = 0x00000001000efeb8 "ghc-prim:GHC.Types.I#" } (unsigned long) arg0 = 64 } (StgClosure) *arg2 = { (StgInfoTable_) stg_MUT_ARR_PTRS_DIRTY_info = { (StgHalfWord) type = 46 } } (unsigned long) arg3 = 65 } # but not when using the register directly (lldb) print *(StgClosure*)$r14 Traceback (most recent call last): File "/Source/ghc-lldb/ghc.py", line 10, in __init__ assert valobj.AddressOf(), 'valobj.AddressOf() == None' AssertionError: valobj.AddressOf() == None (StgClosure) $8 = {} -- Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. From johnny.chen at apple.com Mon Dec 19 15:16:29 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 19 Dec 2011 21:16:29 -0000 Subject: [Lldb-commits] [lldb] r146909 - in /lldb/trunk: source/API/SBCommandInterpreter.cpp test/python_api/interpreter/TestCommandInterpreterAPI.py Message-ID: <20111219211629.DA1691BE003@llvm.org> Author: johnny Date: Mon Dec 19 15:16:29 2011 New Revision: 146909 URL: http://llvm.org/viewvc/llvm-project?rev=146909&view=rev Log: Work in progress for: rdar://problem/10577182 Audit lldb API impl for places where we need to perform a NULL check Add NULL checks for SBCommandInterpreter APIs. Modified: lldb/trunk/source/API/SBCommandInterpreter.cpp lldb/trunk/test/python_api/interpreter/TestCommandInterpreterAPI.py Modified: lldb/trunk/source/API/SBCommandInterpreter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandInterpreter.cpp?rev=146909&r1=146908&r2=146909&view=diff ============================================================================== --- lldb/trunk/source/API/SBCommandInterpreter.cpp (original) +++ lldb/trunk/source/API/SBCommandInterpreter.cpp Mon Dec 19 15:16:29 2011 @@ -65,7 +65,7 @@ bool SBCommandInterpreter::CommandExists (const char *cmd) { - if (m_opaque_ptr) + if (cmd && m_opaque_ptr) return m_opaque_ptr->CommandExists (cmd); return false; } @@ -73,7 +73,7 @@ bool SBCommandInterpreter::AliasExists (const char *cmd) { - if (m_opaque_ptr) + if (cmd && m_opaque_ptr) return m_opaque_ptr->AliasExists (cmd); return false; } @@ -88,7 +88,7 @@ m_opaque_ptr, command_line, result.get(), add_to_history); result.Clear(); - if (m_opaque_ptr) + if (command_line && m_opaque_ptr) { TargetSP target_sp(m_opaque_ptr->GetDebugger().GetSelectedTarget()); Mutex::Locker api_locker; @@ -98,7 +98,7 @@ } else { - result->AppendError ("SBCommandInterpreter is not valid"); + result->AppendError ("SBCommandInterpreter or the command line is not valid"); result->SetStatus (eReturnStatusFailed); } Modified: lldb/trunk/test/python_api/interpreter/TestCommandInterpreterAPI.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/interpreter/TestCommandInterpreterAPI.py?rev=146909&r1=146908&r2=146909&view=diff ============================================================================== --- lldb/trunk/test/python_api/interpreter/TestCommandInterpreterAPI.py (original) +++ lldb/trunk/test/python_api/interpreter/TestCommandInterpreterAPI.py Mon Dec 19 15:16:29 2011 @@ -59,6 +59,12 @@ ci.HandleCommand("process launch", res) self.assertTrue(res.Succeeded()) + # Boundary conditions should not crash lldb! + self.assertFalse(ci.CommandExists(None)) + self.assertFalse(ci.AliasExists(None)) + ci.HandleCommand(None, res) + self.assertFalse(res.Succeeded()) + process = ci.GetProcess() self.assertTrue(process) From bugzilla-daemon at llvm.org Mon Dec 19 15:25:08 2011 From: bugzilla-daemon at llvm.org (bugzilla-daemon at llvm.org) Date: Mon, 19 Dec 2011 21:25:08 +0000 Subject: [Lldb-commits] [Bug 11619] New: Allow creating SBData values from arrays or primitives in Python Message-ID: http://llvm.org/bugs/show_bug.cgi?id=11619 Bug #: 11619 Summary: Allow creating SBData values from arrays or primitives in Python Product: lldb Version: unspecified Platform: Macintosh OS/Version: MacOS X Status: NEW Severity: enhancement Priority: P Component: All Bugs AssignedTo: lldb-commits at cs.uiuc.edu ReportedBy: nathanhowell at hotmail.com Classification: Unclassified I'd like to create string literals or other values that do not exist within the inferior process, perhaps like this: char_ptr_type = type.GetBasicType(lldb.eBasicTypeChar).GetPointerType() data = target.GetDataFromCString('some string literal') value = obj.CreateValueFromData('name', data, char_ptr_type) The idea would be to allow a SyntheticChildrenProvider to fashion a new value that better represents the original child value being inspected. -- Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. From johnny.chen at apple.com Mon Dec 19 15:36:24 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 19 Dec 2011 21:36:24 -0000 Subject: [Lldb-commits] [lldb] r146911 - in /lldb/trunk: source/Interpreter/CommandReturnObject.cpp test/python_api/interpreter/TestCommandInterpreterAPI.py Message-ID: <20111219213624.110A41BE003@llvm.org> Author: johnny Date: Mon Dec 19 15:36:23 2011 New Revision: 146911 URL: http://llvm.org/viewvc/llvm-project?rev=146911&view=rev Log: Work in progress for: rdar://problem/10577182 Audit lldb API impl for places where we need to perform a NULL check Add NULL checks for SBCommandReturnObject.AppendMessage(). Modified: lldb/trunk/source/Interpreter/CommandReturnObject.cpp lldb/trunk/test/python_api/interpreter/TestCommandInterpreterAPI.py Modified: lldb/trunk/source/Interpreter/CommandReturnObject.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandReturnObject.cpp?rev=146911&r1=146910&r2=146911&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/CommandReturnObject.cpp (original) +++ lldb/trunk/source/Interpreter/CommandReturnObject.cpp Mon Dec 19 15:36:23 2011 @@ -57,6 +57,8 @@ void CommandReturnObject::AppendErrorWithFormat (const char *format, ...) { + if (!format) + return; va_list args; va_start (args, format); StreamString sstrm; @@ -76,6 +78,8 @@ void CommandReturnObject::AppendMessageWithFormat (const char *format, ...) { + if (!format) + return; va_list args; va_start (args, format); StreamString sstrm; @@ -88,6 +92,8 @@ void CommandReturnObject::AppendWarningWithFormat (const char *format, ...) { + if (!format) + return; va_list args; va_start (args, format); StreamString sstrm; @@ -100,6 +106,8 @@ void CommandReturnObject::AppendMessage (const char *in_string, int len) { + if (!in_string) + return; if (len < 0) len = ::strlen (in_string); GetOutputStream().Printf("%*.*s\n", len, len, in_string); @@ -108,6 +116,8 @@ void CommandReturnObject::AppendWarning (const char *in_string, int len) { + if (!in_string) + return; if (len < 0) len = ::strlen (in_string); GetErrorStream().Printf("warning: %*.*s\n", len, len, in_string); @@ -119,6 +129,8 @@ void CommandReturnObject::AppendRawWarning (const char *in_string, int len) { + if (!in_string) + return; if (len < 0) len = ::strlen (in_string); GetErrorStream().Printf("%*.*s", len, len, in_string); @@ -129,7 +141,6 @@ { if (!in_string) return; - if (len < 0) len = ::strlen (in_string); GetErrorStream().Printf ("error: %*.*s\n", len, len, in_string); @@ -150,6 +161,8 @@ void CommandReturnObject::AppendRawError (const char *in_string, int len) { + if (!in_string) + return; if (len < 0) len = ::strlen (in_string); GetErrorStream().Printf ("%*.*s", len, len, in_string); Modified: lldb/trunk/test/python_api/interpreter/TestCommandInterpreterAPI.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/interpreter/TestCommandInterpreterAPI.py?rev=146911&r1=146910&r2=146911&view=diff ============================================================================== --- lldb/trunk/test/python_api/interpreter/TestCommandInterpreterAPI.py (original) +++ lldb/trunk/test/python_api/interpreter/TestCommandInterpreterAPI.py Mon Dec 19 15:36:23 2011 @@ -64,6 +64,10 @@ self.assertFalse(ci.AliasExists(None)) ci.HandleCommand(None, res) self.assertFalse(res.Succeeded()) + res.AppendMessage("Just appended a message.") + res.AppendMessage(None) + if self.TraceOn(): + print res process = ci.GetProcess() self.assertTrue(process) From johnny.chen at apple.com Mon Dec 19 15:47:43 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 19 Dec 2011 21:47:43 -0000 Subject: [Lldb-commits] [lldb] r146912 - /lldb/trunk/test/python_api/default-constructor/sb_communication.py Message-ID: <20111219214743.91E351BE003@llvm.org> Author: johnny Date: Mon Dec 19 15:47:43 2011 New Revision: 146912 URL: http://llvm.org/viewvc/llvm-project?rev=146912&view=rev Log: Add a fuzz call for SBCommunication: obj.connect(None). Modified: lldb/trunk/test/python_api/default-constructor/sb_communication.py Modified: lldb/trunk/test/python_api/default-constructor/sb_communication.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_communication.py?rev=146912&r1=146911&r2=146912&view=diff ============================================================================== --- lldb/trunk/test/python_api/default-constructor/sb_communication.py (original) +++ lldb/trunk/test/python_api/default-constructor/sb_communication.py Mon Dec 19 15:47:43 2011 @@ -14,6 +14,7 @@ obj.AdoptFileDesriptor(1, False) obj.AdoptFileDesriptor(2, False) obj.Connect("file:/tmp/myfile") + obj.Connect(None) obj.Disconnect() obj.IsConnected() obj.GetCloseOnEOF() From johnny.chen at apple.com Mon Dec 19 16:51:28 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 19 Dec 2011 22:51:28 -0000 Subject: [Lldb-commits] [lldb] r146917 - in /lldb/trunk: source/Core/UserSettingsController.cpp test/python_api/debugger/ test/python_api/debugger/TestDebuggerAPI.py Message-ID: <20111219225128.1718D1BE003@llvm.org> Author: johnny Date: Mon Dec 19 16:51:27 2011 New Revision: 146917 URL: http://llvm.org/viewvc/llvm-project?rev=146917&view=rev Log: Work in progress for: rdar://problem/10577182 Audit lldb API impl for places where we need to perform a NULL check Add NULL checks for SBDebugger APIs. Added: lldb/trunk/test/python_api/debugger/ lldb/trunk/test/python_api/debugger/TestDebuggerAPI.py Modified: lldb/trunk/source/Core/UserSettingsController.cpp Modified: lldb/trunk/source/Core/UserSettingsController.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/UserSettingsController.cpp?rev=146917&r1=146916&r2=146917&view=diff ============================================================================== --- lldb/trunk/source/Core/UserSettingsController.cpp (original) +++ lldb/trunk/source/Core/UserSettingsController.cpp Mon Dec 19 16:51:27 2011 @@ -280,7 +280,9 @@ ConstString const_var_name; const ConstString &default_name = InstanceSettings::GetDefaultName(); - Args names = UserSettingsController::BreakNameIntoPieces (full_dot_name); + Args names; + if (full_dot_name ) + names = UserSettingsController::BreakNameIntoPieces (full_dot_name); int num_pieces = names.GetArgumentCount(); if (num_pieces < 1) @@ -538,12 +540,18 @@ Error &err ) { - Args names = UserSettingsController::BreakNameIntoPieces (full_dot_name); - ConstString const_var_name; StringList value; + if (!full_dot_name) + { + err.SetErrorString ("invalid variable name"); + return value; + } + Args names = UserSettingsController::BreakNameIntoPieces (full_dot_name); int num_pieces = names.GetArgumentCount(); + ConstString const_var_name; + ConstString prefix (names.GetArgumentAtIndex (0)); const_var_name.SetCString (names.GetArgumentAtIndex (num_pieces - 1)); Added: lldb/trunk/test/python_api/debugger/TestDebuggerAPI.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/debugger/TestDebuggerAPI.py?rev=146917&view=auto ============================================================================== --- lldb/trunk/test/python_api/debugger/TestDebuggerAPI.py (added) +++ lldb/trunk/test/python_api/debugger/TestDebuggerAPI.py Mon Dec 19 16:51:27 2011 @@ -0,0 +1,30 @@ +""" +Test Debugger APIs. +""" + +import os, time +import re +import unittest2 +import lldb, lldbutil +from lldbtest import * + +class DebuggerAPITestCase(TestBase): + + mydir = os.path.join("python_api", "debugger") + + @python_api_test + def test_debugger_api_boundary_condition(self): + """Exercise SBDebugger APIs with boundary conditions.""" + self.dbg.HandleCommand(None) + self.dbg.SetDefaultArchitecture(None) + self.dbg.GetScriptingLanguage(None) + self.dbg.CreateTarget(None) + self.dbg.CreateTarget(None, None, None, True, lldb.SBError()) + self.dbg.CreateTargetWithFileAndTargetTriple(None, None) + self.dbg.CreateTargetWithFileAndArch(None, None) + self.dbg.FindTargetWithFileAndArch(None, None) + self.dbg.SetInternalVariable(None, None, None) + self.dbg.GetInternalVariableValue(None, None) + self.dbg.SetPrompt(None) + self.dbg.SetCurrentPlatform(None) + self.dbg.SetCurrentPlatformSDKRoot(None) From johnny.chen at apple.com Mon Dec 19 16:56:47 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 19 Dec 2011 22:56:47 -0000 Subject: [Lldb-commits] [lldb] r146919 - /lldb/trunk/test/python_api/default-constructor/sb_error.py Message-ID: <20111219225647.C278B1BE003@llvm.org> Author: johnny Date: Mon Dec 19 16:56:47 2011 New Revision: 146919 URL: http://llvm.org/viewvc/llvm-project?rev=146919&view=rev Log: Tes passing None to SetErrorString() and SetErrorStringWithFormat(). Modified: lldb/trunk/test/python_api/default-constructor/sb_error.py Modified: lldb/trunk/test/python_api/default-constructor/sb_error.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_error.py?rev=146919&r1=146918&r2=146919&view=diff ============================================================================== --- lldb/trunk/test/python_api/default-constructor/sb_error.py (original) +++ lldb/trunk/test/python_api/default-constructor/sb_error.py Mon Dec 19 16:56:47 2011 @@ -15,6 +15,8 @@ obj.SetErrorToErrno() obj.SetErrorToGenericError() obj.SetErrorString("xyz") + obj.SetErrorString(None) obj.SetErrorStringWithFormat("%s!", "error") + obj.SetErrorStringWithFormat(None) obj.GetDescription(lldb.SBStream()) obj.Clear() From johnny.chen at apple.com Mon Dec 19 17:09:54 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 19 Dec 2011 23:09:54 -0000 Subject: [Lldb-commits] [lldb] r146922 - /lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py Message-ID: <20111219230954.6666A1BE003@llvm.org> Author: johnny Date: Mon Dec 19 17:09:54 2011 New Revision: 146922 URL: http://llvm.org/viewvc/llvm-project?rev=146922&view=rev Log: Add a test sequence which passes None to lldb.SBFileSpec(). LLDB should not crash. Modified: lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py Modified: lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py?rev=146922&r1=146921&r2=146922&view=diff ============================================================================== --- lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py (original) +++ lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py Mon Dec 19 17:09:54 2011 @@ -2,6 +2,10 @@ Test lldb Python API object's default constructor and make sure it is invalid after initial construction. +There are also some cases of boundary condition testings sprinkled throughout +the tests where None is passed to SB API which expects (const char *) in the +C++ API counterpart. Passing None should not crash lldb! + There are three exceptions to the above general rules, though; API objects SBCommadnReturnObject, SBStream, and SBSymbolContextList, are all valid objects after default construction. @@ -130,6 +134,8 @@ @python_api_test def test_SBFileSpec(self): obj = lldb.SBFileSpec() + # This is just to test that FileSpec(None) does not crash. + obj2 = lldb.SBFileSpec(None, True) if self.TraceOn(): print obj self.assertFalse(obj) From johnny.chen at apple.com Mon Dec 19 17:41:29 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 19 Dec 2011 23:41:29 -0000 Subject: [Lldb-commits] [lldb] r146924 - /lldb/trunk/test/python_api/frame/TestFrames.py Message-ID: <20111219234129.BBD531BE003@llvm.org> Author: johnny Date: Mon Dec 19 17:41:29 2011 New Revision: 146924 URL: http://llvm.org/viewvc/llvm-project?rev=146924&view=rev Log: Add test_frame_api_boundary_condition() test case to exercise a bunch of boundary condition inputs. Modified: lldb/trunk/test/python_api/frame/TestFrames.py Modified: lldb/trunk/test/python_api/frame/TestFrames.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/frame/TestFrames.py?rev=146924&r1=146923&r2=146924&view=diff ============================================================================== --- lldb/trunk/test/python_api/frame/TestFrames.py (original) +++ lldb/trunk/test/python_api/frame/TestFrames.py Mon Dec 19 17:41:29 2011 @@ -25,6 +25,12 @@ self.buildDwarf() self.do_get_arg_vals() + @python_api_test + def test_frame_api_boundary_condition(self): + """Exercise SBFrame APIs with boundary condition inputs.""" + self.buildDefault() + self.frame_api_boundary_condition() + def do_get_arg_vals(self): """Get argument vals for the call stack when stopped on a breakpoint.""" exe = os.path.join(os.getcwd(), "a.out") @@ -110,6 +116,42 @@ substrs = ["a((int)val=1, (char)ch='A')", "a((int)val=3, (char)ch='A')"]) + def frame_api_boundary_condition(self): + exe = os.path.join(os.getcwd(), "a.out") + + # Create a target by the debugger. + target = self.dbg.CreateTarget(exe) + self.assertTrue(target, VALID_TARGET) + + # Now create a breakpoint on main.c by name 'c'. + breakpoint = target.BreakpointCreateByName('c', 'a.out') + #print "breakpoint:", breakpoint + self.assertTrue(breakpoint and + breakpoint.GetNumLocations() == 1, + VALID_BREAKPOINT) + + # Now launch the process, and do not stop at the entry point. + process = target.LaunchSimple(None, None, os.getcwd()) + + process = target.GetProcess() + self.assertTrue(process.GetState() == lldb.eStateStopped, + PROCESS_STOPPED) + + thread = process.GetThreadAtIndex(0) + frame = thread.GetFrameAtIndex(0) + if self.TraceOn(): + print "frame:", frame + + # Boundary condition testings. + val1 = frame.FindVariable(None, True) + val2 = frame.FindVariable(None, False) + val3 = frame.FindValue(None, lldb.eValueTypeVariableGlobal) + if self.TraceOn(): + print "val1:", val1 + print "val2:", val2 + + frame.EvaluateExpression(None) + if __name__ == '__main__': import atexit From johnny.chen at apple.com Mon Dec 19 18:04:58 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Tue, 20 Dec 2011 00:04:58 -0000 Subject: [Lldb-commits] [lldb] r146930 - /lldb/trunk/source/API/SBSourceManager.cpp Message-ID: <20111220000458.EFC501BE003@llvm.org> Author: johnny Date: Mon Dec 19 18:04:58 2011 New Revision: 146930 URL: http://llvm.org/viewvc/llvm-project?rev=146930&view=rev Log: Minor format update (no semantic change). Modified: lldb/trunk/source/API/SBSourceManager.cpp Modified: lldb/trunk/source/API/SBSourceManager.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSourceManager.cpp?rev=146930&r1=146929&r2=146930&view=diff ============================================================================== --- lldb/trunk/source/API/SBSourceManager.cpp (original) +++ lldb/trunk/source/API/SBSourceManager.cpp Mon Dec 19 18:04:58 2011 @@ -48,7 +48,7 @@ uint32_t line, uint32_t context_before, uint32_t context_after, - const char* current_line_cstr, + const char *current_line_cstr, lldb_private::Stream *s) { if (!file) @@ -118,7 +118,7 @@ uint32_t line, uint32_t context_before, uint32_t context_after, - const char* current_line_cstr, + const char *current_line_cstr, SBStream &s ) { From johnny.chen at apple.com Mon Dec 19 18:41:29 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Tue, 20 Dec 2011 00:41:29 -0000 Subject: [Lldb-commits] [lldb] r146934 - in /lldb/trunk: source/API/SBStream.cpp test/source-manager/TestSourceManager.py Message-ID: <20111220004129.456211BE003@llvm.org> Author: johnny Date: Mon Dec 19 18:41:28 2011 New Revision: 146934 URL: http://llvm.org/viewvc/llvm-project?rev=146934&view=rev Log: Work in progress for: rdar://problem/10577182 Audit lldb API impl for places where we need to perform a NULL check Add NULL checks for SBStream APIs. Modified: lldb/trunk/source/API/SBStream.cpp lldb/trunk/test/source-manager/TestSourceManager.py Modified: lldb/trunk/source/API/SBStream.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBStream.cpp?rev=146934&r1=146933&r2=146934&view=diff ============================================================================== --- lldb/trunk/source/API/SBStream.cpp (original) +++ lldb/trunk/source/API/SBStream.cpp Mon Dec 19 18:41:28 2011 @@ -59,6 +59,8 @@ void SBStream::Printf (const char *format, ...) { + if (!format) + return; va_list args; va_start (args, format); ref().PrintfVarArg (format, args); Modified: lldb/trunk/test/source-manager/TestSourceManager.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/source-manager/TestSourceManager.py?rev=146934&r1=146933&r2=146934&view=diff ============================================================================== --- lldb/trunk/test/source-manager/TestSourceManager.py (original) +++ lldb/trunk/test/source-manager/TestSourceManager.py Mon Dec 19 18:41:28 2011 @@ -74,7 +74,11 @@ # 6 } self.expect(stream.GetData(), "Source code displayed correctly", exe=False, - patterns = ['=> %d.*Hello world' % self.line]) + patterns = ['=> %d.*Hello world' % self.line]) + + # Boundary condition testings for SBStream(). LLDB should not crash! + stream.Printf(None) + stream.RedirectToFile(None, True) def move_and_then_display_source(self): """Test that target.source-map settings work by moving main.c to hidden/main.c.""" From johnny.chen at apple.com Mon Dec 19 18:49:06 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Tue, 20 Dec 2011 00:49:06 -0000 Subject: [Lldb-commits] [lldb] r146935 - /lldb/trunk/test/python_api/default-constructor/sb_stringlist.py Message-ID: <20111220004906.E23D71BE003@llvm.org> Author: johnny Date: Mon Dec 19 18:49:06 2011 New Revision: 146935 URL: http://llvm.org/viewvc/llvm-project?rev=146935&view=rev Log: Add fuzz call to SBStringList.AppendString(None). LLDB should not crash. Modified: lldb/trunk/test/python_api/default-constructor/sb_stringlist.py Modified: lldb/trunk/test/python_api/default-constructor/sb_stringlist.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_stringlist.py?rev=146935&r1=146934&r2=146935&view=diff ============================================================================== --- lldb/trunk/test/python_api/default-constructor/sb_stringlist.py (original) +++ lldb/trunk/test/python_api/default-constructor/sb_stringlist.py Mon Dec 19 18:49:06 2011 @@ -7,6 +7,7 @@ def fuzz_obj(obj): obj.AppendString("another string") + obj.AppendString(None) obj.AppendList(None, 0) obj.AppendList(lldb.SBStringList()) obj.GetSize() From johnny.chen at apple.com Mon Dec 19 18:58:21 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Tue, 20 Dec 2011 00:58:21 -0000 Subject: [Lldb-commits] [lldb] r146936 - /lldb/trunk/source/API/SBTarget.cpp Message-ID: <20111220005821.28E231BE003@llvm.org> Author: johnny Date: Mon Dec 19 18:58:20 2011 New Revision: 146936 URL: http://llvm.org/viewvc/llvm-project?rev=146936&view=rev Log: Remove dead code found. Modified: lldb/trunk/source/API/SBTarget.cpp Modified: lldb/trunk/source/API/SBTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=146936&r1=146935&r2=146936&view=diff ============================================================================== --- lldb/trunk/source/API/SBTarget.cpp (original) +++ lldb/trunk/source/API/SBTarget.cpp Mon Dec 19 18:58:20 2011 @@ -1071,13 +1071,6 @@ return false; } -lldb::SBModule -AddModule (const char *path, - const char *triple, - const char *uuid); - - - uint32_t SBTarget::GetNumModules () const { From johnny.chen at apple.com Mon Dec 19 19:22:04 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Tue, 20 Dec 2011 01:22:04 -0000 Subject: [Lldb-commits] [lldb] r146948 - in /lldb/trunk: source/API/SBTarget.cpp test/python_api/hello_world/TestHelloWorld.py Message-ID: <20111220012204.173A51BE003@llvm.org> Author: johnny Date: Mon Dec 19 19:22:03 2011 New Revision: 146948 URL: http://llvm.org/viewvc/llvm-project?rev=146948&view=rev Log: Work in progress for: rdar://problem/10577182 Audit lldb API impl for places where we need to perform a NULL check Add a NULL check for SBTarget.AttachToProcessWithName() so it will not hang. Modified: lldb/trunk/source/API/SBTarget.cpp lldb/trunk/test/python_api/hello_world/TestHelloWorld.py Modified: lldb/trunk/source/API/SBTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=146948&r1=146947&r2=146948&view=diff ============================================================================== --- lldb/trunk/source/API/SBTarget.cpp (original) +++ lldb/trunk/source/API/SBTarget.cpp Mon Dec 19 19:22:03 2011 @@ -379,7 +379,7 @@ ) { SBProcess sb_process; - if (m_opaque_sp) + if (name && m_opaque_sp) { Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex()); Modified: lldb/trunk/test/python_api/hello_world/TestHelloWorld.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/hello_world/TestHelloWorld.py?rev=146948&r1=146947&r2=146948&view=diff ============================================================================== --- lldb/trunk/test/python_api/hello_world/TestHelloWorld.py (original) +++ lldb/trunk/test/python_api/hello_world/TestHelloWorld.py Mon Dec 19 19:22:03 2011 @@ -155,6 +155,13 @@ error = lldb.SBError() # Pass 'False' since we don't want to wait for new instance of "hello_world" to be launched. name = os.path.basename(self.exe) + + # While we're at it, make sure that passing a None as the process name + # does not hang LLDB. + target.AttachToProcessWithName(listener, None, False, error) + # Also boundary condition test ConnectRemote(), too. + target.ConnectRemote(listener, None, None, error) + process = target.AttachToProcessWithName(listener, name, False, error) self.assertTrue(error.Success() and process, PROCESS_IS_VALID) From johnny.chen at apple.com Mon Dec 19 19:52:44 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Tue, 20 Dec 2011 01:52:44 -0000 Subject: [Lldb-commits] [lldb] r146954 - in /lldb/trunk: source/API/SBValue.cpp test/python_api/value/change_values/TestChangeValueAPI.py Message-ID: <20111220015244.CEE551BE003@llvm.org> Author: johnny Date: Mon Dec 19 19:52:44 2011 New Revision: 146954 URL: http://llvm.org/viewvc/llvm-project?rev=146954&view=rev Log: Work in progress for: rdar://problem/10577182 Audit lldb API impl for places where we need to perform a NULL check Add a NULL check for SBValue.CreateValueFromExpression(). Modified: lldb/trunk/source/API/SBValue.cpp lldb/trunk/test/python_api/value/change_values/TestChangeValueAPI.py Modified: lldb/trunk/source/API/SBValue.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValue.cpp?rev=146954&r1=146953&r2=146954&view=diff ============================================================================== --- lldb/trunk/source/API/SBValue.cpp (original) +++ lldb/trunk/source/API/SBValue.cpp Mon Dec 19 19:52:44 2011 @@ -392,8 +392,11 @@ true, // keep in memory eNoDynamicValues, result_valobj_sp); - result_valobj_sp->SetName(ConstString(name)); - result = SBValue(result_valobj_sp); + if (result_valobj_sp) + { + result_valobj_sp->SetName(ConstString(name)); + result = SBValue(result_valobj_sp); + } } LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) Modified: lldb/trunk/test/python_api/value/change_values/TestChangeValueAPI.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/value/change_values/TestChangeValueAPI.py?rev=146954&r1=146953&r2=146954&view=diff ============================================================================== --- lldb/trunk/test/python_api/value/change_values/TestChangeValueAPI.py (original) +++ lldb/trunk/test/python_api/value/change_values/TestChangeValueAPI.py Mon Dec 19 19:52:44 2011 @@ -130,6 +130,10 @@ self.assertTrue (error.Success(), "Got a changed value for sp") self.assertTrue (actual_value == 1, "Got the right changed value for sp.") + # Boundary condition test the SBValue.CreateValueFromExpression() API. + # LLDB should not crash! + nosuchval = mine_value.CreateValueFromExpression(None, None) + process.Continue() self.assertTrue(process.GetState() == lldb.eStateStopped) From johnny.chen at apple.com Mon Dec 19 20:11:37 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Tue, 20 Dec 2011 02:11:37 -0000 Subject: [Lldb-commits] [lldb] r146956 - /lldb/trunk/test/lang/objc/objc-checker/TestObjCCheckers.py Message-ID: <20111220021137.95D7A1BE003@llvm.org> Author: johnny Date: Mon Dec 19 20:11:37 2011 New Revision: 146956 URL: http://llvm.org/viewvc/llvm-project?rev=146956&view=rev Log: Properly name the test class as well as the test methods. Modified: lldb/trunk/test/lang/objc/objc-checker/TestObjCCheckers.py Modified: lldb/trunk/test/lang/objc/objc-checker/TestObjCCheckers.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/objc-checker/TestObjCCheckers.py?rev=146956&r1=146955&r2=146956&view=diff ============================================================================== --- lldb/trunk/test/lang/objc/objc-checker/TestObjCCheckers.py (original) +++ lldb/trunk/test/lang/objc/objc-checker/TestObjCCheckers.py Mon Dec 19 20:11:37 2011 @@ -8,19 +8,19 @@ import lldb, lldbutil from lldbtest import * -class ObjCDynamicValueTestCase(TestBase): +class ObjCCheckerTestCase(TestBase): mydir = os.path.join("lang", "objc", "objc-checker") @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") @python_api_test - def test_get_dynamic_objc_vals_with_dsym(self): + def test_objc_checker_with_dsym(self): """Test that checkers catch unrecognized selectors""" self.buildDsym() self.do_test_checkers() @python_api_test - def test_get_objc_dynamic_vals_with_dwarf(self): + def test_objc_checker_with_dwarf(self): """Test that checkers catch unrecognized selectors""" self.buildDwarf() self.do_test_checkers() From johnny.chen at apple.com Mon Dec 19 20:14:02 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Tue, 20 Dec 2011 02:14:02 -0000 Subject: [Lldb-commits] [lldb] r146957 - /lldb/trunk/test/lang/objc/objc-property/TestObjCProperty.py Message-ID: <20111220021402.41B681BE003@llvm.org> Author: johnny Date: Mon Dec 19 20:14:01 2011 New Revision: 146957 URL: http://llvm.org/viewvc/llvm-project?rev=146957&view=rev Log: Properly name the test class as well as the test methods. Modified: lldb/trunk/test/lang/objc/objc-property/TestObjCProperty.py Modified: 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=146957&r1=146956&r2=146957&view=diff ============================================================================== --- lldb/trunk/test/lang/objc/objc-property/TestObjCProperty.py (original) +++ lldb/trunk/test/lang/objc/objc-property/TestObjCProperty.py Mon Dec 19 20:14:01 2011 @@ -8,19 +8,19 @@ import lldb, lldbutil from lldbtest import * -class ObjCDynamicValueTestCase(TestBase): +class ObjCPropertyTestCase(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): + def test_objc_properties_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): + def test_objc_properties_with_dwarf(self): """Test that expr uses the correct property getters and setters""" self.buildDwarf() self.do_test_properties() From scallanan at apple.com Tue Dec 20 11:39:38 2011 From: scallanan at apple.com (Sean Callanan) Date: Tue, 20 Dec 2011 17:39:38 -0000 Subject: [Lldb-commits] [lldb] r146978 - in /lldb/trunk: lldb.xcodeproj/project.pbxproj resources/LLDB-Info.plist tools/debugserver/debugserver.xcodeproj/project.pbxproj Message-ID: <20111220173938.4EF3F2A6C12C@llvm.org> Author: spyffe Date: Tue Dec 20 11:39:37 2011 New Revision: 146978 URL: http://llvm.org/viewvc/llvm-project?rev=146978&view=rev Log: Updating Xcode project version numbers for lldb-97 and debugserver-157 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=146978&r1=146977&r2=146978&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Tue Dec 20 11:39:37 2011 @@ -3733,9 +3733,9 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CURRENT_PROJECT_VERSION = 96; + CURRENT_PROJECT_VERSION = 97; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 96; + DYLIB_CURRENT_VERSION = 97; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3793,10 +3793,10 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CURRENT_PROJECT_VERSION = 96; + CURRENT_PROJECT_VERSION = 97; DEAD_CODE_STRIPPING = YES; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 96; + DYLIB_CURRENT_VERSION = 97; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3852,8 +3852,8 @@ 2689FFD513353D7A00698AC0 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 96; - DYLIB_CURRENT_VERSION = 96; + CURRENT_PROJECT_VERSION = 97; + DYLIB_CURRENT_VERSION = 97; EXECUTABLE_EXTENSION = a; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3881,8 +3881,8 @@ 2689FFD613353D7A00698AC0 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 96; - DYLIB_CURRENT_VERSION = 96; + CURRENT_PROJECT_VERSION = 97; + DYLIB_CURRENT_VERSION = 97; EXECUTABLE_EXTENSION = a; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3910,8 +3910,8 @@ 2689FFD713353D7A00698AC0 /* BuildAndIntegration */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 96; - DYLIB_CURRENT_VERSION = 96; + CURRENT_PROJECT_VERSION = 97; + DYLIB_CURRENT_VERSION = 97; EXECUTABLE_EXTENSION = a; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3991,7 +3991,7 @@ isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 96; + CURRENT_PROJECT_VERSION = 97; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", @@ -4022,10 +4022,10 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 96; + CURRENT_PROJECT_VERSION = 97; DEAD_CODE_STRIPPING = YES; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 96; + DYLIB_CURRENT_VERSION = 97; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -4269,7 +4269,7 @@ 26F5C26C10F3D9A5009D5894 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 96; + CURRENT_PROJECT_VERSION = 97; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", @@ -4299,7 +4299,7 @@ 26F5C26D10F3D9A5009D5894 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 96; + CURRENT_PROJECT_VERSION = 97; 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=146978&r1=146977&r2=146978&view=diff ============================================================================== --- lldb/trunk/resources/LLDB-Info.plist (original) +++ lldb/trunk/resources/LLDB-Info.plist Tue Dec 20 11:39:37 2011 @@ -17,7 +17,7 @@ CFBundleSignature ???? CFBundleVersion - 96 + 97 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=146978&r1=146977&r2=146978&view=diff ============================================================================== --- lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj (original) +++ lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj Tue Dec 20 11:39:37 2011 @@ -475,7 +475,7 @@ i386, ); COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 156; + CURRENT_PROJECT_VERSION = 157; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; SDKROOT = ""; @@ -494,7 +494,7 @@ x86_64, i386, ); - CURRENT_PROJECT_VERSION = 156; + CURRENT_PROJECT_VERSION = 157; 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 = 156; + CURRENT_PROJECT_VERSION = 157; 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 = 156; + CURRENT_PROJECT_VERSION = 157; 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 = 156; + CURRENT_PROJECT_VERSION = 157; 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 = 156; + CURRENT_PROJECT_VERSION = 157; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks; "FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = ( From scallanan at apple.com Tue Dec 20 11:40:38 2011 From: scallanan at apple.com (Sean Callanan) Date: Tue, 20 Dec 2011 17:40:38 -0000 Subject: [Lldb-commits] [lldb] r146979 - /lldb/tags/lldb-97/ Message-ID: <20111220174038.E383F2A6C12C@llvm.org> Author: spyffe Date: Tue Dec 20 11:40:38 2011 New Revision: 146979 URL: http://llvm.org/viewvc/llvm-project?rev=146979&view=rev Log: lldb-97 Added: lldb/tags/lldb-97/ - copied from r146978, lldb/trunk/ From bugzilla-daemon at llvm.org Tue Dec 20 13:53:01 2011 From: bugzilla-daemon at llvm.org (bugzilla-daemon at llvm.org) Date: Tue, 20 Dec 2011 19:53:01 +0000 Subject: [Lldb-commits] [Bug 11628] New: lldb and gdb compute different values for pointer expression Message-ID: http://llvm.org/bugs/show_bug.cgi?id=11628 Bug #: 11628 Summary: lldb and gdb compute different values for pointer expression Product: lldb Version: unspecified Platform: Macintosh OS/Version: All Status: NEW Severity: normal Priority: P Component: All Bugs AssignedTo: lldb-commits at cs.uiuc.edu ReportedBy: nathanhowell at hotmail.com Classification: Unclassified Created attachment 7780 --> http://llvm.org/bugs/attachment.cgi?id=7780 Repro app compiled with GHC 7.2.1 x86_64 The expression '(((StgThunk*)Main_lastException_info)-1)' returns: gdb: 0x100001c20 lldb: 0x100001c18 It would also be nice if the function cast was not required. (lldb) bt * thread #1: tid = 0x2c03, 0x00007fff84fbd0b6 libSystem.B.dylib`__kill + 10, stop reason = signal SIGABRT frame #0: 0x00007fff84fbd0b6 libSystem.B.dylib`__kill + 10 frame #1: 0x0000000100001a04 sig`r2bl_info + 28 (lldb) print (((StgThunk*)(void (*)())Main_lastException_info)) (StgThunk *) $23 = 0x0000000100001c30 (lldb) print (((StgThunk*)(void (*)())Main_lastException_info)-1) (StgThunk *) $24 = 0x0000000100001c18 (lldb) print (((StgThunk*)Main_lastException_info)) error: function 'Main_lastException_info' with unknown type must be given a function type <-- this is annoying error: 1 errors parsing expression (gdb) bt #0 0x00007fff84fbd0b6 in __kill () #1 0x0000000100001a04 in r2bl_info () (gdb) print (((StgThunk*)Main_lastException_info)) $14 = (StgThunk *) 0x100001c30 (gdb) print (((StgThunk*)Main_lastException_info)-1) $15 = (StgThunk *) 0x100001c20 -- Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. From scallanan at apple.com Tue Dec 20 17:55:47 2011 From: scallanan at apple.com (Sean Callanan) Date: Tue, 20 Dec 2011 23:55:47 -0000 Subject: [Lldb-commits] [lldb] r147016 - /lldb/trunk/source/Symbol/ClangASTImporter.cpp Message-ID: <20111220235548.09C262A6C12C@llvm.org> Author: spyffe Date: Tue Dec 20 17:55:47 2011 New Revision: 147016 URL: http://llvm.org/viewvc/llvm-project?rev=147016&view=rev Log: Fixed a bug in the ASTImporter that affects types that have been imported multiple times. The discussion below uses this diagram: ASTContext A B C Decl Da Db Dc ASTImporter \-Iab-/\-Iac-/ \-----Iac----/ When a Decl D is imported from ASTContext A to ASTContext B, the ASTImporter Iab records the pair in a DenseMap. That way, if Iab ever encounters Da again (for example, as the DeclContext for another Decl), it can use the imported version. This is not an optimization, it is critical: if I import the field "st_dev" as part of importing "struct stat," the field must have DeclContext equal to the parent structure or we end up with multiple different Decls containing different parts of "struct stat." "struct stat" is imported once and recorded in the DenseMap; then the ASTImporter finds that same version when looking for the DeclContext of "st_dev." The bug arises when Db is imported into another ASTContext C and ASTContext B goes away. This often occurs when LLDB produces result variables for expressions. Ibc is aware of the transport of Db to Dc, but a brand new ASTImporter, Iac, is responsible for completing Dc from its source upon request. That ASTImporter has no mappings, so it will produce a clone of Dc when attempting to import its children. That means that type completion operations on Dc will fail. The solution is to create Iac as soon as Ibc imports D from B to C, and inform Iac of the mapping between Da and Dc. This allows type completion to happen correctly. Modified: lldb/trunk/source/Symbol/ClangASTImporter.cpp Modified: lldb/trunk/source/Symbol/ClangASTImporter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTImporter.cpp?rev=147016&r1=147015&r2=147016&view=diff ============================================================================== --- lldb/trunk/source/Symbol/ClangASTImporter.cpp (original) +++ lldb/trunk/source/Symbol/ClangASTImporter.cpp Tue Dec 20 17:55:47 2011 @@ -356,6 +356,11 @@ { to_context_md->m_origins[to] = origin_iter->second; + MinionSP direct_completer = m_master.GetMinion(&to->getASTContext(), origin_iter->second.ctx); + + if (direct_completer.get() != this) + direct_completer->ASTImporter::Imported(origin_iter->second.decl, to); + if (log) log->Printf(" [ClangASTImporter] Propagated origin (Decl*)%p/(ASTContext*)%p from (ASTContext*)%p to (ASTContext*)%p", origin_iter->second.decl, From jmolenda at apple.com Tue Dec 20 21:14:43 2011 From: jmolenda at apple.com (Jason Molenda) Date: Wed, 21 Dec 2011 03:14:43 -0000 Subject: [Lldb-commits] [lldb] r147033 - in /lldb/trunk: lldb.xcodeproj/project.pbxproj resources/LLDB-Info.plist Message-ID: <20111221031443.1254E2A6C12C@llvm.org> Author: jmolenda Date: Tue Dec 20 21:14:42 2011 New Revision: 147033 URL: http://llvm.org/viewvc/llvm-project?rev=147033&view=rev Log: Bump version number past lldb-98. Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/resources/LLDB-Info.plist Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=147033&r1=147032&r2=147033&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Tue Dec 20 21:14:42 2011 @@ -3733,9 +3733,9 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CURRENT_PROJECT_VERSION = 97; + CURRENT_PROJECT_VERSION = 98; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 97; + DYLIB_CURRENT_VERSION = 98; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3793,10 +3793,10 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CURRENT_PROJECT_VERSION = 97; + CURRENT_PROJECT_VERSION = 98; DEAD_CODE_STRIPPING = YES; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 97; + DYLIB_CURRENT_VERSION = 98; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3852,8 +3852,8 @@ 2689FFD513353D7A00698AC0 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 97; - DYLIB_CURRENT_VERSION = 97; + CURRENT_PROJECT_VERSION = 98; + DYLIB_CURRENT_VERSION = 98; EXECUTABLE_EXTENSION = a; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3881,8 +3881,8 @@ 2689FFD613353D7A00698AC0 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 97; - DYLIB_CURRENT_VERSION = 97; + CURRENT_PROJECT_VERSION = 98; + DYLIB_CURRENT_VERSION = 98; EXECUTABLE_EXTENSION = a; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3910,8 +3910,8 @@ 2689FFD713353D7A00698AC0 /* BuildAndIntegration */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 97; - DYLIB_CURRENT_VERSION = 97; + CURRENT_PROJECT_VERSION = 98; + DYLIB_CURRENT_VERSION = 98; EXECUTABLE_EXTENSION = a; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3991,7 +3991,7 @@ isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 97; + CURRENT_PROJECT_VERSION = 98; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", @@ -4022,10 +4022,10 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 97; + CURRENT_PROJECT_VERSION = 98; DEAD_CODE_STRIPPING = YES; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 97; + DYLIB_CURRENT_VERSION = 98; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -4269,7 +4269,7 @@ 26F5C26C10F3D9A5009D5894 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 97; + CURRENT_PROJECT_VERSION = 98; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", @@ -4299,7 +4299,7 @@ 26F5C26D10F3D9A5009D5894 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 97; + CURRENT_PROJECT_VERSION = 98; 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=147033&r1=147032&r2=147033&view=diff ============================================================================== --- lldb/trunk/resources/LLDB-Info.plist (original) +++ lldb/trunk/resources/LLDB-Info.plist Tue Dec 20 21:14:42 2011 @@ -17,7 +17,7 @@ CFBundleSignature ???? CFBundleVersion - 97 + 98 CFBundleName ${EXECUTABLE_NAME} From scallanan at apple.com Wed Dec 21 12:02:24 2011 From: scallanan at apple.com (Sean Callanan) Date: Wed, 21 Dec 2011 18:02:24 -0000 Subject: [Lldb-commits] [lldb] r147061 - in /lldb/trunk: lldb.xcodeproj/project.pbxproj resources/LLDB-Info.plist tools/debugserver/debugserver.xcodeproj/project.pbxproj Message-ID: <20111221180224.DBCE22A6C12C@llvm.org> Author: spyffe Date: Wed Dec 21 12:02:24 2011 New Revision: 147061 URL: http://llvm.org/viewvc/llvm-project?rev=147061&view=rev Log: Updating Xcode project version numbers for lldb-99 and debugserver-158 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=147061&r1=147060&r2=147061&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Wed Dec 21 12:02:24 2011 @@ -3733,9 +3733,9 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CURRENT_PROJECT_VERSION = 98; + CURRENT_PROJECT_VERSION = 99; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 98; + DYLIB_CURRENT_VERSION = 99; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3793,10 +3793,10 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CURRENT_PROJECT_VERSION = 98; + CURRENT_PROJECT_VERSION = 99; DEAD_CODE_STRIPPING = YES; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 98; + DYLIB_CURRENT_VERSION = 99; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3852,8 +3852,8 @@ 2689FFD513353D7A00698AC0 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 98; - DYLIB_CURRENT_VERSION = 98; + CURRENT_PROJECT_VERSION = 99; + DYLIB_CURRENT_VERSION = 99; EXECUTABLE_EXTENSION = a; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3881,8 +3881,8 @@ 2689FFD613353D7A00698AC0 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 98; - DYLIB_CURRENT_VERSION = 98; + CURRENT_PROJECT_VERSION = 99; + DYLIB_CURRENT_VERSION = 99; EXECUTABLE_EXTENSION = a; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3910,8 +3910,8 @@ 2689FFD713353D7A00698AC0 /* BuildAndIntegration */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 98; - DYLIB_CURRENT_VERSION = 98; + CURRENT_PROJECT_VERSION = 99; + DYLIB_CURRENT_VERSION = 99; EXECUTABLE_EXTENSION = a; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3991,7 +3991,7 @@ isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 98; + CURRENT_PROJECT_VERSION = 99; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", @@ -4022,10 +4022,10 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 98; + CURRENT_PROJECT_VERSION = 99; DEAD_CODE_STRIPPING = YES; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 98; + DYLIB_CURRENT_VERSION = 99; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -4269,7 +4269,7 @@ 26F5C26C10F3D9A5009D5894 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 98; + CURRENT_PROJECT_VERSION = 99; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", @@ -4299,7 +4299,7 @@ 26F5C26D10F3D9A5009D5894 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 98; + CURRENT_PROJECT_VERSION = 99; 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=147061&r1=147060&r2=147061&view=diff ============================================================================== --- lldb/trunk/resources/LLDB-Info.plist (original) +++ lldb/trunk/resources/LLDB-Info.plist Wed Dec 21 12:02:24 2011 @@ -17,7 +17,7 @@ CFBundleSignature ???? CFBundleVersion - 98 + 99 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=147061&r1=147060&r2=147061&view=diff ============================================================================== --- lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj (original) +++ lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj Wed Dec 21 12:02:24 2011 @@ -475,7 +475,7 @@ i386, ); COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 157; + CURRENT_PROJECT_VERSION = 158; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; SDKROOT = ""; @@ -494,7 +494,7 @@ x86_64, i386, ); - CURRENT_PROJECT_VERSION = 157; + CURRENT_PROJECT_VERSION = 158; 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 = 157; + CURRENT_PROJECT_VERSION = 158; 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 = 157; + CURRENT_PROJECT_VERSION = 158; 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 = 157; + CURRENT_PROJECT_VERSION = 158; 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 = 157; + CURRENT_PROJECT_VERSION = 158; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks; "FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = ( From scallanan at apple.com Wed Dec 21 12:03:20 2011 From: scallanan at apple.com (Sean Callanan) Date: Wed, 21 Dec 2011 18:03:20 -0000 Subject: [Lldb-commits] [lldb] r147062 - /lldb/tags/lldb-99/ Message-ID: <20111221180320.CAE6E2A6C12C@llvm.org> Author: spyffe Date: Wed Dec 21 12:03:20 2011 New Revision: 147062 URL: http://llvm.org/viewvc/llvm-project?rev=147062&view=rev Log: lldb-99 Added: lldb/tags/lldb-99/ - copied from r147061, lldb/trunk/ From johnny.chen at apple.com Wed Dec 21 13:56:51 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Wed, 21 Dec 2011 19:56:51 -0000 Subject: [Lldb-commits] [lldb] r147072 - /lldb/trunk/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py Message-ID: <20111221195651.C40382A6C12C@llvm.org> Author: johnny Date: Wed Dec 21 13:56:51 2011 New Revision: 147072 URL: http://llvm.org/viewvc/llvm-project?rev=147072&view=rev Log: Fix wrong test method name. Modified: lldb/trunk/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py Modified: lldb/trunk/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py?rev=147072&r1=147071&r2=147072&view=diff ============================================================================== --- lldb/trunk/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py (original) +++ lldb/trunk/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py Wed Dec 21 13:56:51 2011 @@ -30,7 +30,7 @@ self.do_set_watchaddress() @python_api_test - def test_watch_val_with_dwarf(self): + def test_watch_address_with_dwarf(self): """Exercise SBTarget.WatchAddress() API to set a watchpoint.""" self.buildDwarf() self.do_set_watchaddress() From scallanan at apple.com Wed Dec 21 15:30:33 2011 From: scallanan at apple.com (Sean Callanan) Date: Wed, 21 Dec 2011 21:30:33 -0000 Subject: [Lldb-commits] [lldb] r147097 - in /lldb/trunk: lldb.xcodeproj/xcshareddata/xcschemes/LLDB.xcscheme lldb.xcodeproj/xcshareddata/xcschemes/darwin-debug.xcscheme lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme lldb.xcworkspace/contents.xcworkspacedata Message-ID: <20111221213033.ACCC02A6C12C@llvm.org> Author: spyffe Date: Wed Dec 21 15:30:33 2011 New Revision: 147097 URL: http://llvm.org/viewvc/llvm-project?rev=147097&view=rev Log: I accidentally committed some changes to the Xcode workspace that aren't actually desirable. Reverted. Modified: lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/LLDB.xcscheme lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/darwin-debug.xcscheme lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme lldb/trunk/lldb.xcworkspace/contents.xcworkspacedata Modified: lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/LLDB.xcscheme URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/LLDB.xcscheme?rev=147097&r1=147096&r2=147097&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/LLDB.xcscheme (original) +++ lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/LLDB.xcscheme Wed Dec 21 15:30:33 2011 @@ -1,6 +1,6 @@ + version = "1.3"> @@ -28,15 +28,6 @@ buildConfiguration = "Debug"> - - - - + buildConfiguration = "Debug"> + buildConfiguration = "Release"> + version = "1.3"> @@ -43,9 +43,7 @@ displayScale = "1.00" launchStyle = "0" useCustomWorkingDirectory = "NO" - buildConfiguration = "Debug" - debugDocumentVersioning = "YES" - allowLocationSimulation = "YES"> + buildConfiguration = "Debug"> + buildConfiguration = "Release"> - - From scallanan at apple.com Wed Dec 21 17:44:05 2011 From: scallanan at apple.com (Sean Callanan) Date: Wed, 21 Dec 2011 23:44:05 -0000 Subject: [Lldb-commits] [lldb] r147107 - /lldb/trunk/source/Expression/IRForTarget.cpp Message-ID: <20111221234405.C58302A6C12C@llvm.org> Author: spyffe Date: Wed Dec 21 17:44:05 2011 New Revision: 147107 URL: http://llvm.org/viewvc/llvm-project?rev=147107&view=rev Log: Made IRForTarget error out correctly when it can't complete the result type, preventing crashes later. Modified: lldb/trunk/source/Expression/IRForTarget.cpp Modified: lldb/trunk/source/Expression/IRForTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRForTarget.cpp?rev=147107&r1=147106&r2=147107&view=diff ============================================================================== --- lldb/trunk/source/Expression/IRForTarget.cpp (original) +++ lldb/trunk/source/Expression/IRForTarget.cpp Wed Dec 21 17:44:05 2011 @@ -675,8 +675,9 @@ log->Printf("Result type has size 0"); if (m_error_stream) - m_error_stream->Printf("Internal error [IRForTarget]: Result type '%s' has invalid size\n", + m_error_stream->Printf("Error [IRForTarget]: Size of result type '%s' couldn't be determined\n", type_desc_stream.GetData()); + return false; } if (log) From dawn at burble.org Wed Dec 21 19:05:13 2011 From: dawn at burble.org (dawn at burble.org) Date: Wed, 21 Dec 2011 17:05:13 -0800 Subject: [Lldb-commits] [PATCH] fixes for linux tests Message-ID: <20111222010513.GA32182@bloodbath.burble.org> Here's a few fixes for running some of the Linux tests. Please review. Ok to commit? Thanks! -Dawn -------------- next part -------------- Index: test/macosx/order/TestOrderFile.py =================================================================== --- test/macosx/order/TestOrderFile.py (revision 147116) +++ test/macosx/order/TestOrderFile.py (working copy) @@ -18,6 +18,7 @@ self.buildDsym() self.order_file() + @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") def test_with_dwarf(self): """Test debug symbols follow the correct order by the order file.""" self.buildDwarf() Index: test/api/check_public_api_headers/TestPublicAPIHeaders.py =================================================================== --- test/api/check_public_api_headers/TestPublicAPIHeaders.py (revision 147116) +++ test/api/check_public_api_headers/TestPublicAPIHeaders.py (working copy) @@ -26,7 +26,10 @@ # Call the program generator to produce main.cpp. self.generate_main_cpp() - d = {'FRAMEWORK_INCLUDES' : "-F%s" % self.build_dir} + if sys.platform.startswith("darwin"): + d = {'FRAMEWORK_INCLUDES' : "-F%s" % self.build_dir} + if sys.platform.startswith("linux"): + d = {'FRAMEWORK_INCLUDES' : "-I%s" % os.path.join(os.environ["LLDB_SRC"], "include")} self.buildDefault(dictionary=d) self.exe_name = 'a.out' self.sanity_check_executable(self.exe_name) @@ -45,6 +48,8 @@ # For different platforms, the include statement can vary. if sys.platform.startswith("darwin"): include_stmt = "'#include <%s>' % os.path.join('LLDB', header)" + if sys.platform.startswith("linux"): + include_stmt = "'#include <%s>' % os.path.join(public_api_dir, header)" list = [eval(include_stmt) for header in public_headers if (header.startswith("SB") and header.endswith(".h"))] includes = '\n'.join(list) @@ -66,6 +71,9 @@ if sys.platform.startswith("darwin"): env_var = 'DYLD_FRAMEWORK_PATH' env_val = self.build_dir + if sys.platform.startswith("linux"): + env_var = 'LD_LIBRARY_PATH' + env_val = self.build_dir env_cmd = "settings set target.env-vars %s=%s" %(env_var, env_val) if self.TraceOn(): Index: test/api/check_public_api_headers/Makefile =================================================================== --- test/api/check_public_api_headers/Makefile (revision 147116) +++ test/api/check_public_api_headers/Makefile (working copy) @@ -1,7 +1,11 @@ LEVEL = ../../make CXX_SOURCES := main.cpp -LD_EXTRAS ?= -framework LLDB +ifeq "$(OS)" "Darwin" + LD_EXTRAS ?= -framework LLDB +else + LD_EXTRAS ?= $(LLDB_BUILD_DIR)/_lldb.so +endif # Example dictionary to pass to the Python build method: # From jingham at apple.com Thu Dec 22 11:03:38 2011 From: jingham at apple.com (Jim Ingham) Date: Thu, 22 Dec 2011 17:03:38 -0000 Subject: [Lldb-commits] [lldb] r147149 - /lldb/trunk/source/Core/Value.cpp Message-ID: <20111222170338.46D712A6C12D@llvm.org> Author: jingham Date: Thu Dec 22 11:03:37 2011 New Revision: 147149 URL: http://llvm.org/viewvc/llvm-project?rev=147149&view=rev Log: Add check for non-NULL Variable with a NULL Type. Modified: lldb/trunk/source/Core/Value.cpp Modified: lldb/trunk/source/Core/Value.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Value.cpp?rev=147149&r1=147148&r2=147149&view=diff ============================================================================== --- lldb/trunk/source/Core/Value.cpp (original) +++ lldb/trunk/source/Core/Value.cpp Thu Dec 22 11:03:37 2011 @@ -213,7 +213,12 @@ case eContextTypeVariable: // Variable * if (GetVariable()) - byte_size = GetVariable()->GetType()->GetByteSize(); + { + if (GetVariable()->GetType()) + byte_size = GetVariable()->GetType()->GetByteSize(); + else if (error_ptr) + error_ptr->SetErrorString ("Can't determine byte size with NULL Type *."); + } else if (error_ptr) error_ptr->SetErrorString ("Can't determine byte size with NULL Variable *."); break; From jingham at apple.com Thu Dec 22 13:12:41 2011 From: jingham at apple.com (Jim Ingham) Date: Thu, 22 Dec 2011 19:12:41 -0000 Subject: [Lldb-commits] [lldb] r147157 - in /lldb/trunk: include/lldb/Target/ source/Core/ source/Expression/ source/Plugins/ABI/MacOSX-arm/ source/Plugins/ABI/MacOSX-i386/ source/Plugins/ABI/SysV-x86_64/ source/Plugins/Process/Utility/ source/Symbol/ source/Target/ test/functionalities/return-value/ Message-ID: <20111222191241.98D132A6C12C@llvm.org> Author: jingham Date: Thu Dec 22 13:12:40 2011 New Revision: 147157 URL: http://llvm.org/viewvc/llvm-project?rev=147157&view=rev Log: Improve the x86_64 return value decoder to handle most structure returns. Switch from GetReturnValue, which was hardly ever used, to GetReturnValueObject which is much more convenient. Return the "return value object" as a persistent variable if requested. Added: lldb/trunk/test/functionalities/return-value/ lldb/trunk/test/functionalities/return-value/Makefile lldb/trunk/test/functionalities/return-value/TestReturnValue.py lldb/trunk/test/functionalities/return-value/call-func.c Modified: lldb/trunk/include/lldb/Target/ABI.h lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h lldb/trunk/source/Core/Debugger.cpp lldb/trunk/source/Expression/ClangFunction.cpp lldb/trunk/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp lldb/trunk/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h lldb/trunk/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp lldb/trunk/source/Symbol/ClangASTContext.cpp lldb/trunk/source/Target/ABI.cpp lldb/trunk/source/Target/Thread.cpp lldb/trunk/source/Target/ThreadPlanCallFunction.cpp lldb/trunk/source/Target/ThreadPlanCallUserExpression.cpp Modified: lldb/trunk/include/lldb/Target/ABI.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ABI.h?rev=147157&r1=147156&r2=147157&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/ABI.h (original) +++ lldb/trunk/include/lldb/Target/ABI.h Thu Dec 22 13:12:40 2011 @@ -45,14 +45,19 @@ GetArgumentValues (Thread &thread, ValueList &values) const = 0; - virtual bool - GetReturnValue (Thread &thread, - Value &value) const = 0; - - virtual lldb::ValueObjectSP +public: + lldb::ValueObjectSP GetReturnValueObject (Thread &thread, - ClangASTType &type) const; + ClangASTType &type, + bool persistent = true) const; +protected: + // This is the method the ABI will call to actually calculate the return value. + // Don't put it in a persistant value object, that will be done by the ABI::GetReturnValueObject. + virtual lldb::ValueObjectSP + GetReturnValueObjectImpl (Thread &thread, + ClangASTType &type) const = 0; +public: virtual bool CreateFunctionEntryUnwindPlan (UnwindPlan &unwind_plan) = 0; Modified: lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h?rev=147157&r1=147156&r2=147157&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h (original) +++ lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h Thu Dec 22 13:12:40 2011 @@ -22,9 +22,13 @@ class ThreadPlanCallFunction : public ThreadPlan { + // Create a thread plan to call a function at the address passed in the "function" + // argument. If you plan to call GetReturnValueObject, then pass in the + // return type, otherwise just pass in an invalid ClangASTType. public: ThreadPlanCallFunction (Thread &thread, Address &function, + const ClangASTType &return_type, lldb::addr_t arg, bool stop_other_threads, bool discard_on_error = true, @@ -33,6 +37,7 @@ ThreadPlanCallFunction (Thread &thread, Address &function, + const ClangASTType &return_type, bool stop_other_threads, bool discard_on_error, lldb::addr_t *arg1_ptr = NULL, @@ -90,16 +95,10 @@ // plan is complete, you can call "GetReturnValue()" to retrieve the value // that was extracted. - const lldb::ValueSP & - GetReturnValue () + virtual lldb::ValueObjectSP + GetReturnValueObject () { - return m_return_value_sp; - } - - void - RequestReturnValue (lldb::ValueSP &return_value_sp) - { - m_return_value_sp = return_value_sp; + return m_return_valobj_sp; } // Return the stack pointer that the function received @@ -165,7 +164,8 @@ // thread plans, but for reporting purposes, // it's nice to know the real stop reason. // This gets set in DoTakedown. - lldb::ValueSP m_return_value_sp; // If this contains a valid pointer, use the ABI to extract values when complete + ClangASTType m_return_type; + lldb::ValueObjectSP m_return_valobj_sp; // If this contains a valid pointer, use the ABI to extract values when complete bool m_takedown_done; // We want to ensure we only do the takedown once. This ensures that. lldb::addr_t m_stop_address; // This is the address we stopped at. Also set in DoTakedown; Modified: lldb/trunk/source/Core/Debugger.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=147157&r1=147156&r2=147157&view=diff ============================================================================== --- lldb/trunk/source/Core/Debugger.cpp (original) +++ lldb/trunk/source/Core/Debugger.cpp Thu Dec 22 13:12:40 2011 @@ -1709,12 +1709,9 @@ ValueObjectSP return_valobj_sp = StopInfo::GetReturnValueObject (stop_info_sp); if (return_valobj_sp) { - cstr = return_valobj_sp->GetValueAsCString (); - if (cstr && cstr[0]) - { - s.PutCString(cstr); - var_success = true; - } + ValueObject::DumpValueObjectOptions dump_options; + ValueObject::DumpValueObject (s, return_valobj_sp.get(), dump_options); + var_success = true; } } } @@ -2579,7 +2576,7 @@ MODULE_WITH_FUNC\ FILE_AND_LINE\ "{, stop reason = ${thread.stop-reason}}"\ - "{, return value = ${thread.return-value}}"\ + "{\\nReturn value: ${thread.return-value}}"\ "\\n" //#define DEFAULT_THREAD_FORMAT "thread #${thread.index}: tid = ${thread.id}"\ Modified: lldb/trunk/source/Expression/ClangFunction.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangFunction.cpp?rev=147157&r1=147156&r2=147157&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangFunction.cpp (original) +++ lldb/trunk/source/Expression/ClangFunction.cpp Thu Dec 22 13:12:40 2011 @@ -405,6 +405,7 @@ Address wrapper_address (NULL, func_addr); ThreadPlan *new_plan = new ThreadPlanCallFunction (*thread, wrapper_address, + ClangASTType(), args_addr, stop_others, discard_on_error, @@ -418,7 +419,8 @@ { // Read the return value - it is the last field in the struct: // FIXME: How does clang tell us there's no return value? We need to handle that case. - + // FIXME: Create our ThreadPlanCallFunction with the return ClangASTType, and then use GetReturnValueObject + // to fetch the value. That way we can fetch any values we need. Process *process = exe_ctx.GetProcessPtr(); if (process == NULL) Modified: lldb/trunk/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp?rev=147157&r1=147156&r2=147157&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp (original) +++ lldb/trunk/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp Thu Dec 22 13:12:40 2011 @@ -16,6 +16,7 @@ #include "lldb/Core/RegisterValue.h" #include "lldb/Core/Scalar.h" #include "lldb/Core/Value.h" +#include "lldb/Core/ValueObjectConstResult.h" #include "lldb/Symbol/ClangASTContext.h" #include "lldb/Symbol/UnwindPlan.h" #include "lldb/Target/Process.h" @@ -417,85 +418,92 @@ return true; } -bool -ABIMacOSX_arm::GetReturnValue (Thread &thread, - Value &value) const -{ - switch (value.GetContextType()) +ValueObjectSP +ABIMacOSX_arm::GetReturnValueObjectImpl (Thread &thread, + lldb_private::ClangASTType &ast_type) const +{ + Value value; + ValueObjectSP return_valobj_sp; + + void *value_type = ast_type.GetOpaqueQualType(); + if (!value_type) + return return_valobj_sp; + + clang::ASTContext *ast_context = ast_type.GetASTContext(); + if (!ast_context) + return return_valobj_sp; + + value.SetContext (Value::eContextTypeClangType, value_type); + + RegisterContext *reg_ctx = thread.GetRegisterContext().get(); + if (!reg_ctx) + return return_valobj_sp; + + bool is_signed; + + // Get the pointer to the first stack argument so we have a place to start + // when reading data + + const RegisterInfo *r0_reg_info = reg_ctx->GetRegisterInfoByName("r0", 0); + if (ClangASTContext::IsIntegerType (value_type, is_signed)) { - default: - return false; - case Value::eContextTypeClangType: + size_t bit_width = ClangASTType::GetClangTypeBitWidth(ast_context, value_type); + + switch (bit_width) { - // Extract the Clang AST context from the PC so that we can figure out type - // sizes - - clang::ASTContext *ast_context = thread.CalculateTarget()->GetScratchClangASTContext()->getASTContext(); - - // Get the pointer to the first stack argument so we have a place to start - // when reading data - - RegisterContext *reg_ctx = thread.GetRegisterContext().get(); - - void *value_type = value.GetClangType(); - bool is_signed; - - const RegisterInfo *r0_reg_info = reg_ctx->GetRegisterInfoByName("r0", 0); - if (ClangASTContext::IsIntegerType (value_type, is_signed)) + default: + return return_valobj_sp; + case 64: { - size_t bit_width = ClangASTType::GetClangTypeBitWidth(ast_context, value_type); - - switch (bit_width) - { - default: - return false; - case 64: - { - const RegisterInfo *r1_reg_info = reg_ctx->GetRegisterInfoByName("r1", 0); - uint64_t raw_value; - raw_value = reg_ctx->ReadRegisterAsUnsigned(r0_reg_info, 0) & UINT32_MAX; - raw_value |= ((uint64_t)(reg_ctx->ReadRegisterAsUnsigned(r1_reg_info, 0) & UINT32_MAX)) << 32; - if (is_signed) - value.GetScalar() = (int64_t)raw_value; - else - value.GetScalar() = (uint64_t)raw_value; - } - break; - case 32: - if (is_signed) - value.GetScalar() = (int32_t)(reg_ctx->ReadRegisterAsUnsigned(r0_reg_info, 0) & UINT32_MAX); - else - value.GetScalar() = (uint32_t)(reg_ctx->ReadRegisterAsUnsigned(r0_reg_info, 0) & UINT32_MAX); - break; - case 16: - if (is_signed) - value.GetScalar() = (int16_t)(reg_ctx->ReadRegisterAsUnsigned(r0_reg_info, 0) & UINT16_MAX); - else - value.GetScalar() = (uint16_t)(reg_ctx->ReadRegisterAsUnsigned(r0_reg_info, 0) & UINT16_MAX); - break; - case 8: - if (is_signed) - value.GetScalar() = (int8_t)(reg_ctx->ReadRegisterAsUnsigned(r0_reg_info, 0) & UINT8_MAX); - else - value.GetScalar() = (uint8_t)(reg_ctx->ReadRegisterAsUnsigned(r0_reg_info, 0) & UINT8_MAX); - break; - } - } - else if (ClangASTContext::IsPointerType (value_type)) - { - uint32_t ptr = thread.GetRegisterContext()->ReadRegisterAsUnsigned(r0_reg_info, 0) & UINT32_MAX; - value.GetScalar() = ptr; - } - else - { - // not handled yet - return false; + const RegisterInfo *r1_reg_info = reg_ctx->GetRegisterInfoByName("r1", 0); + uint64_t raw_value; + raw_value = reg_ctx->ReadRegisterAsUnsigned(r0_reg_info, 0) & UINT32_MAX; + raw_value |= ((uint64_t)(reg_ctx->ReadRegisterAsUnsigned(r1_reg_info, 0) & UINT32_MAX)) << 32; + if (is_signed) + value.GetScalar() = (int64_t)raw_value; + else + value.GetScalar() = (uint64_t)raw_value; } + break; + case 32: + if (is_signed) + value.GetScalar() = (int32_t)(reg_ctx->ReadRegisterAsUnsigned(r0_reg_info, 0) & UINT32_MAX); + else + value.GetScalar() = (uint32_t)(reg_ctx->ReadRegisterAsUnsigned(r0_reg_info, 0) & UINT32_MAX); + break; + case 16: + if (is_signed) + value.GetScalar() = (int16_t)(reg_ctx->ReadRegisterAsUnsigned(r0_reg_info, 0) & UINT16_MAX); + else + value.GetScalar() = (uint16_t)(reg_ctx->ReadRegisterAsUnsigned(r0_reg_info, 0) & UINT16_MAX); + break; + case 8: + if (is_signed) + value.GetScalar() = (int8_t)(reg_ctx->ReadRegisterAsUnsigned(r0_reg_info, 0) & UINT8_MAX); + else + value.GetScalar() = (uint8_t)(reg_ctx->ReadRegisterAsUnsigned(r0_reg_info, 0) & UINT8_MAX); + break; } - break; + } + else if (ClangASTContext::IsPointerType (value_type)) + { + uint32_t ptr = thread.GetRegisterContext()->ReadRegisterAsUnsigned(r0_reg_info, 0) & UINT32_MAX; + value.GetScalar() = ptr; + } + else + { + // not handled yet + return return_valobj_sp; } - return true; + // If we get here, we have a valid Value, so make our ValueObject out of it: + + return_valobj_sp = ValueObjectConstResult::Create( + thread.GetStackFrameAtIndex(0).get(), + ast_type.GetASTContext(), + value, + ConstString("")); + return return_valobj_sp; } bool Modified: lldb/trunk/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h?rev=147157&r1=147156&r2=147157&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h (original) +++ lldb/trunk/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h Thu Dec 22 13:12:40 2011 @@ -41,10 +41,12 @@ GetArgumentValues (lldb_private::Thread &thread, lldb_private::ValueList &values) const; - virtual bool - GetReturnValue (lldb_private::Thread &thread, - lldb_private::Value &value) const; +protected: + virtual lldb::ValueObjectSP + GetReturnValueObjectImpl (lldb_private::Thread &thread, + lldb_private::ClangASTType &ast_type) const; +public: virtual bool CreateFunctionEntryUnwindPlan (lldb_private::UnwindPlan &unwind_plan); Modified: lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp?rev=147157&r1=147156&r2=147157&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp (original) +++ lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp Thu Dec 22 13:12:40 2011 @@ -15,6 +15,7 @@ #include "lldb/Core/PluginManager.h" #include "lldb/Core/RegisterValue.h" #include "lldb/Core/Scalar.h" +#include "lldb/Core/ValueObjectConstResult.h" #include "lldb/Symbol/ClangASTContext.h" #include "lldb/Symbol/UnwindPlan.h" #include "lldb/Target/Process.h" @@ -681,87 +682,91 @@ return true; } -bool -ABIMacOSX_i386::GetReturnValue (Thread &thread, - Value &value) const -{ - switch (value.GetContextType()) +ValueObjectSP +ABIMacOSX_i386::GetReturnValueObjectImpl (Thread &thread, + ClangASTType &ast_type) const +{ + Value value; + ValueObjectSP return_valobj_sp; + + void *value_type = ast_type.GetOpaqueQualType(); + if (!value_type) + return return_valobj_sp; + + clang::ASTContext *ast_context = ast_type.GetASTContext(); + if (!ast_context) + return return_valobj_sp; + + value.SetContext (Value::eContextTypeClangType, value_type); + + RegisterContext *reg_ctx = thread.GetRegisterContext().get(); + if (!reg_ctx) + return return_valobj_sp; + + bool is_signed; + + if (ClangASTContext::IsIntegerType (value_type, is_signed)) { - default: - return false; - case Value::eContextTypeClangType: + size_t bit_width = ClangASTType::GetClangTypeBitWidth(ast_context, value_type); + + unsigned eax_id = reg_ctx->GetRegisterInfoByName("eax", 0)->kinds[eRegisterKindLLDB]; + unsigned edx_id = reg_ctx->GetRegisterInfoByName("edx", 0)->kinds[eRegisterKindLLDB]; + + switch (bit_width) { - // Extract the Clang AST context from the PC so that we can figure out type - // sizes - - clang::ASTContext *ast_context = thread.CalculateTarget()->GetScratchClangASTContext()->getASTContext(); - - // Get the pointer to the first stack argument so we have a place to start - // when reading data - - RegisterContext *reg_ctx = thread.GetRegisterContext().get(); - - void *value_type = value.GetClangType(); - bool is_signed; - - if (ClangASTContext::IsIntegerType (value_type, is_signed)) - { - size_t bit_width = ClangASTType::GetClangTypeBitWidth(ast_context, value_type); - - unsigned eax_id = reg_ctx->GetRegisterInfoByName("eax", 0)->kinds[eRegisterKindLLDB]; - unsigned edx_id = reg_ctx->GetRegisterInfoByName("edx", 0)->kinds[eRegisterKindLLDB]; - - switch (bit_width) - { - default: - case 128: - // Scalar can't hold 128-bit literals, so we don't handle this - return false; - case 64: - uint64_t raw_value; - raw_value = thread.GetRegisterContext()->ReadRegisterAsUnsigned(eax_id, 0) & 0xffffffff; - raw_value |= (thread.GetRegisterContext()->ReadRegisterAsUnsigned(edx_id, 0) & 0xffffffff) << 32; - if (is_signed) - value.GetScalar() = (int64_t)raw_value; - else - value.GetScalar() = (uint64_t)raw_value; - break; - case 32: - if (is_signed) - value.GetScalar() = (int32_t)(thread.GetRegisterContext()->ReadRegisterAsUnsigned(eax_id, 0) & 0xffffffff); - else - value.GetScalar() = (uint32_t)(thread.GetRegisterContext()->ReadRegisterAsUnsigned(eax_id, 0) & 0xffffffff); - break; - case 16: - if (is_signed) - value.GetScalar() = (int16_t)(thread.GetRegisterContext()->ReadRegisterAsUnsigned(eax_id, 0) & 0xffff); - else - value.GetScalar() = (uint16_t)(thread.GetRegisterContext()->ReadRegisterAsUnsigned(eax_id, 0) & 0xffff); - break; - case 8: - if (is_signed) - value.GetScalar() = (int8_t)(thread.GetRegisterContext()->ReadRegisterAsUnsigned(eax_id, 0) & 0xff); - else - value.GetScalar() = (uint8_t)(thread.GetRegisterContext()->ReadRegisterAsUnsigned(eax_id, 0) & 0xff); - break; - } - } - else if (ClangASTContext::IsPointerType (value_type)) - { - unsigned eax_id = reg_ctx->GetRegisterInfoByName("eax", 0)->kinds[eRegisterKindLLDB]; - uint32_t ptr = thread.GetRegisterContext()->ReadRegisterAsUnsigned(eax_id, 0) & 0xffffffff; - value.GetScalar() = ptr; - } - else - { - // not handled yet - return false; - } + default: + case 128: + // Scalar can't hold 128-bit literals, so we don't handle this + return return_valobj_sp; + case 64: + uint64_t raw_value; + raw_value = thread.GetRegisterContext()->ReadRegisterAsUnsigned(eax_id, 0) & 0xffffffff; + raw_value |= (thread.GetRegisterContext()->ReadRegisterAsUnsigned(edx_id, 0) & 0xffffffff) << 32; + if (is_signed) + value.GetScalar() = (int64_t)raw_value; + else + value.GetScalar() = (uint64_t)raw_value; + break; + case 32: + if (is_signed) + value.GetScalar() = (int32_t)(thread.GetRegisterContext()->ReadRegisterAsUnsigned(eax_id, 0) & 0xffffffff); + else + value.GetScalar() = (uint32_t)(thread.GetRegisterContext()->ReadRegisterAsUnsigned(eax_id, 0) & 0xffffffff); + break; + case 16: + if (is_signed) + value.GetScalar() = (int16_t)(thread.GetRegisterContext()->ReadRegisterAsUnsigned(eax_id, 0) & 0xffff); + else + value.GetScalar() = (uint16_t)(thread.GetRegisterContext()->ReadRegisterAsUnsigned(eax_id, 0) & 0xffff); + break; + case 8: + if (is_signed) + value.GetScalar() = (int8_t)(thread.GetRegisterContext()->ReadRegisterAsUnsigned(eax_id, 0) & 0xff); + else + value.GetScalar() = (uint8_t)(thread.GetRegisterContext()->ReadRegisterAsUnsigned(eax_id, 0) & 0xff); + break; } - break; + } + else if (ClangASTContext::IsPointerType (value_type)) + { + unsigned eax_id = reg_ctx->GetRegisterInfoByName("eax", 0)->kinds[eRegisterKindLLDB]; + uint32_t ptr = thread.GetRegisterContext()->ReadRegisterAsUnsigned(eax_id, 0) & 0xffffffff; + value.GetScalar() = ptr; + } + else + { + // not handled yet + return return_valobj_sp; } - return true; + // If we get here, we have a valid Value, so make our ValueObject out of it: + + return_valobj_sp = ValueObjectConstResult::Create( + thread.GetStackFrameAtIndex(0).get(), + ast_type.GetASTContext(), + value, + ConstString("")); + return return_valobj_sp; } bool Modified: lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h?rev=147157&r1=147156&r2=147157&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h (original) +++ lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h Thu Dec 22 13:12:40 2011 @@ -51,9 +51,12 @@ GetArgumentValues (lldb_private::Thread &thread, lldb_private::ValueList &values) const; - virtual bool - GetReturnValue (lldb_private::Thread &thread, - lldb_private::Value &value) const; +protected: + virtual lldb::ValueObjectSP + GetReturnValueObjectImpl (lldb_private::Thread &thread, + lldb_private::ClangASTType &ast_type) const; + +public: virtual bool CreateFunctionEntryUnwindPlan (lldb_private::UnwindPlan &unwind_plan); Modified: lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp?rev=147157&r1=147156&r2=147157&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp (original) +++ lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp Thu Dec 22 13:12:40 2011 @@ -17,6 +17,9 @@ #include "lldb/Core/PluginManager.h" #include "lldb/Core/RegisterValue.h" #include "lldb/Core/Value.h" +#include "lldb/Core/ValueObjectConstResult.h" +#include "lldb/Core/ValueObjectRegister.h" +#include "lldb/Core/ValueObjectMemory.h" #include "lldb/Symbol/ClangASTContext.h" #include "lldb/Symbol/UnwindPlan.h" #include "lldb/Target/Target.h" @@ -547,83 +550,404 @@ return true; } -bool -ABISysV_x86_64::GetReturnValue (Thread &thread, - Value &value) const +ValueObjectSP +ABISysV_x86_64::GetReturnValueObjectSimple (Thread &thread, + ClangASTType &ast_type) const { - switch (value.GetContextType()) + ValueObjectSP return_valobj_sp; + Value value; + + clang_type_t value_type = ast_type.GetOpaqueQualType(); + if (!value_type) + return return_valobj_sp; + + clang::ASTContext *ast_context = ast_type.GetASTContext(); + if (!ast_context) + return return_valobj_sp; + + value.SetContext (Value::eContextTypeClangType, value_type); + + RegisterContext *reg_ctx = thread.GetRegisterContext().get(); + if (!reg_ctx) + return return_valobj_sp; + + bool is_signed; + bool is_complex; + uint32_t count; + + if (ClangASTContext::IsIntegerType (value_type, is_signed)) { + // For now, assume that the types in the AST values come from the Target's + // scratch AST. + + + // Extract the register context so we can read arguments from registers + + size_t bit_width = ClangASTType::GetClangTypeBitWidth(ast_context, value_type); + unsigned rax_id = reg_ctx->GetRegisterInfoByName("rax", 0)->kinds[eRegisterKindLLDB]; + + switch (bit_width) + { default: - return false; - case Value::eContextTypeClangType: + case 128: + // Scalar can't hold 128-bit literals, so we don't handle this + return return_valobj_sp; + case 64: + if (is_signed) + value.GetScalar() = (int64_t)(thread.GetRegisterContext()->ReadRegisterAsUnsigned(rax_id, 0)); + else + value.GetScalar() = (uint64_t)(thread.GetRegisterContext()->ReadRegisterAsUnsigned(rax_id, 0)); + break; + case 32: + if (is_signed) + value.GetScalar() = (int32_t)(thread.GetRegisterContext()->ReadRegisterAsUnsigned(rax_id, 0) & 0xffffffff); + else + value.GetScalar() = (uint32_t)(thread.GetRegisterContext()->ReadRegisterAsUnsigned(rax_id, 0) & 0xffffffff); + break; + case 16: + if (is_signed) + value.GetScalar() = (int16_t)(thread.GetRegisterContext()->ReadRegisterAsUnsigned(rax_id, 0) & 0xffff); + else + value.GetScalar() = (uint16_t)(thread.GetRegisterContext()->ReadRegisterAsUnsigned(rax_id, 0) & 0xffff); + break; + case 8: + if (is_signed) + value.GetScalar() = (int8_t)(thread.GetRegisterContext()->ReadRegisterAsUnsigned(rax_id, 0) & 0xff); + else + value.GetScalar() = (uint8_t)(thread.GetRegisterContext()->ReadRegisterAsUnsigned(rax_id, 0) & 0xff); + break; + } + } + else if (ClangASTContext::IsFloatingPointType(value_type, count, is_complex)) + { + // Don't handle complex yet. + if (is_complex) + return return_valobj_sp; + + size_t bit_width = ClangASTType::GetClangTypeBitWidth(ast_context, value_type); + if (bit_width <= 64) + { + const RegisterInfo *xmm0_info = reg_ctx->GetRegisterInfoByName("xmm0", 0); + RegisterValue xmm0_value; + if (reg_ctx->ReadRegister (xmm0_info, xmm0_value)) + { + DataExtractor data; + if (xmm0_value.GetData(data)) + { + uint32_t offset = 0; + switch (bit_width) + { + default: + return return_valobj_sp; + case 32: + value.GetScalar() = (float) data.GetFloat(&offset); + break; + case 64: + value.GetScalar() = (double) data.GetDouble(&offset); + break; + } + } + } + } + else if (bit_width == 128) { - void *value_type = value.GetClangType(); - bool is_signed; + // FIXME: x86_64 returns long doubles in stmm0, which is in some 80 bit long double + // format, and so we'll have to write some code to convert that into 128 bit long doubles. +// const RegisterInfo *st0_info = reg_ctx->GetRegisterInfoByName("stmm0", 0); +// RegisterValue st0_value; +// if (reg_ctx->ReadRegister (st0_info, st0_value)) +// { +// DataExtractor data; +// if (st0_value.GetData(data)) +// { +// uint32_t offset = 0; +// value.GetScalar() = (long double) data.GetLongDouble (&offset); +// return true; +// } +// } - RegisterContext *reg_ctx = thread.GetRegisterContext().get(); + return return_valobj_sp; + } + } + else if (ClangASTContext::IsPointerType (value_type)) + { + unsigned rax_id = reg_ctx->GetRegisterInfoByName("rax", 0)->kinds[eRegisterKindLLDB]; + value.GetScalar() = (uint64_t)thread.GetRegisterContext()->ReadRegisterAsUnsigned(rax_id, 0); + } + else + { + return return_valobj_sp; + } + + // If we get here, we have a valid Value, so make our ValueObject out of it: + + return_valobj_sp = ValueObjectConstResult::Create( + thread.GetStackFrameAtIndex(0).get(), + ast_type.GetASTContext(), + value, + ConstString("")); + return return_valobj_sp; +} + +ValueObjectSP +ABISysV_x86_64::GetReturnValueObjectImpl (Thread &thread, + ClangASTType &ast_type) const +{ + + ValueObjectSP return_valobj_sp; + + return_valobj_sp = GetReturnValueObjectSimple(thread, ast_type); + if (return_valobj_sp) + return return_valobj_sp; + + clang_type_t ret_value_type = ast_type.GetOpaqueQualType(); + if (!ret_value_type) + return return_valobj_sp; + + clang::ASTContext *ast_context = ast_type.GetASTContext(); + if (!ast_context) + return return_valobj_sp; + + RegisterContextSP reg_ctx_sp = thread.GetRegisterContext(); + if (!reg_ctx_sp) + return return_valobj_sp; + + size_t bit_width = ClangASTType::GetClangTypeBitWidth(ast_context, ret_value_type); + if (ClangASTContext::IsAggregateType(ret_value_type)) + { + Target &target = thread.GetProcess().GetTarget(); + bool is_memory = true; + if (bit_width <= 128) + { + ByteOrder target_byte_order = target.GetArchitecture().GetByteOrder(); + DataBufferSP data_sp (new DataBufferHeap(16, 0)); + DataExtractor return_ext (data_sp, + target_byte_order, + target.GetArchitecture().GetAddressByteSize()); + + const RegisterInfo *rax_info = reg_ctx_sp->GetRegisterInfoByName("rax", 0); + const RegisterInfo *rdx_info = reg_ctx_sp->GetRegisterInfoByName("rdx", 0); + const RegisterInfo *xmm0_info = reg_ctx_sp->GetRegisterInfoByName("xmm0", 0); + const RegisterInfo *xmm1_info = reg_ctx_sp->GetRegisterInfoByName("xmm1", 0); - if (!reg_ctx) - return false; + RegisterValue rax_value, rdx_value, xmm0_value, xmm1_value; + reg_ctx_sp->ReadRegister (rax_info, rax_value); + reg_ctx_sp->ReadRegister (rdx_info, rdx_value); + reg_ctx_sp->ReadRegister (xmm0_info, xmm0_value); + reg_ctx_sp->ReadRegister (xmm1_info, xmm1_value); + + DataExtractor rax_data, rdx_data, xmm0_data, xmm1_data; + + rax_value.GetData(rax_data); + rdx_value.GetData(rdx_data); + xmm0_value.GetData(xmm0_data); + xmm1_value.GetData(xmm1_data); + + uint32_t fp_bytes = 0; // Tracks how much of the xmm registers we've consumed so far + uint32_t integer_bytes = 0; // Tracks how much of the rax/rds registers we've consumed so far + + uint32_t num_children = ClangASTContext::GetNumFields (ast_context, ret_value_type); - if (ClangASTContext::IsIntegerType (value_type, is_signed)) + // Since we are in the small struct regime, assume we are not in memory. + is_memory = false; + + for (uint32_t idx = 0; idx < num_children; idx++) { - // For now, assume that the types in the AST values come from the Target's - // scratch AST. + std::string name; + uint32_t field_bit_offset; + bool is_signed; + bool is_complex; + uint32_t count; - clang::ASTContext *ast_context = thread.CalculateTarget()->GetScratchClangASTContext()->getASTContext(); + clang_type_t field_clang_type = ClangASTContext::GetFieldAtIndex (ast_context, ret_value_type, idx, name, &field_bit_offset); + size_t field_bit_width = ClangASTType::GetClangTypeBitWidth(ast_context, field_clang_type); + + // If there are any unaligned fields, this is stored in memory. + if (field_bit_offset % field_bit_width != 0) + { + is_memory = true; + break; + } - // Extract the register context so we can read arguments from registers + uint32_t field_byte_width = field_bit_width/8; + uint32_t field_byte_offset = field_bit_offset/8; - size_t bit_width = ClangASTType::GetClangTypeBitWidth(ast_context, value_type); - unsigned rax_id = reg_ctx->GetRegisterInfoByName("rax", 0)->kinds[eRegisterKindLLDB]; + + DataExtractor *copy_from_extractor = NULL; + uint32_t copy_from_offset = 0; - switch (bit_width) + if (ClangASTContext::IsIntegerType (field_clang_type, is_signed) || ClangASTContext::IsPointerType (field_clang_type)) { - default: - case 128: - // Scalar can't hold 128-bit literals, so we don't handle this - return false; - case 64: - if (is_signed) - value.GetScalar() = (int64_t)(thread.GetRegisterContext()->ReadRegisterAsUnsigned(rax_id, 0)); - else - value.GetScalar() = (uint64_t)(thread.GetRegisterContext()->ReadRegisterAsUnsigned(rax_id, 0)); - break; - case 32: - if (is_signed) - value.GetScalar() = (int32_t)(thread.GetRegisterContext()->ReadRegisterAsUnsigned(rax_id, 0) & 0xffffffff); - else - value.GetScalar() = (uint32_t)(thread.GetRegisterContext()->ReadRegisterAsUnsigned(rax_id, 0) & 0xffffffff); - break; - case 16: - if (is_signed) - value.GetScalar() = (int16_t)(thread.GetRegisterContext()->ReadRegisterAsUnsigned(rax_id, 0) & 0xffff); - else - value.GetScalar() = (uint16_t)(thread.GetRegisterContext()->ReadRegisterAsUnsigned(rax_id, 0) & 0xffff); - break; - case 8: - if (is_signed) - value.GetScalar() = (int8_t)(thread.GetRegisterContext()->ReadRegisterAsUnsigned(rax_id, 0) & 0xff); + if (integer_bytes < 8) + { + if (integer_bytes + field_byte_width <= 8) + { + // This is in RAX, copy from register to our result structure: + copy_from_extractor = &rax_data; + copy_from_offset = integer_bytes; + integer_bytes += field_byte_width; + } + else + { + // The next field wouldn't fit in the remaining space, so we pushed it to rdx. + copy_from_extractor = &rdx_data; + copy_from_offset = 0; + integer_bytes = 8 + field_byte_width; + + } + } + else if (integer_bytes + field_byte_width <= 16) + { + copy_from_extractor = &rdx_data; + copy_from_offset = integer_bytes - 8; + integer_bytes += field_byte_width; + } else - value.GetScalar() = (uint8_t)(thread.GetRegisterContext()->ReadRegisterAsUnsigned(rax_id, 0) & 0xff); - break; + { + // The last field didn't fit. I can't see how that would happen w/o the overall size being + // greater than 16 bytes. For now, return a NULL return value object. + return return_valobj_sp; + } } + else if (ClangASTContext::IsFloatingPointType (field_clang_type, count, is_complex)) + { + // Structs with long doubles are always passed in memory. + if (field_bit_width == 128) + { + is_memory = true; + break; + } + else if (field_bit_width == 64) + { + // These have to be in a single xmm register. + if (fp_bytes == 0) + copy_from_extractor = &xmm0_data; + else + copy_from_extractor = &xmm1_data; + + copy_from_offset = 0; + fp_bytes += field_byte_width; + } + else if (field_bit_width == 32) + { + // This one is kind of complicated. If we are in an "eightbyte" with another float, we'll + // be stuffed into an xmm register with it. If we are in an "eightbyte" with one or more ints, + // then we will be stuffed into the appropriate GPR with them. + bool in_gpr; + if (field_byte_offset % 8 == 0) + { + // We are at the beginning of one of the eightbytes, so check the next element (if any) + if (idx == num_children - 1) + in_gpr = true; + else + { + uint32_t next_field_bit_offset; + clang_type_t next_field_clang_type = ClangASTContext::GetFieldAtIndex (ast_context, + ret_value_type, + idx + 1, + name, + &next_field_bit_offset); + if (ClangASTContext::IsIntegerType (next_field_clang_type, is_signed)) + in_gpr = true; + else + { + copy_from_offset = 0; + in_gpr = false; + } + } + + } + else if (field_byte_offset % 4 == 0) + { + // We are inside of an eightbyte, so see if the field before us is floating point: + // This could happen if somebody put padding in the structure. + if (idx == 0) + in_gpr = false; + else + { + uint32_t prev_field_bit_offset; + clang_type_t prev_field_clang_type = ClangASTContext::GetFieldAtIndex (ast_context, + ret_value_type, + idx - 1, + name, + &prev_field_bit_offset); + if (ClangASTContext::IsIntegerType (prev_field_clang_type, is_signed)) + in_gpr = true; + else + { + copy_from_offset = 4; + in_gpr = false; + } + } + + } + else + { + is_memory = true; + continue; + } + + // Okay, we've figured out whether we are in GPR or XMM, now figure out which one. + if (in_gpr) + { + if (integer_bytes < 8) + { + // This is in RAX, copy from register to our result structure: + copy_from_extractor = &rax_data; + copy_from_offset = integer_bytes; + integer_bytes += field_byte_width; + } + else + { + copy_from_extractor = &rdx_data; + copy_from_offset = integer_bytes - 8; + integer_bytes += field_byte_width; + } + } + else + { + if (fp_bytes < 8) + copy_from_extractor = &xmm0_data; + else + copy_from_extractor = &xmm1_data; + + fp_bytes += field_byte_width; + } + } + } + if (!copy_from_extractor) + return return_valobj_sp; + + copy_from_extractor->CopyByteOrderedData (copy_from_offset, + field_byte_width, + data_sp->GetBytes() + field_byte_offset, + field_byte_width, + target_byte_order); } - else if (ClangASTContext::IsPointerType (value_type)) - { - unsigned rax_id = reg_ctx->GetRegisterInfoByName("rax", 0)->kinds[eRegisterKindLLDB]; - value.GetScalar() = (uint64_t)thread.GetRegisterContext()->ReadRegisterAsUnsigned(rax_id, 0); - } - else + + if (!is_memory) { - // not handled yet - return false; + // The result is in our data buffer. Let's make a variable object out of it: + return_valobj_sp = ValueObjectConstResult::Create (&thread, + ast_context, + ret_value_type, + ConstString(""), + return_ext); } } - break; + + if (is_memory) + { + unsigned rax_id = reg_ctx_sp->GetRegisterInfoByName("rax", 0)->kinds[eRegisterKindLLDB]; + lldb::addr_t storage_addr = (uint64_t)thread.GetRegisterContext()->ReadRegisterAsUnsigned(rax_id, 0); + return_valobj_sp = ValueObjectMemory::Create (&thread, + "", + Address (storage_addr, NULL), + ast_type); + } } - - return true; + + return return_valobj_sp; } bool Modified: lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h?rev=147157&r1=147156&r2=147157&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h (original) +++ lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h Thu Dec 22 13:12:40 2011 @@ -45,10 +45,15 @@ GetArgumentValues (lldb_private::Thread &thread, lldb_private::ValueList &values) const; - virtual bool - GetReturnValue (lldb_private::Thread &thread, - lldb_private::Value &value) const; - +protected: + lldb::ValueObjectSP + GetReturnValueObjectSimple (lldb_private::Thread &thread, + lldb_private::ClangASTType &ast_type) const; +public: + virtual lldb::ValueObjectSP + GetReturnValueObjectImpl (lldb_private::Thread &thread, + lldb_private::ClangASTType &type) const; + virtual bool CreateFunctionEntryUnwindPlan (lldb_private::UnwindPlan &unwind_plan); Modified: lldb/trunk/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp?rev=147157&r1=147156&r2=147157&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp Thu Dec 22 13:12:40 2011 @@ -9,7 +9,7 @@ #include "InferiorCallPOSIX.h" #include "lldb/Core/StreamFile.h" -#include "lldb/Core/Value.h" +#include "lldb/Core/ValueObject.h" #include "lldb/Symbol/SymbolContext.h" #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/Process.h" @@ -70,9 +70,12 @@ AddressRange mmap_range; if (sc.GetAddressRange(range_scope, 0, use_inline_block_range, mmap_range)) { + ClangASTContext *clang_ast_context = process->GetTarget().GetScratchClangASTContext(); + lldb::clang_type_t clang_void_ptr_type = clang_ast_context->GetVoidPtrType(false); ThreadPlanCallFunction *call_function_thread_plan = new ThreadPlanCallFunction (*thread, mmap_range.GetBaseAddress(), + ClangASTType (clang_ast_context->getASTContext(), clang_void_ptr_type), stop_other_threads, discard_on_error, &addr, @@ -84,13 +87,6 @@ lldb::ThreadPlanSP call_plan_sp (call_function_thread_plan); if (call_plan_sp) { - ValueSP return_value_sp (new Value); - ClangASTContext *clang_ast_context = process->GetTarget().GetScratchClangASTContext(); - lldb::clang_type_t clang_void_ptr_type = clang_ast_context->GetVoidPtrType(false); - return_value_sp->SetValueType (Value::eValueTypeScalar); - return_value_sp->SetContext (Value::eContextTypeClangType, clang_void_ptr_type); - call_function_thread_plan->RequestReturnValue (return_value_sp); - StreamFile error_strm; StackFrame *frame = thread->GetStackFrameAtIndex (0).get(); if (frame) @@ -106,7 +102,8 @@ error_strm); if (result == eExecutionCompleted) { - allocated_addr = return_value_sp->GetScalar().ULongLong(); + + allocated_addr = call_plan_sp->GetReturnValueObject()->GetValueAsUnsigned(LLDB_INVALID_ADDRESS); if (process->GetAddressByteSize() == 4) { if (allocated_addr == UINT32_MAX) @@ -155,6 +152,7 @@ { lldb::ThreadPlanSP call_plan_sp (new ThreadPlanCallFunction (*thread, munmap_range.GetBaseAddress(), + ClangASTType(), stop_other_threads, discard_on_error, &addr, Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=147157&r1=147156&r2=147157&view=diff ============================================================================== --- lldb/trunk/source/Symbol/ClangASTContext.cpp (original) +++ lldb/trunk/source/Symbol/ClangASTContext.cpp Thu Dec 22 13:12:40 2011 @@ -5411,9 +5411,10 @@ if (builtin_type) { if (builtin_type->isInteger()) + { is_signed = builtin_type->isSignedInteger(); - - return true; + return true; + } } return false; Modified: lldb/trunk/source/Target/ABI.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ABI.cpp?rev=147157&r1=147156&r2=147157&view=diff ============================================================================== --- lldb/trunk/source/Target/ABI.cpp (original) +++ lldb/trunk/source/Target/ABI.cpp Thu Dec 22 13:12:40 2011 @@ -12,6 +12,7 @@ #include "lldb/Core/Value.h" #include "lldb/Core/ValueObjectConstResult.h" #include "lldb/Symbol/ClangASTType.h" +#include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" using namespace lldb; @@ -104,25 +105,69 @@ ValueObjectSP ABI::GetReturnValueObject (Thread &thread, - ClangASTType &ast_type) const + ClangASTType &ast_type, + bool persistent) const { if (!ast_type.IsValid()) return ValueObjectSP(); - Value ret_value; - ret_value.SetContext(Value::eContextTypeClangType, - ast_type.GetOpaqueQualType()); - if (GetReturnValue (thread, ret_value)) + ValueObjectSP return_valobj_sp; + + return_valobj_sp = GetReturnValueObjectImpl(thread, ast_type); + if (!return_valobj_sp) + return return_valobj_sp; + + // Now turn this into a persistent variable. + // FIXME: This code is duplicated from Target::EvaluateExpression, and it is used in similar form in a couple + // of other places. Figure out the correct Create function to do all this work. + + if (persistent) { - return ValueObjectConstResult::Create( - thread.GetStackFrameAtIndex(0).get(), - ast_type.GetASTContext(), - ret_value, - ConstString("FunctionReturn")); + ClangPersistentVariables& persistent_variables = thread.GetProcess().GetTarget().GetPersistentVariables(); + ConstString persistent_variable_name (persistent_variables.GetNextPersistentVariableName()); + + lldb::ValueObjectSP const_valobj_sp; + + // Check in case our value is already a constant value + if (return_valobj_sp->GetIsConstant()) + { + const_valobj_sp = return_valobj_sp; + const_valobj_sp->SetName (persistent_variable_name); + } + else + const_valobj_sp = return_valobj_sp->CreateConstantValue (persistent_variable_name); + + lldb::ValueObjectSP live_valobj_sp = return_valobj_sp; + + return_valobj_sp = const_valobj_sp; + + ClangExpressionVariableSP clang_expr_variable_sp(persistent_variables.CreatePersistentVariable(return_valobj_sp)); + + assert (clang_expr_variable_sp.get()); + + // Set flags and live data as appropriate + + const Value &result_value = live_valobj_sp->GetValue(); + + switch (result_value.GetValueType()) + { + case Value::eValueTypeHostAddress: + case Value::eValueTypeFileAddress: + // we don't do anything with these for now + break; + case Value::eValueTypeScalar: + clang_expr_variable_sp->m_flags |= ClangExpressionVariable::EVIsLLDBAllocated; + clang_expr_variable_sp->m_flags |= ClangExpressionVariable::EVNeedsAllocation; + break; + case Value::eValueTypeLoadAddress: + clang_expr_variable_sp->m_live_sp = live_valobj_sp; + clang_expr_variable_sp->m_flags |= ClangExpressionVariable::EVIsProgramReference; + break; + } + return_valobj_sp = clang_expr_variable_sp->GetValueObject(); } - else - return ValueObjectSP(); + return return_valobj_sp; } Modified: lldb/trunk/source/Target/Thread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=147157&r1=147156&r2=147157&view=diff ============================================================================== --- lldb/trunk/source/Target/Thread.cpp (original) +++ lldb/trunk/source/Target/Thread.cpp Thu Dec 22 13:12:40 2011 @@ -861,7 +861,7 @@ bool stop_other_threads, bool discard_on_error) { - ThreadPlanSP thread_plan_sp (new ThreadPlanCallFunction (*this, function, arg, stop_other_threads, discard_on_error)); + ThreadPlanSP thread_plan_sp (new ThreadPlanCallFunction (*this, function, ClangASTType(), arg, stop_other_threads, discard_on_error)); QueueThreadPlan (thread_plan_sp, abort_other_plans); return thread_plan_sp.get(); } Modified: lldb/trunk/source/Target/ThreadPlanCallFunction.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanCallFunction.cpp?rev=147157&r1=147156&r2=147157&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanCallFunction.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanCallFunction.cpp Thu Dec 22 13:12:40 2011 @@ -37,6 +37,7 @@ ThreadPlanCallFunction::ThreadPlanCallFunction (Thread &thread, Address &function, + const ClangASTType &return_type, addr_t arg, bool stop_other_threads, bool discard_on_error, @@ -47,6 +48,7 @@ m_stop_other_threads (stop_other_threads), m_function_addr (function), m_function_sp (NULL), + m_return_type (return_type), m_takedown_done (false), m_stop_address (LLDB_INVALID_ADDRESS) { @@ -149,6 +151,7 @@ ThreadPlanCallFunction::ThreadPlanCallFunction (Thread &thread, Address &function, + const ClangASTType &return_type, bool stop_other_threads, bool discard_on_error, addr_t *arg1_ptr, @@ -162,6 +165,7 @@ m_stop_other_threads (stop_other_threads), m_function_addr (function), m_function_sp(NULL), + m_return_type (return_type), m_takedown_done (false) { SetOkayToDiscard (discard_on_error); @@ -281,13 +285,12 @@ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); if (!m_takedown_done) { - // TODO: how do we tell if all went well? - if (m_return_value_sp) + const ABI *abi = m_thread.GetProcess().GetABI().get(); + if (abi && m_return_type.IsValid()) { - const ABI *abi = m_thread.GetProcess().GetABI().get(); - if (abi) - abi->GetReturnValue(m_thread, *m_return_value_sp); + m_return_valobj_sp = abi->GetReturnValueObject (m_thread, m_return_type); } + if (log) log->Printf ("DoTakedown called for thread 0x%4.4llx, m_valid: %d complete: %d.\n", m_thread.GetID(), m_valid, IsPlanComplete()); m_takedown_done = true; Modified: lldb/trunk/source/Target/ThreadPlanCallUserExpression.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanCallUserExpression.cpp?rev=147157&r1=147156&r2=147157&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanCallUserExpression.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanCallUserExpression.cpp Thu Dec 22 13:12:40 2011 @@ -44,7 +44,7 @@ lldb::addr_t *this_arg, lldb::addr_t *cmd_arg, ClangUserExpression::ClangUserExpressionSP &user_expression_sp) : - ThreadPlanCallFunction (thread, function, arg, stop_other_threads, discard_on_error, this_arg, cmd_arg), + ThreadPlanCallFunction (thread, function, ClangASTType(), arg, stop_other_threads, discard_on_error, this_arg, cmd_arg), m_user_expression_sp (user_expression_sp) { } Added: lldb/trunk/test/functionalities/return-value/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/return-value/Makefile?rev=147157&view=auto ============================================================================== --- lldb/trunk/test/functionalities/return-value/Makefile (added) +++ lldb/trunk/test/functionalities/return-value/Makefile Thu Dec 22 13:12:40 2011 @@ -0,0 +1,5 @@ +LEVEL = ../../make + +C_SOURCES := call-func.c + +include $(LEVEL)/Makefile.rules Added: lldb/trunk/test/functionalities/return-value/TestReturnValue.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/return-value/TestReturnValue.py?rev=147157&view=auto ============================================================================== --- lldb/trunk/test/functionalities/return-value/TestReturnValue.py (added) +++ lldb/trunk/test/functionalities/return-value/TestReturnValue.py Thu Dec 22 13:12:40 2011 @@ -0,0 +1,127 @@ +""" +Test getting return-values correctly when stepping out +""" + +import os, time +import re +import unittest2 +import lldb, lldbutil +from lldbtest import * + +class ReturnValueTestCase(TestBase): + + mydir = os.path.join("functionalities", "return-value") + + @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") + @python_api_test + def test_with_dsym_python(self): + """Test getting return values from stepping out with dsyms.""" + self.buildDsym() + self.do_return_value() + + @python_api_test + def test_with_dwarf_python(self): + """Test getting return values from stepping out.""" + self.buildDwarf() + self.do_return_value() + + def do_return_value(self): + """Test getting return values from stepping out.""" + exe = os.path.join(os.getcwd(), "a.out") + error = lldb.SBError() + + target = self.dbg.CreateTarget(exe) + self.assertTrue(target, VALID_TARGET) + + inner_sint_bkpt = target.BreakpointCreateByName("inner_sint", exe) + self.assertTrue(inner_sint_bkpt, VALID_BREAKPOINT) + + # Now launch the process, and do not stop at entry point. + process = target.LaunchSimple(None, None, os.getcwd()) + + self.assertTrue(process, PROCESS_IS_VALID) + + # The stop reason of the thread should be breakpoint. + self.assertTrue(process.GetState() == lldb.eStateStopped, + STOPPED_DUE_TO_BREAKPOINT) + + # Now finish, and make sure the return value is correct. + thread = lldbutil.get_stopped_thread (process, lldb.eStopReasonBreakpoint) + + thread.StepOut(); + + self.assertTrue (process.GetState() == lldb.eStateStopped) + self.assertTrue (thread.GetStopReason() == lldb.eStopReasonPlanComplete) + + frame = thread.GetFrameAtIndex(0) + fun_name = frame.GetFunctionName() + self.assertTrue (fun_name == "outer_sint") + + return_value = thread.GetStopReturnValue() + self.assertTrue (return_value.IsValid()) + + in_int = frame.FindVariable ("value").GetValueAsSigned(error) + self.assertTrue (error.Success()) + ret_int = return_value.GetValueAsSigned(error) + self.assertTrue (error.Success()) + self.assertTrue (in_int == ret_int) + + # Run again and we will stop in inner_sint the second time outer_sint is called. + #Then test stepping out two frames at once: + + process.Continue() + thread_list = lldbutil.get_threads_stopped_at_breakpoint (process, inner_sint_bkpt) + self.assertTrue(len(thread_list) == 1) + thread = thread_list[0] + + frame = thread.GetFrameAtIndex(1) + fun_name = frame.GetFunctionName () + self.assertTrue (fun_name == "outer_sint") + in_int = frame.FindVariable ("value").GetValueAsSigned(error) + self.assertTrue (error.Success()) + + thread.StepOutOfFrame (frame) + + self.assertTrue (process.GetState() == lldb.eStateStopped) + self.assertTrue (thread.GetStopReason() == lldb.eStopReasonPlanComplete) + frame = thread.GetFrameAtIndex(0) + fun_name = frame.GetFunctionName() + self.assertTrue (fun_name == "main") + + ret_value = thread.GetStopReturnValue() + self.assertTrue (return_value.IsValid()) + ret_int = ret_value.GetValueAsSigned (error) + self.assertTrue (error.Success()) + self.assertTrue (in_int == ret_int) + + # Now try some simple returns that have different types: + inner_float_bkpt = target.BreakpointCreateByName("inner_float", exe) + self.assertTrue(inner_float_bkpt, VALID_BREAKPOINT) + process.Continue() + thread_list = lldbutil.get_threads_stopped_at_breakpoint (process, inner_float_bkpt) + self.assertTrue (len(thread_list) == 1) + thread = thread_list[0] + + frame = thread.GetFrameAtIndex(0) + in_value = frame.FindVariable ("value") + in_float = float (in_value.GetValue()) + thread.StepOut() + + self.assertTrue (process.GetState() == lldb.eStateStopped) + self.assertTrue (thread.GetStopReason() == lldb.eStopReasonPlanComplete) + + frame = thread.GetFrameAtIndex(0) + fun_name = frame.GetFunctionName() + self.assertTrue (fun_name == "outer_float") + + return_value = thread.GetStopReturnValue() + self.assertTrue (return_value.IsValid()) + return_float = float (return_value.GetValue()) + + self.assertTrue(in_float == return_float) + +if __name__ == '__main__': + import atexit + lldb.SBDebugger.Initialize() + atexit.register(lambda: lldb.SBDebugger.Terminate()) + unittest2.main() Added: lldb/trunk/test/functionalities/return-value/call-func.c URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/return-value/call-func.c?rev=147157&view=auto ============================================================================== --- lldb/trunk/test/functionalities/return-value/call-func.c (added) +++ lldb/trunk/test/functionalities/return-value/call-func.c Thu Dec 22 13:12:40 2011 @@ -0,0 +1,90 @@ +int +inner_sint (int value) +{ + return value; +} + +int +outer_sint (int value) +{ + return inner_sint (value); +} + +float +inner_float (float value) +{ + return value; +} + +float +outer_float (float value) +{ + return inner_float(value); +} + +double +inner_double (double value) +{ + return value; +} + +double +outer_double (double value) +{ + return inner_double(value); +} + +long double +inner_long_double (long double value) +{ + return value; +} + +long double +outer_long_double (long double value) +{ + return inner_long_double(value); +} + +struct +large_return_struct +{ + long long first_long; + long long second_long; + long long third_long; + long long fourth_long; + +}; + +struct large_return_struct +return_large_struct (long long first, long long second, long long third, long long fourth) +{ + return (struct large_return_struct) {first, second, third, fourth}; +} + +int +main () +{ + int first_int = 123456; + int second_int = 234567; + + outer_sint (first_int); + outer_sint (second_int); + + float float_value = 12.34; + + outer_float (float_value); + + double double_value = -23.45; + + outer_double (double_value); + + long double long_double_value = -3456789.987654321; + + outer_long_double (long_double_value); + + return_large_struct (10, 20, 30, 40); + + return 0; + +} From johnny.chen at apple.com Thu Dec 22 13:21:47 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Thu, 22 Dec 2011 19:21:47 -0000 Subject: [Lldb-commits] [lldb] r147160 - in /lldb/trunk/test: api/check_public_api_headers/Makefile api/check_public_api_headers/TestPublicAPIHeaders.py macosx/order/TestOrderFile.py Message-ID: <20111222192147.362292A6C12C@llvm.org> Author: johnny Date: Thu Dec 22 13:21:46 2011 New Revision: 147160 URL: http://llvm.org/viewvc/llvm-project?rev=147160&view=rev Log: Patches for running some of the Linux tests from Dawn, thanks! With some minor modification from me. Modified: lldb/trunk/test/api/check_public_api_headers/Makefile lldb/trunk/test/api/check_public_api_headers/TestPublicAPIHeaders.py lldb/trunk/test/macosx/order/TestOrderFile.py Modified: lldb/trunk/test/api/check_public_api_headers/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/api/check_public_api_headers/Makefile?rev=147160&r1=147159&r2=147160&view=diff ============================================================================== --- lldb/trunk/test/api/check_public_api_headers/Makefile (original) +++ lldb/trunk/test/api/check_public_api_headers/Makefile Thu Dec 22 13:21:46 2011 @@ -1,7 +1,13 @@ LEVEL = ../../make CXX_SOURCES := main.cpp -LD_EXTRAS ?= -framework LLDB + +MY_OS = $(shell uname -s) +ifeq "$(MY_OS)" "Darwin" + LD_EXTRAS ?= -framework LLDB +else + LD_EXTRAS ?= $(LLDB_BUILD_DIR)/_lldb.so +endif # Example dictionary to pass to the Python build method: # 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=147160&r1=147159&r2=147160&view=diff ============================================================================== --- lldb/trunk/test/api/check_public_api_headers/TestPublicAPIHeaders.py (original) +++ lldb/trunk/test/api/check_public_api_headers/TestPublicAPIHeaders.py Thu Dec 22 13:21:46 2011 @@ -26,7 +26,10 @@ # Call the program generator to produce main.cpp. self.generate_main_cpp() - d = {'FRAMEWORK_INCLUDES' : "-F%s" % self.build_dir} + if sys.platform.startswith("darwin"): + d = {'FRAMEWORK_INCLUDES' : "-F%s" % self.build_dir} + if sys.platform.startswith("linux"): + d = {'FRAMEWORK_INCLUDES' : "-I%s" % os.path.join(os.environ["LLDB_SRC"], "include")} self.buildDefault(dictionary=d) self.exe_name = 'a.out' self.sanity_check_executable(self.exe_name) @@ -45,6 +48,8 @@ # For different platforms, the include statement can vary. if sys.platform.startswith("darwin"): include_stmt = "'#include <%s>' % os.path.join('LLDB', header)" + if sys.platform.startswith("linux"): + include_stmt = "'#include <%s>' % os.path.join(public_api_dir, header)" list = [eval(include_stmt) for header in public_headers if (header.startswith("SB") and header.endswith(".h"))] includes = '\n'.join(list) @@ -66,6 +71,9 @@ if sys.platform.startswith("darwin"): env_var = 'DYLD_FRAMEWORK_PATH' env_val = self.build_dir + if sys.platform.startswith("linux"): + env_var = 'LD_LIBRARY_PATH' + env_val = self.build_dir env_cmd = "settings set target.env-vars %s=%s" %(env_var, env_val) if self.TraceOn(): Modified: lldb/trunk/test/macosx/order/TestOrderFile.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/order/TestOrderFile.py?rev=147160&r1=147159&r2=147160&view=diff ============================================================================== --- lldb/trunk/test/macosx/order/TestOrderFile.py (original) +++ lldb/trunk/test/macosx/order/TestOrderFile.py Thu Dec 22 13:21:46 2011 @@ -18,6 +18,7 @@ self.buildDsym() self.order_file() + @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") def test_with_dwarf(self): """Test debug symbols follow the correct order by the order file.""" self.buildDwarf() From johnny.chen at apple.com Thu Dec 22 13:28:08 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Thu, 22 Dec 2011 11:28:08 -0800 Subject: [Lldb-commits] [PATCH] fixes for linux tests In-Reply-To: <20111222010513.GA32182@bloodbath.burble.org> References: <20111222010513.GA32182@bloodbath.burble.org> Message-ID: <5D50D2FC-A067-4373-943B-E4AE550C778A@apple.com> Hi Dawn, Checked in, thanks! URL: http://llvm.org/viewvc/llvm-project?rev=147160&view=rev Log: Patches for running some of the Linux tests from Dawn, thanks! With some minor modification from me. Modified: lldb/trunk/test/api/check_public_api_headers/Makefile lldb/trunk/test/api/check_public_api_headers/TestPublicAPIHeaders.py lldb/trunk/test/macosx/order/TestOrderFile.py On Dec 21, 2011, at 5:05 PM, dawn at burble.org wrote: > Here's a few fixes for running some of the Linux tests. > Please review. Ok to commit? > Thanks! > -Dawn > _______________________________________________ > lldb-commits mailing list > lldb-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/lldb-commits/attachments/20111222/8290f923/attachment.html From johnny.chen at apple.com Thu Dec 22 14:21:46 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Thu, 22 Dec 2011 20:21:46 -0000 Subject: [Lldb-commits] [lldb] r147172 - /lldb/trunk/test/lldbutil.py Message-ID: <20111222202146.9F96D2A6C12C@llvm.org> Author: johnny Date: Thu Dec 22 14:21:46 2011 New Revision: 147172 URL: http://llvm.org/viewvc/llvm-project?rev=147172&view=rev Log: Indentation. Modified: lldb/trunk/test/lldbutil.py Modified: lldb/trunk/test/lldbutil.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbutil.py?rev=147172&r1=147171&r2=147172&view=diff ============================================================================== --- lldb/trunk/test/lldbutil.py (original) +++ lldb/trunk/test/lldbutil.py Thu Dec 22 14:21:46 2011 @@ -311,7 +311,7 @@ return threads for thread in stopped_threads: - # Make sure we've hit our breakpoint... + # Make sure we've hit our breakpoint... break_id = thread.GetStopReasonDataAtIndex (0) if break_id == bkpt.GetID(): threads.append(thread) From johnny.chen at apple.com Thu Dec 22 15:14:32 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Thu, 22 Dec 2011 21:14:32 -0000 Subject: [Lldb-commits] [lldb] r147177 - in /lldb/trunk/test: functionalities/return-value/TestReturnValue.py lldbtest.py Message-ID: <20111222211432.425452A6C12C@llvm.org> Author: johnny Date: Thu Dec 22 15:14:31 2011 New Revision: 147177 URL: http://llvm.org/viewvc/llvm-project?rev=147177&view=rev Log: Decorate the two test cases in TestReturnValue.py as i386 only expectedFailure, aka @expectedFailurei386. Modified: lldb/trunk/test/functionalities/return-value/TestReturnValue.py lldb/trunk/test/lldbtest.py Modified: lldb/trunk/test/functionalities/return-value/TestReturnValue.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/return-value/TestReturnValue.py?rev=147177&r1=147176&r2=147177&view=diff ============================================================================== --- lldb/trunk/test/functionalities/return-value/TestReturnValue.py (original) +++ lldb/trunk/test/functionalities/return-value/TestReturnValue.py Thu Dec 22 15:14:31 2011 @@ -13,12 +13,14 @@ mydir = os.path.join("functionalities", "return-value") @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") + @expectedFailurei386 @python_api_test def test_with_dsym_python(self): """Test getting return values from stepping out with dsyms.""" self.buildDsym() self.do_return_value() + @expectedFailurei386 @python_api_test def test_with_dwarf_python(self): """Test getting return values from stepping out.""" Modified: lldb/trunk/test/lldbtest.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=147177&r1=147176&r2=147177&view=diff ============================================================================== --- lldb/trunk/test/lldbtest.py (original) +++ lldb/trunk/test/lldbtest.py Thu Dec 22 15:14:31 2011 @@ -394,6 +394,27 @@ raise case._UnexpectedSuccess return wrapper +def expectedFailurei386(func): + """Decorate the item as an i386 only expectedFailure.""" + if isinstance(func, type) and issubclass(func, unittest2.TestCase): + raise Exception("@expectedFailurei386 can only be used to decorate a test method") + @wraps(func) + def wrapper(*args, **kwargs): + from unittest2 import case + self = args[0] + arch = self.getArchitecture() + try: + func(*args, **kwargs) + except Exception: + if "i386" in arch: + raise case._ExpectedFailure(sys.exc_info()) + else: + raise + + if "i386" in arch: + raise case._UnexpectedSuccess + return wrapper + class Base(unittest2.TestCase): """ Abstract base for performing lldb (see TestBase) or other generic tests (see From scallanan at apple.com Thu Dec 22 15:24:49 2011 From: scallanan at apple.com (Sean Callanan) Date: Thu, 22 Dec 2011 21:24:49 -0000 Subject: [Lldb-commits] [lldb] r147178 - /lldb/trunk/source/Expression/IRForTarget.cpp Message-ID: <20111222212449.9C43E2A6C12C@llvm.org> Author: spyffe Date: Thu Dec 22 15:24:49 2011 New Revision: 147178 URL: http://llvm.org/viewvc/llvm-project?rev=147178&view=rev Log: Added checking to prevent a rare crash when getting the name for an external variable in the IR. Modified: lldb/trunk/source/Expression/IRForTarget.cpp Modified: lldb/trunk/source/Expression/IRForTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRForTarget.cpp?rev=147178&r1=147177&r2=147178&view=diff ============================================================================== --- lldb/trunk/source/Expression/IRForTarget.cpp (original) +++ lldb/trunk/source/Expression/IRForTarget.cpp Thu Dec 22 15:24:49 2011 @@ -1831,19 +1831,27 @@ global != end; ++global) { + if (!global) + { + if (m_error_stream) + m_error_stream->Printf("Internal error [IRForTarget]: global variable is NULL"); + + return false; + } + + std::string global_name = (*global).getName().str(); + if (log) log->Printf("Examining %s, DeclForGlobalValue returns %p", - (*global).getName().str().c_str(), + global_name.c_str(), DeclForGlobal(global)); - - std::string global_name = (*global).getName().str(); if (global_name.find("OBJC_IVAR") == 0) { if (!HandleSymbol(global)) { if (m_error_stream) - m_error_stream->Printf("Error [IRForTarget]: Couldn't find Objective-C indirect ivar symbol %s\n", (*global).getName().str().c_str()); + m_error_stream->Printf("Error [IRForTarget]: Couldn't find Objective-C indirect ivar symbol %s\n", global_name.c_str()); return false; } @@ -1863,7 +1871,7 @@ if (!MaybeHandleVariable (global)) { if (m_error_stream) - m_error_stream->Printf("Internal error [IRForTarget]: Couldn't rewrite external variable %s\n", (*global).getName().str().c_str()); + m_error_stream->Printf("Internal error [IRForTarget]: Couldn't rewrite external variable %s\n", global_name.c_str()); return false; } From scallanan at apple.com Thu Dec 22 16:45:54 2011 From: scallanan at apple.com (Sean Callanan) Date: Thu, 22 Dec 2011 22:45:54 -0000 Subject: [Lldb-commits] [lldb] r147193 - in /lldb/trunk: lldb.xcodeproj/project.pbxproj resources/LLDB-Info.plist tools/debugserver/debugserver.xcodeproj/project.pbxproj Message-ID: <20111222224555.0F7D32A6C12C@llvm.org> Author: spyffe Date: Thu Dec 22 16:45:54 2011 New Revision: 147193 URL: http://llvm.org/viewvc/llvm-project?rev=147193&view=rev Log: Updating Xcode project version numbers for lldb-100 and debugserver-159 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=147193&r1=147192&r2=147193&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu Dec 22 16:45:54 2011 @@ -3733,9 +3733,9 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CURRENT_PROJECT_VERSION = 99; + CURRENT_PROJECT_VERSION = 100; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 99; + DYLIB_CURRENT_VERSION = 100; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3793,10 +3793,10 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CURRENT_PROJECT_VERSION = 99; + CURRENT_PROJECT_VERSION = 100; DEAD_CODE_STRIPPING = YES; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 99; + DYLIB_CURRENT_VERSION = 100; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3852,8 +3852,8 @@ 2689FFD513353D7A00698AC0 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 99; - DYLIB_CURRENT_VERSION = 99; + CURRENT_PROJECT_VERSION = 100; + DYLIB_CURRENT_VERSION = 100; EXECUTABLE_EXTENSION = a; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3881,8 +3881,8 @@ 2689FFD613353D7A00698AC0 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 99; - DYLIB_CURRENT_VERSION = 99; + CURRENT_PROJECT_VERSION = 100; + DYLIB_CURRENT_VERSION = 100; EXECUTABLE_EXTENSION = a; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3910,8 +3910,8 @@ 2689FFD713353D7A00698AC0 /* BuildAndIntegration */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 99; - DYLIB_CURRENT_VERSION = 99; + CURRENT_PROJECT_VERSION = 100; + DYLIB_CURRENT_VERSION = 100; EXECUTABLE_EXTENSION = a; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3991,7 +3991,7 @@ isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 99; + CURRENT_PROJECT_VERSION = 100; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", @@ -4022,10 +4022,10 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 99; + CURRENT_PROJECT_VERSION = 100; DEAD_CODE_STRIPPING = YES; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 99; + DYLIB_CURRENT_VERSION = 100; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -4269,7 +4269,7 @@ 26F5C26C10F3D9A5009D5894 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 99; + CURRENT_PROJECT_VERSION = 100; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", @@ -4299,7 +4299,7 @@ 26F5C26D10F3D9A5009D5894 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 99; + CURRENT_PROJECT_VERSION = 100; 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=147193&r1=147192&r2=147193&view=diff ============================================================================== --- lldb/trunk/resources/LLDB-Info.plist (original) +++ lldb/trunk/resources/LLDB-Info.plist Thu Dec 22 16:45:54 2011 @@ -17,7 +17,7 @@ CFBundleSignature ???? CFBundleVersion - 99 + 100 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=147193&r1=147192&r2=147193&view=diff ============================================================================== --- lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj (original) +++ lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj Thu Dec 22 16:45:54 2011 @@ -475,7 +475,7 @@ i386, ); COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 158; + CURRENT_PROJECT_VERSION = 159; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; SDKROOT = ""; @@ -494,7 +494,7 @@ x86_64, i386, ); - CURRENT_PROJECT_VERSION = 158; + CURRENT_PROJECT_VERSION = 159; 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 = 158; + CURRENT_PROJECT_VERSION = 159; 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 = 158; + CURRENT_PROJECT_VERSION = 159; 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 = 158; + CURRENT_PROJECT_VERSION = 159; 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 = 158; + CURRENT_PROJECT_VERSION = 159; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks; "FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = ( From scallanan at apple.com Thu Dec 22 16:46:34 2011 From: scallanan at apple.com (Sean Callanan) Date: Thu, 22 Dec 2011 22:46:34 -0000 Subject: [Lldb-commits] [lldb] r147194 - /lldb/tags/lldb-100/ Message-ID: <20111222224634.B02DD2A6C12C@llvm.org> Author: spyffe Date: Thu Dec 22 16:46:34 2011 New Revision: 147194 URL: http://llvm.org/viewvc/llvm-project?rev=147194&view=rev Log: lldb-100 Added: lldb/tags/lldb-100/ - copied from r147193, lldb/trunk/ From jingham at apple.com Thu Dec 22 18:30:10 2011 From: jingham at apple.com (Jim Ingham) Date: Fri, 23 Dec 2011 00:30:10 -0000 Subject: [Lldb-commits] [lldb] r147209 - /lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp Message-ID: <20111223003010.703092A6C12C@llvm.org> Author: jingham Date: Thu Dec 22 18:30:10 2011 New Revision: 147209 URL: http://llvm.org/viewvc/llvm-project?rev=147209&view=rev Log: Fixed a thinko when returning a struct like {short a; short b; short c; float d}. Modified: lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp Modified: lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp?rev=147209&r1=147208&r2=147209&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp (original) +++ lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp Thu Dec 22 18:30:10 2011 @@ -838,7 +838,7 @@ { // We are at the beginning of one of the eightbytes, so check the next element (if any) if (idx == num_children - 1) - in_gpr = true; + in_gpr = false; else { uint32_t next_field_bit_offset; From jingham at apple.com Thu Dec 22 18:49:32 2011 From: jingham at apple.com (Jim Ingham) Date: Fri, 23 Dec 2011 00:49:32 -0000 Subject: [Lldb-commits] [lldb] r147212 - in /lldb/trunk/test/functionalities/return-value: TestReturnValue.py call-func.c Message-ID: <20111223004932.84B442A6C12C@llvm.org> Author: jingham Date: Thu Dec 22 18:49:32 2011 New Revision: 147212 URL: http://llvm.org/viewvc/llvm-project?rev=147212&view=rev Log: Added a bunch more structure return tests. Modified: lldb/trunk/test/functionalities/return-value/TestReturnValue.py lldb/trunk/test/functionalities/return-value/call-func.c Modified: lldb/trunk/test/functionalities/return-value/TestReturnValue.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/return-value/TestReturnValue.py?rev=147212&r1=147211&r2=147212&view=diff ============================================================================== --- lldb/trunk/test/functionalities/return-value/TestReturnValue.py (original) +++ lldb/trunk/test/functionalities/return-value/TestReturnValue.py Thu Dec 22 18:49:32 2011 @@ -27,32 +27,90 @@ self.buildDwarf() self.do_return_value() + def return_and_test_struct_value (self, func_name): + """Pass in the name of the function to return from - takes in value, returns value.""" + + # Set the breakpoint, run to it, finish out. + bkpt = self.target.BreakpointCreateByName (func_name) + self.assertTrue (bkpt.GetNumResolvedLocations() > 0) + + self.process.Continue () + + thread_list = lldbutil.get_threads_stopped_at_breakpoint (self.process, bkpt) + + self.assertTrue (len(thread_list) == 1) + thread = thread_list[0] + + self.target.BreakpointDelete (bkpt.GetID()) + + in_value = thread.GetFrameAtIndex(0).FindVariable ("value") + + self.assertTrue (in_value.IsValid()) + num_in_children = in_value.GetNumChildren() + + # This is a little hokey, but if we don't get all the children now, then + # once we've stepped we won't be able to get them? + + for idx in range(0, num_in_children): + in_child = in_value.GetChildAtIndex (idx) + in_child_str = in_child.GetValue() + + thread.StepOut() + + self.assertTrue (self.process.GetState() == lldb.eStateStopped) + self.assertTrue (thread.GetStopReason() == lldb.eStopReasonPlanComplete) + + # Assuming all these functions step out to main. Could figure out the caller dynamically + # if that would add something to the test. + frame = thread.GetFrameAtIndex(0) + fun_name = frame.GetFunctionName() + self.assertTrue (fun_name == "main") + + frame = thread.GetFrameAtIndex(0) + ret_value = thread.GetStopReturnValue() + + self.assertTrue (ret_value.IsValid()) + + num_ret_children = ret_value.GetNumChildren() + self.assertTrue (num_in_children == num_ret_children) + for idx in range(0, num_ret_children): + in_child = in_value.GetChildAtIndex(idx) + ret_child = ret_value.GetChildAtIndex(idx) + in_child_str = in_child.GetValue() + ret_child_str = ret_child.GetValue() + + self.assertTrue (in_child_str == ret_child_str) + def do_return_value(self): """Test getting return values from stepping out.""" exe = os.path.join(os.getcwd(), "a.out") error = lldb.SBError() - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) + self.target = self.dbg.CreateTarget(exe) + self.assertTrue(self.target, VALID_TARGET) - inner_sint_bkpt = target.BreakpointCreateByName("inner_sint", exe) + inner_sint_bkpt = self.target.BreakpointCreateByName("inner_sint", exe) self.assertTrue(inner_sint_bkpt, VALID_BREAKPOINT) # Now launch the process, and do not stop at entry point. - process = target.LaunchSimple(None, None, os.getcwd()) + self.process = self.target.LaunchSimple(None, None, os.getcwd()) - self.assertTrue(process, PROCESS_IS_VALID) + self.assertTrue(self.process, PROCESS_IS_VALID) # The stop reason of the thread should be breakpoint. - self.assertTrue(process.GetState() == lldb.eStateStopped, + self.assertTrue(self.process.GetState() == lldb.eStateStopped, STOPPED_DUE_TO_BREAKPOINT) # Now finish, and make sure the return value is correct. - thread = lldbutil.get_stopped_thread (process, lldb.eStopReasonBreakpoint) + thread = lldbutil.get_stopped_thread (self.process, lldb.eStopReasonBreakpoint) + + # inner_sint returns the variable value, so capture that here: + in_int = thread.GetFrameAtIndex(0).FindVariable ("value").GetValueAsSigned(error) + self.assertTrue (error.Success()) thread.StepOut(); - self.assertTrue (process.GetState() == lldb.eStateStopped) + self.assertTrue (self.process.GetState() == lldb.eStateStopped) self.assertTrue (thread.GetStopReason() == lldb.eStopReasonPlanComplete) frame = thread.GetFrameAtIndex(0) @@ -62,8 +120,6 @@ return_value = thread.GetStopReturnValue() self.assertTrue (return_value.IsValid()) - in_int = frame.FindVariable ("value").GetValueAsSigned(error) - self.assertTrue (error.Success()) ret_int = return_value.GetValueAsSigned(error) self.assertTrue (error.Success()) self.assertTrue (in_int == ret_int) @@ -71,11 +127,14 @@ # Run again and we will stop in inner_sint the second time outer_sint is called. #Then test stepping out two frames at once: - process.Continue() - thread_list = lldbutil.get_threads_stopped_at_breakpoint (process, inner_sint_bkpt) + self.process.Continue() + thread_list = lldbutil.get_threads_stopped_at_breakpoint (self.process, inner_sint_bkpt) self.assertTrue(len(thread_list) == 1) thread = thread_list[0] + # We are done with the inner_sint breakpoint: + self.target.BreakpointDelete (inner_sint_bkpt.GetID()) + frame = thread.GetFrameAtIndex(1) fun_name = frame.GetFunctionName () self.assertTrue (fun_name == "outer_sint") @@ -84,7 +143,7 @@ thread.StepOutOfFrame (frame) - self.assertTrue (process.GetState() == lldb.eStateStopped) + self.assertTrue (self.process.GetState() == lldb.eStateStopped) self.assertTrue (thread.GetStopReason() == lldb.eStopReasonPlanComplete) frame = thread.GetFrameAtIndex(0) fun_name = frame.GetFunctionName() @@ -94,22 +153,24 @@ self.assertTrue (return_value.IsValid()) ret_int = ret_value.GetValueAsSigned (error) self.assertTrue (error.Success()) - self.assertTrue (in_int == ret_int) + self.assertTrue (2 * in_int == ret_int) # Now try some simple returns that have different types: - inner_float_bkpt = target.BreakpointCreateByName("inner_float", exe) + inner_float_bkpt = self.target.BreakpointCreateByName("inner_float", exe) self.assertTrue(inner_float_bkpt, VALID_BREAKPOINT) - process.Continue() - thread_list = lldbutil.get_threads_stopped_at_breakpoint (process, inner_float_bkpt) + self.process.Continue() + thread_list = lldbutil.get_threads_stopped_at_breakpoint (self.process, inner_float_bkpt) self.assertTrue (len(thread_list) == 1) thread = thread_list[0] + self.target.BreakpointDelete (inner_float_bkpt.GetID()) + frame = thread.GetFrameAtIndex(0) in_value = frame.FindVariable ("value") in_float = float (in_value.GetValue()) thread.StepOut() - self.assertTrue (process.GetState() == lldb.eStateStopped) + self.assertTrue (self.process.GetState() == lldb.eStateStopped) self.assertTrue (thread.GetStopReason() == lldb.eStopReasonPlanComplete) frame = thread.GetFrameAtIndex(0) @@ -122,6 +183,33 @@ self.assertTrue(in_float == return_float) + self.return_and_test_struct_value ("return_one_int") + self.return_and_test_struct_value ("return_two_int") + self.return_and_test_struct_value ("return_three_int") + self.return_and_test_struct_value ("return_four_int") + self.return_and_test_struct_value ("return_five_int") + + self.return_and_test_struct_value ("return_two_double") + self.return_and_test_struct_value ("return_one_double_two_float") + self.return_and_test_struct_value ("return_one_int_one_float_one_int") + + self.return_and_test_struct_value ("return_one_pointer") + self.return_and_test_struct_value ("return_two_pointer") + self.return_and_test_struct_value ("return_one_float_one_pointer") + self.return_and_test_struct_value ("return_one_int_one_pointer") + self.return_and_test_struct_value ("return_three_short_one_float") + + self.return_and_test_struct_value ("return_one_int_one_double") + self.return_and_test_struct_value ("return_one_int_one_double_one_int") + self.return_and_test_struct_value ("return_one_short_one_double_one_short") + self.return_and_test_struct_value ("return_one_float_one_int_one_float") + self.return_and_test_struct_value ("return_two_float") + # I am leaving out the packed test until we have a way to tell CLANG + # about alignment when reading DWARF for packed types. + #self.return_and_test_struct_value ("return_one_int_one_double_packed") + self.return_and_test_struct_value ("return_one_int_one_long") + + if __name__ == '__main__': import atexit lldb.SBDebugger.Initialize() Modified: lldb/trunk/test/functionalities/return-value/call-func.c URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/return-value/call-func.c?rev=147212&r1=147211&r2=147212&view=diff ============================================================================== --- lldb/trunk/test/functionalities/return-value/call-func.c (original) +++ lldb/trunk/test/functionalities/return-value/call-func.c Thu Dec 22 18:49:32 2011 @@ -1,3 +1,11 @@ +// Some convenient things to return: +static char *g_first_pointer = "I am the first"; +static char *g_second_pointer = "I am the second"; + +// First we have some simple functions that return standard types, ints, floats and doubles. +// We have a function calling a function in a few cases to test that if you stop in the +// inner function then do "up/fin" you get the return value from the outer-most frame. + int inner_sint (int value) { @@ -7,7 +15,8 @@ int outer_sint (int value) { - return inner_sint (value); + int outer_value = 2 * inner_sint (value); + return outer_value; } float @@ -19,47 +28,277 @@ float outer_float (float value) { - return inner_float(value); + float outer_value = 2 * inner_float(value); + return outer_value; } -double -inner_double (double value) +double +return_double (double value) { return value; } -double -outer_double (double value) +long double +return_long_double (long double value) { - return inner_double(value); + return value; } -long double -inner_long_double (long double value) +char * +return_pointer (char *value) { return value; } -long double -outer_long_double (long double value) +struct one_int +{ + int one_field; +}; + +struct one_int +return_one_int (struct one_int value) +{ + return value; +} + +struct two_int +{ + int first_field; + int second_field; +}; + +struct two_int +return_two_int (struct two_int value) +{ + return value; +} + +struct three_int +{ + int first_field; + int second_field; + int third_field; +}; + +struct three_int +return_three_int (struct three_int value) +{ + return value; +} + +struct four_int +{ + int first_field; + int second_field; + int third_field; + int fourth_field; +}; + +struct four_int +return_four_int (struct four_int value) +{ + return value; +} + +struct five_int +{ + int first_field; + int second_field; + int third_field; + int fourth_field; + int fifth_field; +}; + +struct five_int +return_five_int (struct five_int value) +{ + return value; +} + +struct one_int_one_double +{ + int first_field; + double second_field; +}; + +struct one_int_one_double +return_one_int_one_double (struct one_int_one_double value) +{ + return value; +} + +struct one_int_one_double_one_int +{ + int one_field; + double second_field; + int third_field; +}; + +struct one_int_one_double_one_int +return_one_int_one_double_one_int (struct one_int_one_double_one_int value) +{ + return value; +} + +struct one_short_one_double_one_short +{ + int one_field; + double second_field; + int third_field; +}; + +struct one_short_one_double_one_short +return_one_short_one_double_one_short (struct one_short_one_double_one_short value) +{ + return value; +} + +struct three_short_one_float +{ + short one_field; + short second_field; + short third_field; + float fourth_field; +}; + +struct three_short_one_float +return_three_short_one_float (struct three_short_one_float value) +{ + return value; +} + +struct one_int_one_float_one_int { - return inner_long_double(value); + int one_field; + float second_field; + int third_field; +}; + +struct one_int_one_float_one_int +return_one_int_one_float_one_int (struct one_int_one_float_one_int value) +{ + return value; +} + +struct one_float_one_int_one_float +{ + float one_field; + int second_field; + float third_field; +}; + +struct one_float_one_int_one_float +return_one_float_one_int_one_float (struct one_float_one_int_one_float value) +{ + return value; } -struct -large_return_struct +struct one_double_two_float { - long long first_long; - long long second_long; - long long third_long; - long long fourth_long; + double one_field; + float second_field; + float third_field; +}; +struct one_double_two_float +return_one_double_two_float (struct one_double_two_float value) +{ + return value; +} + +struct two_double +{ + double first_field; + double second_field; }; -struct large_return_struct -return_large_struct (long long first, long long second, long long third, long long fourth) +struct two_double +return_two_double (struct two_double value) { - return (struct large_return_struct) {first, second, third, fourth}; + return value; +} + +struct two_float +{ + float first_field; + float second_field; +}; + +struct two_float +return_two_float (struct two_float value) +{ + return value; +} + +struct one_int_one_double_packed +{ + int first_field; + double second_field; +} __attribute__((__packed__)); + +struct one_int_one_double_packed +return_one_int_one_double_packed (struct one_int_one_double_packed value) +{ + return value; +} + +struct one_int_one_long +{ + int first_field; + long second_field; +}; + +struct one_int_one_long +return_one_int_one_long (struct one_int_one_long value) +{ + return value; +} + +struct one_pointer +{ + char *first_field; +}; + +struct one_pointer +return_one_pointer (struct one_pointer value) +{ + return value; +} + +struct two_pointer +{ + char *first_field; + char *second_field; +}; + +struct two_pointer +return_two_pointer (struct two_pointer value) +{ + return value; +} + +struct one_float_one_pointer +{ + float first_field; + char *second_field; +}; + +struct one_float_one_pointer +return_one_float_one_pointer (struct one_float_one_pointer value) +{ + return value; +} + +struct one_int_one_pointer +{ + int first_field; + char *second_field; +}; + +struct one_int_one_pointer +return_one_int_one_pointer (struct one_int_one_pointer value) +{ + return value; } int @@ -71,19 +310,46 @@ outer_sint (first_int); outer_sint (second_int); - float float_value = 12.34; - - outer_float (float_value); + float first_float_value = 12.34; + float second_float_value = 23.45; + + outer_float (first_float_value); + outer_float (second_float_value); double double_value = -23.45; - outer_double (double_value); + return_double (double_value); + + return_pointer(g_first_pointer); long double long_double_value = -3456789.987654321; - outer_long_double (long_double_value); + return_long_double (long_double_value); - return_large_struct (10, 20, 30, 40); + // Okay, now the structures: + return_one_int ((struct one_int) {10}); + return_two_int ((struct two_int) {10, 20}); + return_three_int ((struct three_int) {10, 20, 30}); + return_four_int ((struct four_int) {10, 20, 30, 40}); + return_five_int ((struct five_int) {10, 20, 30, 40, 50}); + + return_two_double ((struct two_double) {10.0, 20.0}); + return_one_double_two_float ((struct one_double_two_float) {10.0, 20.0, 30.0}); + return_one_int_one_float_one_int ((struct one_int_one_float_one_int) {10, 20.0, 30}); + + return_one_pointer ((struct one_pointer) {g_first_pointer}); + return_two_pointer ((struct two_pointer) {g_first_pointer, g_second_pointer}); + return_one_float_one_pointer ((struct one_float_one_pointer) {10.0, g_first_pointer}); + return_one_int_one_pointer ((struct one_int_one_pointer) {10, g_first_pointer}); + return_three_short_one_float ((struct three_short_one_float) {10, 20, 30, 40.0}); + + return_one_int_one_double ((struct one_int_one_double) {10, 20.0}); + return_one_int_one_double_one_int ((struct one_int_one_double_one_int) {10, 20.0, 30}); + return_one_short_one_double_one_short ((struct one_short_one_double_one_short) {10, 20.0, 30}); + return_one_float_one_int_one_float ((struct one_float_one_int_one_float) {10.0, 20, 30.0}); + return_two_float ((struct two_float) { 10.0, 20.0}); + return_one_int_one_double_packed ((struct one_int_one_double_packed) {10, 20.0}); + return_one_int_one_long ((struct one_int_one_long) {10, 20}); return 0; From johnny.chen at apple.com Thu Dec 22 18:53:45 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Fri, 23 Dec 2011 00:53:45 -0000 Subject: [Lldb-commits] [lldb] r147213 - in /lldb/trunk: source/API/SBDebugger.cpp test/python_api/debugger/TestDebuggerAPI.py Message-ID: <20111223005345.9BD0C2A6C12C@llvm.org> Author: johnny Date: Thu Dec 22 18:53:45 2011 New Revision: 147213 URL: http://llvm.org/viewvc/llvm-project?rev=147213&view=rev Log: rdar://problem/10216227 LLDB (python bindings) Crashing in lldb::SBDebugger::DeleteTarget(lldb::SBTarget&) Need to check the validity of (SBTarget&)target passed to SBDebugger::DeleteTarget() before calling target->Destroy(). Modified: lldb/trunk/source/API/SBDebugger.cpp lldb/trunk/test/python_api/debugger/TestDebuggerAPI.py Modified: lldb/trunk/source/API/SBDebugger.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBDebugger.cpp?rev=147213&r1=147212&r2=147213&view=diff ============================================================================== --- lldb/trunk/source/API/SBDebugger.cpp (original) +++ lldb/trunk/source/API/SBDebugger.cpp Thu Dec 22 18:53:45 2011 @@ -616,7 +616,7 @@ SBDebugger::DeleteTarget (lldb::SBTarget &target) { bool result = false; - if (m_opaque_sp) + if (m_opaque_sp && target.IsValid()) { // No need to lock, the target list is thread safe result = m_opaque_sp->GetTargetList().DeleteTarget (target.m_opaque_sp); Modified: lldb/trunk/test/python_api/debugger/TestDebuggerAPI.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/debugger/TestDebuggerAPI.py?rev=147213&r1=147212&r2=147213&view=diff ============================================================================== --- lldb/trunk/test/python_api/debugger/TestDebuggerAPI.py (original) +++ lldb/trunk/test/python_api/debugger/TestDebuggerAPI.py Thu Dec 22 18:53:45 2011 @@ -28,3 +28,11 @@ self.dbg.SetPrompt(None) self.dbg.SetCurrentPlatform(None) self.dbg.SetCurrentPlatformSDKRoot(None) + + @python_api_test + def test_debugger_delete_invalid_target(self): + """SBDebugger.DeleteTarget() should not crash LLDB given and invalid target.""" + target = lldb.SBTarget() + self.assertFalse(target.IsValid()) + self.dbg.DeleteTarget(target) + From jingham at apple.com Thu Dec 22 18:57:42 2011 From: jingham at apple.com (Jim Ingham) Date: Fri, 23 Dec 2011 00:57:42 -0000 Subject: [Lldb-commits] [lldb] r147214 - /lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp Message-ID: <20111223005742.5EF962A6C12C@llvm.org> Author: jingham Date: Thu Dec 22 18:57:42 2011 New Revision: 147214 URL: http://llvm.org/viewvc/llvm-project?rev=147214&view=rev Log: Sanity check the data I am going to read from the extractor to avoid asserting. Modified: lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp Modified: lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp?rev=147214&r1=147213&r2=147214&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp (original) +++ lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp Thu Dec 22 18:57:42 2011 @@ -915,8 +915,14 @@ } } } + + // These two tests are just sanity checks. If I somehow get the + // type calculation wrong above it is better to just return nothing + // than to assert or crash. if (!copy_from_extractor) return return_valobj_sp; + if (copy_from_offset + field_byte_width > copy_from_extractor->GetByteSize()) + return return_valobj_sp; copy_from_extractor->CopyByteOrderedData (copy_from_offset, field_byte_width,