Re: [Lldb-commits] [PATCH] D11482: Add target setting to have the language follow the frame's CU.
dawn added a comment. PS: I hope you won't return ObjC++ if language is unknown for any of the code you write - see inline comment. PPS: Many thanks again for all your reviews!! Comment at: source/Target/Target.cpp:2158-2178 @@ -2136,1 +2157,23 @@ +// Return the language of the selected frame's CU. +lldb::LanguageType +Target::GetLanguageOfSelectedFrame () const +{ +LanguageType language = eLanguageTypeUnknown; +if (m_process_sp) +{ +ThreadSP sel_thread_sp(m_process_sp->GetThreadList().GetSelectedThread()); +if (sel_thread_sp) +{ +StackFrameSP sel_frame_sp = sel_thread_sp->GetSelectedFrame(); +if (sel_frame_sp) +{ +CompileUnit *cu = sel_frame_sp->GetSymbolContext(eSymbolContextCompUnit).comp_unit; +if (cu) +language = cu->GetLanguage(); +} +} +} +return language; +} + clayborg wrote: > This should be moved to the StackFrame as: > > ``` > lldb::LanguageType > StackFrame::GetDefaultExpressionLanguage(); > ``` > > And it should check if the language is form of C, C++, ObjC, or ObjC ++, then > return ObjC++, else return the language. ObjC++ should not be the default, because then the code/user can't know if it really is unknown or is in a ObjC++ context. Having it return unknown is good - the expression code sets the compiler's language options for unknown the same as ObjC++ anyway (see code in ClangExpressionParser::ClangExpressionParser). Repository: rL LLVM http://reviews.llvm.org/D11482 ___ lldb-commits mailing list lldb-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r243200 - Add some initial logging for when lldb is searching for binaries,
Author: jmolenda Date: Fri Jul 24 21:39:42 2015 New Revision: 243200 URL: http://llvm.org/viewvc/llvm-project?rev=243200&view=rev Log: Add some initial logging for when lldb is searching for binaries, dSYMs, or reading binaries out of memory to the 'Host' log channel. There's more to be done here, both for Mac and for other platforms, but the initial set of new loggings are useful enough to check in at this point. Modified: lldb/trunk/source/Host/common/Symbols.cpp lldb/trunk/source/Host/macosx/Symbols.cpp lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp lldb/trunk/source/Target/Process.cpp Modified: lldb/trunk/source/Host/common/Symbols.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Symbols.cpp?rev=243200&r1=243199&r2=243200&view=diff == --- lldb/trunk/source/Host/common/Symbols.cpp (original) +++ lldb/trunk/source/Host/common/Symbols.cpp Fri Jul 24 21:39:42 2015 @@ -11,6 +11,7 @@ #include "lldb/Core/ArchSpec.h" #include "lldb/Core/DataBuffer.h" #include "lldb/Core/DataExtractor.h" +#include "lldb/Core/Log.h" #include "lldb/Core/Module.h" #include "lldb/Core/ModuleSpec.h" #include "lldb/Core/StreamString.h" @@ -79,6 +80,7 @@ FileAtPathContainsArchAndUUID (const Fil static bool LocateDSYMInVincinityOfExecutable (const ModuleSpec &module_spec, FileSpec &dsym_fspec) { +Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); const FileSpec *exec_fspec = module_spec.GetFileSpecPtr(); if (exec_fspec) { @@ -88,6 +90,17 @@ LocateDSYMInVincinityOfExecutable (const // Make sure the module isn't already just a dSYM file... if (strcasestr(path, ".dSYM/Contents/Resources/DWARF") == NULL) { +if (log) +{ +if (module_spec.GetUUIDPtr() && module_spec.GetUUIDPtr()->IsValid()) +{ +log->Printf ("Searching for dSYM bundle next to executable %s, UUID %s", path, module_spec.GetUUIDPtr()->GetAsString().c_str()); +} +else +{ +log->Printf ("Searching for dSYM bundle next to executable %s", path); +} +} size_t obj_file_path_length = strlen(path); ::strncat(path, ".dSYM/Contents/Resources/DWARF/", sizeof(path) - strlen(path) - 1); ::strncat(path, exec_fspec->GetFilename().AsCString(), sizeof(path) - strlen(path) - 1); @@ -99,6 +112,10 @@ LocateDSYMInVincinityOfExecutable (const if (dsym_fspec.Exists() && FileAtPathContainsArchAndUUID(dsym_fspec, module_spec.GetArchitecturePtr(), module_spec.GetUUIDPtr())) { +if (log) +{ +log->Printf ("dSYM with matching UUID & arch found at %s", path); +} return true; } else @@ -118,6 +135,10 @@ LocateDSYMInVincinityOfExecutable (const if (dsym_fspec.Exists() && FileAtPathContainsArchAndUUID(dsym_fspec, module_spec.GetArchitecturePtr(), module_spec.GetUUIDPtr())) { +if (log) +{ +log->Printf ("dSYM with matching UUID & arch found at %s", path); +} return true; } else Modified: lldb/trunk/source/Host/macosx/Symbols.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/Symbols.cpp?rev=243200&r1=243199&r2=243200&view=diff == --- lldb/trunk/source/Host/macosx/Symbols.cpp (original) +++ lldb/trunk/source/Host/macosx/Symbols.cpp Fri Jul 24 21:39:42 2015 @@ -22,6 +22,7 @@ #include "lldb/Core/ArchSpec.h" #include "lldb/Core/DataBuffer.h" #include "lldb/Core/DataExtractor.h" +#include "lldb/Core/Log.h" #include "lldb/Core/Module.h" #include "lldb/Core/ModuleSpec.h" #include "lldb/Core/StreamString.h" @@ -99,6 +100,7 @@ LocateMacOSXFilesUsingDebugSymbols { CFCReleaser exec_url; const FileSpec *exec_fspec = module_spec.GetFileSpecPtr(); +Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); if (exec_fspec) { char exec_cf_path[PATH_MAX]; @@ -108,6 +110,23 @@ LocateMacOSXFilesUsingDebugSymbols strlen(exec_cf_path),
Re: [Lldb-commits] [PATCH] D11482: Add target setting to have the language follow the frame's CU.
dawn added a comment. Thank you for your review. I was afraid you might not go for it since you objected to my original frame-based patch for breakpoints, but I had hoped that by having it in an option you would be OK with it. Our users (with mixed Pascal and C++ code) really want this so they don't have to remember to specify the language each time they go up or down the stack and want to view their local variables. Consider this scenario: Suppose a user hits a breakpoint in a Pascal function called from C++ and sets the target language to Pascal so that they can evaluate their locals using the Pascal FE. Now they go up a frame into C++ and try to see their locals but can't without resetting the target language (or by always specifying the expr --language option). Then they run to a BP in a C++ module, same problem. Does this help explain why having such a default would be so desirable? It is how all our debuggers and gdb work. I'm curious - how do you get around this problem in Swift? Comment at: source/Commands/CommandObjectExpression.cpp:303-312 @@ -302,8 +302,12 @@ options.SetDebug(m_command_options.debug); - -// If the language was not specified, set it from target's properties + +// If the expression's language was not specified, check the +// target's properties to see if a language override was set, +// or if the language should match that of the frame. if (m_command_options.language != eLanguageTypeUnknown) options.SetLanguage(m_command_options.language); -else +else if (target->GetLanguage() != eLanguageTypeUnknown) options.SetLanguage(target->GetLanguage()); +else if (target->GetLanguageFollowsFrame()) +options.SetLanguage(target->GetLanguageOfSelectedFrame()); clayborg wrote: > This should be: > > ``` > if (m_command_options.language != eLanguageTypeUnknown) > options.SetLanguage(m_command_options.language); > else > { > StackFrame *frame = exe_ctx.GetFramePtr(); > if (frame) > options.SetLanguage(frame-> GetDefaultExpressionLanguage()); > } > > > I would like to have this - see http://reviews.llvm.org/D11102 (you resigned from that review). Is it OK to add? Or did you want to kill the patch entirely? Note that setting the language to the frame means that ObjC can't be evaluated in C++ which Sean is against (see http://reviews.llvm.org/D11173), and there are tests which expect C++ to be available in ObjC (see http://reviews.llvm.org/D11102). Repository: rL LLVM http://reviews.llvm.org/D11482 ___ lldb-commits mailing list lldb-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r243193 - Shorten the lldb timeout, we were seeing occasional failure because
Author: jingham Date: Fri Jul 24 19:52:38 2015 New Revision: 243193 URL: http://llvm.org/viewvc/llvm-project?rev=243193&view=rev Log: Shorten the lldb timeout, we were seeing occasional failure because lldb didn't wake up before the target function got a chance to complete. Modified: lldb/trunk/test/expression_command/timeout/TestCallWithTimeout.py Modified: lldb/trunk/test/expression_command/timeout/TestCallWithTimeout.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/expression_command/timeout/TestCallWithTimeout.py?rev=243193&r1=243192&r2=243193&view=diff == --- lldb/trunk/test/expression_command/timeout/TestCallWithTimeout.py (original) +++ lldb/trunk/test/expression_command/timeout/TestCallWithTimeout.py Fri Jul 24 19:52:38 2015 @@ -60,7 +60,7 @@ class ExprCommandWithTimeoutsTestCase(Te # First set the timeout too short, and make sure we fail. options = lldb.SBExpressionOptions() -options.SetTimeoutInMicroSeconds(100) +options.SetTimeoutInMicroSeconds(10) options.SetUnwindOnError(True) frame = thread.GetFrameAtIndex(0) ___ lldb-commits mailing list lldb-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D11447: Specify a language to use when parsing expressions.
This revision was automatically updated to reflect the committed changes. Closed by commit rL243187: Specify a language to use when parsing expressions. (authored by dperchik). Changed prior to commit: http://reviews.llvm.org/D11447?vs=30600&id=30626#toc Repository: rL LLVM http://reviews.llvm.org/D11447 Files: lldb/trunk/source/Commands/CommandObjectExpression.cpp lldb/trunk/source/Commands/CommandObjectExpression.h lldb/trunk/test/expression_command/options/Makefile lldb/trunk/test/expression_command/options/TestExprOptions.py lldb/trunk/test/expression_command/options/foo.cpp lldb/trunk/test/expression_command/options/main.cpp Index: lldb/trunk/test/expression_command/options/TestExprOptions.py === --- lldb/trunk/test/expression_command/options/TestExprOptions.py +++ lldb/trunk/test/expression_command/options/TestExprOptions.py @@ -0,0 +1,100 @@ +""" +Test expression command options. + +Test cases: + +o test_expr_options: + Test expression command options. +""" + +import os, time +import unittest2 +import lldb +import lldbutil +from lldbtest import * + +class ExprOptionsTestCase(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +def setUp(self): +# Call super's setUp(). +TestBase.setUp(self) + +self.main_source = "main.cpp" +self.main_source_spec = lldb.SBFileSpec (self.main_source) +self.line = line_number('main.cpp', '// breakpoint_in_main') +self.exe = os.path.join(os.getcwd(), "a.out") + +def test_expr_options(self): +"""These expression command options should work as expected.""" +self.buildDefault() + +# Set debugger into synchronous mode +self.dbg.SetAsync(False) + +# Create a target by the debugger. +target = self.dbg.CreateTarget(self.exe) +self.assertTrue(target, VALID_TARGET) + +# Set breakpoints inside main. +breakpoint = target.BreakpointCreateBySourceRegex('// breakpoint_in_main', self.main_source_spec) +self.assertTrue(breakpoint) + +# Now launch the process, and do not stop at entry point. +process = target.LaunchSimple(None, None, self.get_process_working_directory()) +self.assertTrue(process, PROCESS_IS_VALID) + +threads = lldbutil.get_threads_stopped_at_breakpoint(process, breakpoint) +self.assertEqual(len(threads), 1) + +frame = threads[0].GetFrameAtIndex(0) +options = lldb.SBExpressionOptions() + +# -- test --language on ObjC builtin type using the SB API's -- +# Make sure we can evaluate the ObjC builtin type 'id': +val = frame.EvaluateExpression('id my_id = 0; my_id') +self.assertTrue(val.IsValid()) +self.assertTrue(val.GetError().Success()) +self.assertEqual(val.GetValueAsUnsigned(0), 0) +self.DebugSBValue(val) + +# Make sure it still works if language is set to ObjC: +options.SetLanguage(lldb.eLanguageTypeObjC) +val = frame.EvaluateExpression('id my_id = 0; my_id', options) +self.assertTrue(val.IsValid()) +self.assertTrue(val.GetError().Success()) +self.assertEqual(val.GetValueAsUnsigned(0), 0) +self.DebugSBValue(val) + +# Make sure it fails if language is set to C: +options.SetLanguage(lldb.eLanguageTypeC) +val = frame.EvaluateExpression('id my_id = 0; my_id', options) +self.assertTrue(val.IsValid()) +self.assertFalse(val.GetError().Success()) + +# -- test --language on C++ expression using the SB API's -- +# Make sure we can evaluate 'ns::func'. +val = frame.EvaluateExpression('ns::func') +self.assertTrue(val.IsValid()) +self.assertTrue(val.GetError().Success()) +self.DebugSBValue(val) + +# Make sure it still works if language is set to C++: +options.SetLanguage(lldb.eLanguageTypeC_plus_plus) +val = frame.EvaluateExpression('ns::func', options) +self.assertTrue(val.IsValid()) +self.assertTrue(val.GetError().Success()) +self.DebugSBValue(val) + +# Make sure it fails if language is set to C: +options.SetLanguage(lldb.eLanguageTypeC) +val = frame.EvaluateExpression('ns::func', options) +self.assertTrue(val.IsValid()) +self.assertFalse(val.GetError().Success()) + +if __name__ == '__main__': +import atexit +lldb.SBDebugger.Initialize() +atexit.register(lambda: lldb.SBDebugger.Terminate()) +unittest2.main() Index: lldb/trunk/test/expression_command/options/Makefile === --- lldb/trunk/test/expression_command/options/Makefile +++ lldb/trunk/test/expression_command/options/Makefile @@ -0,0 +1,5 @@ +LEVEL = ../../make + +CXX_SOURCES := main.cpp foo.cpp + +include $(LEVEL)/Makefile.rules Index: lldb/trunk/test/expression_command/options/main.
[Lldb-commits] [lldb] r243187 - Specify a language to use when parsing expressions.
Author: dperchik Date: Fri Jul 24 19:19:39 2015 New Revision: 243187 URL: http://llvm.org/viewvc/llvm-project?rev=243187&view=rev Log: Specify a language to use when parsing expressions. This patch adds the option -l/--language to the expression command, for use when setting the language options or choosing an alternate FE. If not specified, the target.language setting is used. Reviewed by: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D11447 Added: lldb/trunk/test/expression_command/options/ lldb/trunk/test/expression_command/options/Makefile lldb/trunk/test/expression_command/options/TestExprOptions.py lldb/trunk/test/expression_command/options/foo.cpp lldb/trunk/test/expression_command/options/main.cpp Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp lldb/trunk/source/Commands/CommandObjectExpression.h Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.cpp?rev=243187&r1=243186&r2=243187&view=diff == --- lldb/trunk/source/Commands/CommandObjectExpression.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectExpression.cpp Fri Jul 24 19:19:39 2015 @@ -63,6 +63,7 @@ CommandObjectExpression::CommandOptions: { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "timeout",'t', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeUnsignedInteger, "Timeout value (in microseconds) for running the expression."}, { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "unwind-on-error",'u', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBoolean,"Clean up program state if the expression causes a crash, or raises a signal. Note, unlike gdb hitting a breakpoint is controlled by another option (-i)."}, { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "debug", 'g', OptionParser::eNoArgument , NULL, NULL, 0, eArgTypeNone, "When specified, debug the JIT code by setting a breakpoint on the first instruction and forcing breakpoints to not be ignored (-i0) and no unwinding to happen on error (-u0)."}, +{ LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "language", 'l', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeLanguage, "Specifies the Language to use when parsing the expression. If not set the target.language setting is used." }, { LLDB_OPT_SET_1, false, "description-verbosity", 'v', OptionParser::eOptionalArgument, NULL, g_description_verbosity_type, 0, eArgTypeDescriptionVerbosity,"How verbose should the output of this expression be, if the object description is asked for."}, }; @@ -84,12 +85,11 @@ CommandObjectExpression::CommandOptions: switch (short_option) { - //case 'l': - //if (language.SetLanguageFromCString (option_arg) == false) - //{ - //error.SetErrorStringWithFormat("invalid language option argument '%s'", option_arg); - //} - //break; +case 'l': +language = LanguageRuntime::GetLanguageTypeFromString (option_arg); +if (language == eLanguageTypeUnknown) +error.SetErrorStringWithFormat ("unknown language type: '%s' for expression", option_arg); +break; case 'a': { @@ -180,6 +180,7 @@ CommandObjectExpression::CommandOptions: try_all_threads = true; timeout = 0; debug = false; +language = eLanguageTypeUnknown; m_verbosity = eLanguageRuntimeDescriptionDisplayVerbosityCompact; } @@ -192,7 +193,7 @@ CommandObjectExpression::CommandOptions: CommandObjectExpression::CommandObjectExpression (CommandInterpreter &interpreter) : CommandObjectRaw (interpreter, "expression", - "Evaluate a C/ObjC/C++ expression in the current program context, using user defined variables and variables currently in scope.", + "Evaluate an expression in the current program context, using user defined variables and variables currently in scope.", NULL, eCommandProcessMustBePaused | eCommandTryTargetAPILock), IOHandlerDelegate (IOHandlerDelegate::Completion::Expression), @@ -300,6 +301,12 @@ CommandObjectExpression::EvaluateExpress options.SetTryAllThreads(m_command_options.try_all_threads); options.SetDebug(m_command_options.debug); +// If the language was not specified, set it from target's properties +if (m_command_options.language != eLanguageTypeUnknown) +options.SetLanguage(m_command_options.language); +else +options.SetLanguage(target->GetLanguage()); + // If there is any chance we are going to stop and want to see // what went wrong with our expression, we should generate debug info if (!m_command_options.ignore_breakpoints ||
[Lldb-commits] [PATCH] D11499: [lldb-mi] Fix setting of breakpoints using file:func syntax.
dawn created this revision. dawn added reviewers: abidh, brucem, ki.stfu. dawn added a subscriber: lldb-commits. dawn set the repository for this revision to rL LLVM. Given eBreakPoint_ByFileFn, code previously was calling: sbTarget.BreakpointCreateByName(strFileFn.c_str(), fileName.c_str()); which calls the overload: lldb::SBBreakpoint BreakpointCreateByName (const char *symbol_name, const char *module_name = NULL); but the module_name is expected to be the exe or dll here, i.e. for -break-insert a.out:func which isn't a valid use of -break-insert in gdb. This patch calls the correct overload: lldb::SBBreakpoint BreakpointCreateByName (const char *symbol_name, const SBFileSpecList &module_list, const SBFileSpecList &comp_unit_list); Comments were added to the tests for cases that won't work due to bugs in lldb. Repository: rL LLVM http://reviews.llvm.org/D11499 Files: test/tools/lldb-mi/breakpoint/TestMiBreak.py tools/lldb-mi/MICmdCmdBreak.cpp Index: tools/lldb-mi/MICmdCmdBreak.cpp === --- tools/lldb-mi/MICmdCmdBreak.cpp +++ tools/lldb-mi/MICmdCmdBreak.cpp @@ -245,8 +245,13 @@ m_brkPt = sbTarget.BreakpointCreateByAddress(nAddress); break; case eBreakPoint_ByFileFn: -m_brkPt = sbTarget.BreakpointCreateByName(strFileFn.c_str(), fileName.c_str()); +{ +lldb::SBFileSpecList module;// search in all modules +lldb::SBFileSpecList compUnit; +compUnit.Append (lldb::SBFileSpec(fileName.c_str())); +m_brkPt = sbTarget.BreakpointCreateByName(strFileFn.c_str(), module, compUnit); break; +} case eBreakPoint_ByFileLine: m_brkPt = sbTarget.BreakpointCreateByLocation(fileName.c_str(), nFileLine); break; Index: test/tools/lldb-mi/breakpoint/TestMiBreak.py === --- test/tools/lldb-mi/breakpoint/TestMiBreak.py +++ test/tools/lldb-mi/breakpoint/TestMiBreak.py @@ -73,7 +73,29 @@ # Test that non-pending BP was set correctly self.runCmd("-exec-continue") self.expect("\^running") -self.expect("\*stopped,reason=\"breakpoint-hit\"") +self.expect("\*stopped,reason=\"breakpoint-hit\".*bkptno=\"2\"") + +# Test that we can set a BP using the file:func syntax +self.runCmd("-break-insert main.cpp:main") +self.expect("\^done,bkpt={number=\"4\"") +self.runCmd("-break-insert main.cpp:ns::foo1") +self.expect("\^done,bkpt={number=\"5\"") +#FIXME: quotes on filenames aren't handled correctly in lldb-mi. +#self.runCmd("-break-insert \"main.cpp\":main") +#self.expect("\^done,bkpt={number=\"6\"") + +# We should hit BP #5 on 'main.cpp:ns::foo1' +self.runCmd("-exec-continue") +self.expect("\^running") +self.expect("\*stopped,reason=\"breakpoint-hit\".*bkptno=\"5\"") +#self.expect("\*stopped,reason=\"breakpoint-hit\"") + +# Test that we can set a BP using the global namespace token +#FIXME: this test is disabled due to a bug in lldb. +#self.runCmd("-break-insert \"::main\"") +#self.expect("\^done,bkpt={number=\"7\"") +#self.runCmd("-break-insert \"main.cpp:::main\"") +#self.expect("\^done,bkpt={number=\"8\"") @lldbmi_test @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows") Index: tools/lldb-mi/MICmdCmdBreak.cpp === --- tools/lldb-mi/MICmdCmdBreak.cpp +++ tools/lldb-mi/MICmdCmdBreak.cpp @@ -245,8 +245,13 @@ m_brkPt = sbTarget.BreakpointCreateByAddress(nAddress); break; case eBreakPoint_ByFileFn: -m_brkPt = sbTarget.BreakpointCreateByName(strFileFn.c_str(), fileName.c_str()); +{ +lldb::SBFileSpecList module;// search in all modules +lldb::SBFileSpecList compUnit; +compUnit.Append (lldb::SBFileSpec(fileName.c_str())); +m_brkPt = sbTarget.BreakpointCreateByName(strFileFn.c_str(), module, compUnit); break; +} case eBreakPoint_ByFileLine: m_brkPt = sbTarget.BreakpointCreateByLocation(fileName.c_str(), nFileLine); break; Index: test/tools/lldb-mi/breakpoint/TestMiBreak.py === --- test/tools/lldb-mi/breakpoint/TestMiBreak.py +++ test/tools/lldb-mi/breakpoint/TestMiBreak.py @@ -73,7 +73,29 @@ # Test that non-pending BP was set correctly self.runCmd("-exec-continue") self.expect("\^running") -self.expect("\*stopped,reason=\"breakpoint-hit\"") +self.expect("\*stopped,reason=\"breakpoint-hit\".*bkptno=\"2\"") + +#
[Lldb-commits] [lldb] r243181 - Make sure we resolve ~ in paths coming from the plist in a dSYM before adding them
Author: jingham Date: Fri Jul 24 18:40:32 2015 New Revision: 243181 URL: http://llvm.org/viewvc/llvm-project?rev=243181&view=rev Log: Make sure we resolve ~ in paths coming from the plist in a dSYM before adding them to the path remappings. Also don't add the paths to the path mapping when DebugSymbols tells up about files, since we'll just do that again when we read in the dSYM. Modified: lldb/trunk/source/Host/macosx/Symbols.cpp lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp Modified: lldb/trunk/source/Host/macosx/Symbols.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/Symbols.cpp?rev=243181&r1=243180&r2=243181&view=diff == --- lldb/trunk/source/Host/macosx/Symbols.cpp (original) +++ lldb/trunk/source/Host/macosx/Symbols.cpp Fri Jul 24 18:40:32 2015 @@ -133,39 +133,16 @@ LocateMacOSXFilesUsingDebugSymbols } } -CFCReleaser dict(::DBGCopyDSYMPropertyLists (dsym_url.get())); -CFDictionaryRef uuid_dict = NULL; -if (dict.get()) -{ -CFCString uuid_cfstr (uuid->GetAsString().c_str()); -uuid_dict = static_cast(::CFDictionaryGetValue (dict.get(), uuid_cfstr.get())); -if (uuid_dict) -{ - -CFStringRef actual_src_cfpath = static_cast(::CFDictionaryGetValue (uuid_dict, CFSTR("DBGSourcePath"))); -if (actual_src_cfpath) -{ -CFStringRef build_src_cfpath = static_cast(::CFDictionaryGetValue (uuid_dict, CFSTR("DBGBuildSourcePath"))); -if (build_src_cfpath) -{ -char actual_src_path[PATH_MAX]; -char build_src_path[PATH_MAX]; -::CFStringGetFileSystemRepresentation (actual_src_cfpath, actual_src_path, sizeof(actual_src_path)); -::CFStringGetFileSystemRepresentation (build_src_cfpath, build_src_path, sizeof(build_src_path)); -if (actual_src_path[0] == '~') -{ -FileSpec resolved_source_path(actual_src_path, true); - resolved_source_path.GetPath(actual_src_path, sizeof(actual_src_path)); -} -module_spec.GetSourceMappingList().Append (ConstString(build_src_path), ConstString(actual_src_path), true); -} -} -} -} - if (out_exec_fspec) { bool success = false; +CFCReleaser dict(::DBGCopyDSYMPropertyLists (dsym_url.get())); +CFDictionaryRef uuid_dict = NULL; +if (dict.get()) +{ +CFCString uuid_cfstr (uuid->GetAsString().c_str()); +uuid_dict = static_cast(::CFDictionaryGetValue (dict.get(), uuid_cfstr.get())); +} if (uuid_dict) { CFStringRef exec_cf_path = static_cast(::CFDictionaryGetValue (uuid_dict, CFSTR("DBGSymbolRichExecutable"))); Modified: lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp?rev=243181&r1=243180&r2=243181&view=diff == --- lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp (original) +++ lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp Fri Jul 24 18:40:32 2015 @@ -204,6 +204,11 @@ SymbolVendorMacOSX::CreateInstance (cons plist.GetValueAsString("DBGSourcePath", DBGSourcePath); if (!DBGBuildSourcePath.empty() && !DBGSourcePath.empty()) { +if (DBGSourcePath[0] == '~') +{ +FileSpec resolved_source_path(DBGSourcePath.c_str(), true); +DBGSourcePath = resolved_source_path.GetPath(); +} module_sp->GetSourceMappingList().App
[Lldb-commits] [lldb] r243180 - Use double-checked locking to avoid locking the Module mutex if we don't need to. This avoid a deadlock we were seeing in Xcode.
Author: gclayton Date: Fri Jul 24 18:38:01 2015 New Revision: 243180 URL: http://llvm.org/viewvc/llvm-project?rev=243180&view=rev Log: Use double-checked locking to avoid locking the Module mutex if we don't need to. This avoid a deadlock we were seeing in Xcode. Modified: lldb/trunk/include/lldb/Core/Module.h lldb/trunk/source/Core/Module.cpp Modified: lldb/trunk/include/lldb/Core/Module.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Module.h?rev=243180&r1=243179&r2=243180&view=diff == --- lldb/trunk/include/lldb/Core/Module.h (original) +++ lldb/trunk/include/lldb/Core/Module.h Fri Jul 24 18:38:01 2015 @@ -10,6 +10,7 @@ #ifndef liblldb_Module_h_ #define liblldb_Module_h_ +#include #include "lldb/lldb-forward.h" #include "lldb/Core/ArchSpec.h" #include "lldb/Core/UUID.h" @@ -1119,13 +1120,13 @@ protected: PathMappingList m_source_mappings; ///< Module specific source remappings for when you have debug info for a module that doesn't match where the sources currently are lldb::SectionListUP m_sections_ap; ///< Unified section list for module that is used by the ObjectFile and and ObjectFile instances for the debug info -boolm_did_load_objfile:1, -m_did_load_symbol_vendor:1, -m_did_parse_uuid:1, -m_did_init_ast:1; +std::atomic m_did_load_objfile; +std::atomic m_did_load_symbol_vendor; +std::atomic m_did_parse_uuid; +std::atomic m_did_init_ast; mutable boolm_file_has_changed:1, m_first_file_changed_log:1; /// See if the module was modified after it was initially opened. - + //-- /// Resolve a file or load virtual address. /// Modified: lldb/trunk/source/Core/Module.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=243180&r1=243179&r2=243180&view=diff == --- lldb/trunk/source/Core/Module.cpp (original) +++ lldb/trunk/source/Core/Module.cpp Fri Jul 24 18:38:01 2015 @@ -399,15 +399,18 @@ Module::GetMemoryObjectFile (const lldb: const lldb_private::UUID& Module::GetUUID() { -Mutex::Locker locker (m_mutex); -if (m_did_parse_uuid == false) +if (m_did_parse_uuid.load() == false) { -ObjectFile * obj_file = GetObjectFile (); - -if (obj_file != NULL) +Mutex::Locker locker (m_mutex); +if (m_did_parse_uuid.load() == false) { -obj_file->GetUUID(&m_uuid); -m_did_parse_uuid = true; +ObjectFile * obj_file = GetObjectFile (); + +if (obj_file != NULL) +{ +obj_file->GetUUID(&m_uuid); +m_did_parse_uuid = true; +} } } return m_uuid; @@ -416,32 +419,35 @@ Module::GetUUID() ClangASTContext & Module::GetClangASTContext () { -Mutex::Locker locker (m_mutex); -if (m_did_init_ast == false) +if (m_did_init_ast.load() == false) { -ObjectFile * objfile = GetObjectFile(); -ArchSpec object_arch; -if (objfile && objfile->GetArchitecture(object_arch)) -{ -m_did_init_ast = true; - -// LLVM wants this to be set to iOS or MacOSX; if we're working on -// a bare-boards type image, change the triple for llvm's benefit. -if (object_arch.GetTriple().getVendor() == llvm::Triple::Apple -&& object_arch.GetTriple().getOS() == llvm::Triple::UnknownOS) -{ -if (object_arch.GetTriple().getArch() == llvm::Triple::arm || -object_arch.GetTriple().getArch() == llvm::Triple::aarch64 || -object_arch.GetTriple().getArch() == llvm::Triple::thumb) -{ -object_arch.GetTriple().setOS(llvm::Triple::IOS); -} -else +Mutex::Locker locker (m_mutex); +if (m_did_init_ast.load() == false) +{ +ObjectFile * objfile = GetObjectFile(); +ArchSpec object_arch; +if (objfile && objfile->GetArchitecture(object_arch)) +{ +m_did_init_ast = true; + +// LLVM wants this to be set to iOS or MacOSX; if we're working on +// a bare-boards type image, change the triple for llvm's benefit. +if (object_arch.GetTriple().getVendor() == llvm::Triple::Apple +&& object_arch.GetTriple().getOS() == llvm::Triple::UnknownOS) { -object_arch.GetTriple().setOS(llvm::Triple::MacOSX); +if
Re: [Lldb-commits] [PATCH] D11498: Print reference values on one line.
granata.enrico added a subscriber: granata.enrico. granata.enrico added a comment. I am assuming that your intent is: int x = 1; int& y = 1; (lldb) frame variable y (int&) y = 0x123456 (y = 1) If so, two things: a) a much better way would be to make FormatManager::ShouldPrintAsOneLiner() decide that a T& can be printed on one-line iff the referenced thing can b) test cases would be great If I am reading your intent wrong, can you please elaborate on what you're trying to achieve? I would really appreciate if you didn't commit this. http://reviews.llvm.org/D11498 ___ lldb-commits mailing list lldb-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D11482: Add target setting to have the language follow the frame's CU.
clayborg requested changes to this revision. clayborg added a comment. This revision now requires changes to proceed. I think it is fine to add support for looking at the target.language and using it if set, but I don't think we need a "target.language-follows-frame" setting at all. We should just do the right thing. But the right thing I think it means just asking the frame for its expression language. See inlined comments. Comment at: include/lldb/Target/Target.h:175-177 @@ -174,2 +174,5 @@ +bool +GetLanguageFollowsFrame () const; + const char * Remove this, we shouldn't need this setting. Comment at: include/lldb/Target/Target.h:1443-1445 @@ -1439,2 +1442,5 @@ +lldb::LanguageType +GetLanguageOfSelectedFrame () const; + SourceManager & This should be on lldb_private::StackFrame and should be: ``` lldb::LanguageType StackFrame::GetDefaultExpressionLanguage(); ``` Comment at: source/Commands/CommandObjectExpression.cpp:303-312 @@ -302,8 +302,12 @@ options.SetDebug(m_command_options.debug); - -// If the language was not specified, set it from target's properties + +// If the expression's language was not specified, check the +// target's properties to see if a language override was set, +// or if the language should match that of the frame. if (m_command_options.language != eLanguageTypeUnknown) options.SetLanguage(m_command_options.language); -else +else if (target->GetLanguage() != eLanguageTypeUnknown) options.SetLanguage(target->GetLanguage()); +else if (target->GetLanguageFollowsFrame()) +options.SetLanguage(target->GetLanguageOfSelectedFrame()); This should be: ``` if (m_command_options.language != eLanguageTypeUnknown) options.SetLanguage(m_command_options.language); else { StackFrame *frame = exe_ctx.GetFramePtr(); if (frame) options.SetLanguage(frame-> GetDefaultExpressionLanguage()); } Comment at: source/Target/Target.cpp:391-395 @@ -387,2 +390,7 @@ language = GetLanguage(); +// If the target's language override wasn't set but +// was set to follow the selected frame, use that. +if (language == lldb::eLanguageTypeUnknown && +GetLanguageFollowsFrame()) +language = GetLanguageOfSelectedFrame(); Remove this. Comment at: source/Target/Target.cpp:430-434 @@ -419,2 +429,7 @@ language = GetLanguage(); +// If the target's language override wasn't set but +// was set to follow the selected frame, use that. +if (language == lldb::eLanguageTypeUnknown && +GetLanguageFollowsFrame()) +language = GetLanguageOfSelectedFrame(); Remove this. Comment at: source/Target/Target.cpp:468-472 @@ -450,3 +467,7 @@ language = GetLanguage(); - +// If the target's language override wasn't set but +// was set to follow the selected frame, use that. +if (language == lldb::eLanguageTypeUnknown && +GetLanguageFollowsFrame()) +language = GetLanguageOfSelectedFrame(); Remove this. Comment at: source/Target/Target.cpp:2158-2178 @@ -2136,1 +2157,23 @@ +// Return the language of the selected frame's CU. +lldb::LanguageType +Target::GetLanguageOfSelectedFrame () const +{ +LanguageType language = eLanguageTypeUnknown; +if (m_process_sp) +{ +ThreadSP sel_thread_sp(m_process_sp->GetThreadList().GetSelectedThread()); +if (sel_thread_sp) +{ +StackFrameSP sel_frame_sp = sel_thread_sp->GetSelectedFrame(); +if (sel_frame_sp) +{ +CompileUnit *cu = sel_frame_sp->GetSymbolContext(eSymbolContextCompUnit).comp_unit; +if (cu) +language = cu->GetLanguage(); +} +} +} +return language; +} + This should be moved to the StackFrame as: ``` lldb::LanguageType StackFrame::GetDefaultExpressionLanguage(); ``` And it should check if the language is form of C, C++, ObjC, or ObjC ++, then return ObjC++, else return the language. Comment at: source/Target/Target.cpp:2998 @@ -2955,1 +2997,3 @@ +{ "language" , OptionValue::eTypeLanguage , false, eLanguageTypeUnknown , NULL, NULL, "The language to use when interpreting expressions entered in commands." }, +{ "language-follows-frame" , OptionValue::eTypeBoolean , false, false , NULL, NULL, "If the target.language is unknown, default to the language of the selected frame." }, { "expr-prefix", OptionValue::eTypeFileSpec , false, 0
Re: [Lldb-commits] [PATCH] D11498: Print reference values on one line.
clayborg resigned from this revision. clayborg removed a reviewer: clayborg. clayborg added a comment. I will defer to Enrico on this one. http://reviews.llvm.org/D11498 ___ lldb-commits mailing list lldb-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D11497: Change Socket::Read / Socket::Write to log to LOG_COMMUNICATION instead of LOG_HOST
jasonmolenda closed this revision. jasonmolenda added a comment. Sendingsource/Host/common/Socket.cpp Transmitting file data . Committed revision 243175. Repository: rL LLVM http://reviews.llvm.org/D11497 ___ lldb-commits mailing list lldb-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r243175 - Log socket communications to LIBLLDB_LOG_COMMUNICATION instead of
Author: jmolenda Date: Fri Jul 24 17:42:03 2015 New Revision: 243175 URL: http://llvm.org/viewvc/llvm-project?rev=243175&view=rev Log: Log socket communications to LIBLLDB_LOG_COMMUNICATION instead of the Host channel. http://reviews.llvm.org/D11497 Modified: lldb/trunk/source/Host/common/Socket.cpp Modified: lldb/trunk/source/Host/common/Socket.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Socket.cpp?rev=243175&r1=243174&r2=243175&view=diff == --- lldb/trunk/source/Host/common/Socket.cpp (original) +++ lldb/trunk/source/Host/common/Socket.cpp Fri Jul 24 17:42:03 2015 @@ -139,7 +139,7 @@ Error Socket::TcpConnect(llvm::StringRef NativeSocket sock = kInvalidSocketValue; Error error; -Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_HOST)); +Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_COMMUNICATION)); if (log) log->Printf ("Socket::TcpConnect (host/port = %s)", host_and_port.data()); @@ -632,7 +632,7 @@ Error Socket::Read (void *buf, size_t &n else num_bytes = bytes_received; -Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_HOST | LIBLLDB_LOG_COMMUNICATION)); +Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_COMMUNICATION)); if (log) { log->Printf ("%p Socket::Read() (socket = %" PRIu64 ", src = %p, src_len = %" PRIu64 ", flags = 0) => %" PRIi64 " (error = %s)", @@ -674,7 +674,7 @@ Error Socket::Write (const void *buf, si else num_bytes = bytes_sent; -Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_HOST)); +Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_COMMUNICATION)); if (log) { log->Printf ("%p Socket::Write() (socket = %" PRIu64 ", src = %p, src_len = %" PRIu64 ", flags = 0) => %" PRIi64 " (error = %s)", ___ lldb-commits mailing list lldb-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D11447: Specify a language to use when parsing expressions.
clayborg accepted this revision. clayborg added a comment. This revision is now accepted and ready to land. Looks good, thanks for fixing everything. Repository: rL LLVM http://reviews.llvm.org/D11447 ___ lldb-commits mailing list lldb-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D11497: Change Socket::Read / Socket::Write to log to LOG_COMMUNICATION instead of LOG_HOST
Seems reasonable. lgtm On Fri, Jul 24, 2015 at 3:18 PM Jason Molenda wrote: > jasonmolenda created this revision. > jasonmolenda added a reviewer: zturner. > jasonmolenda added a subscriber: lldb-commits. > jasonmolenda set the repository for this revision to rL LLVM. > > I'm adding some new host logging to help diagnose problems of finding > executable files or dSYMs, Greg suggested we should add it to the Host log > channel. Currently Socket::Read and Socket::Write are logging to Host > which is super verbose. He suggests that we should switch these over the > Communication log channel instead. Some of Socket.cpp is logging to > LOG_CONNECTION already. Zachary, any opinion on this? I think you touched > this most recently. Not sure if you're using this logging yourself. > > Repository: > rL LLVM > > http://reviews.llvm.org/D11497 > > Files: > source/Host/common/Socket.cpp > > Index: source/Host/common/Socket.cpp > === > --- source/Host/common/Socket.cpp > +++ source/Host/common/Socket.cpp > @@ -139,7 +139,7 @@ > NativeSocket sock = kInvalidSocketValue; > Error error; > > -Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_HOST)); > +Log *log(lldb_private::GetLogIfAnyCategoriesSet > (LIBLLDB_LOG_COMMUNICATION)); > if (log) > log->Printf ("Socket::TcpConnect (host/port = %s)", > host_and_port.data()); > > @@ -632,7 +632,7 @@ > else > num_bytes = bytes_received; > > -Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_HOST | > LIBLLDB_LOG_COMMUNICATION)); > +Log *log(lldb_private::GetLogIfAnyCategoriesSet > (LIBLLDB_LOG_COMMUNICATION)); > if (log) > { > log->Printf ("%p Socket::Read() (socket = %" PRIu64 ", src = %p, > src_len = %" PRIu64 ", flags = 0) => %" PRIi64 " (error = %s)", > @@ -674,7 +674,7 @@ > else > num_bytes = bytes_sent; > > -Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_HOST)); > +Log *log(lldb_private::GetLogIfAnyCategoriesSet > (LIBLLDB_LOG_COMMUNICATION)); > if (log) > { > log->Printf ("%p Socket::Write() (socket = %" PRIu64 ", src = %p, > src_len = %" PRIu64 ", flags = 0) => %" PRIi64 " (error = %s)", > > > ___ lldb-commits mailing list lldb-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D11497: Change Socket::Read / Socket::Write to log to LOG_COMMUNICATION instead of LOG_HOST
jasonmolenda created this revision. jasonmolenda added a reviewer: zturner. jasonmolenda added a subscriber: lldb-commits. jasonmolenda set the repository for this revision to rL LLVM. I'm adding some new host logging to help diagnose problems of finding executable files or dSYMs, Greg suggested we should add it to the Host log channel. Currently Socket::Read and Socket::Write are logging to Host which is super verbose. He suggests that we should switch these over the Communication log channel instead. Some of Socket.cpp is logging to LOG_CONNECTION already. Zachary, any opinion on this? I think you touched this most recently. Not sure if you're using this logging yourself. Repository: rL LLVM http://reviews.llvm.org/D11497 Files: source/Host/common/Socket.cpp Index: source/Host/common/Socket.cpp === --- source/Host/common/Socket.cpp +++ source/Host/common/Socket.cpp @@ -139,7 +139,7 @@ NativeSocket sock = kInvalidSocketValue; Error error; -Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_HOST)); +Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_COMMUNICATION)); if (log) log->Printf ("Socket::TcpConnect (host/port = %s)", host_and_port.data()); @@ -632,7 +632,7 @@ else num_bytes = bytes_received; -Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_HOST | LIBLLDB_LOG_COMMUNICATION)); +Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_COMMUNICATION)); if (log) { log->Printf ("%p Socket::Read() (socket = %" PRIu64 ", src = %p, src_len = %" PRIu64 ", flags = 0) => %" PRIi64 " (error = %s)", @@ -674,7 +674,7 @@ else num_bytes = bytes_sent; -Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_HOST)); +Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_COMMUNICATION)); if (log) { log->Printf ("%p Socket::Write() (socket = %" PRIu64 ", src = %p, src_len = %" PRIu64 ", flags = 0) => %" PRIi64 " (error = %s)", Index: source/Host/common/Socket.cpp === --- source/Host/common/Socket.cpp +++ source/Host/common/Socket.cpp @@ -139,7 +139,7 @@ NativeSocket sock = kInvalidSocketValue; Error error; -Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_HOST)); +Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_COMMUNICATION)); if (log) log->Printf ("Socket::TcpConnect (host/port = %s)", host_and_port.data()); @@ -632,7 +632,7 @@ else num_bytes = bytes_received; -Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_HOST | LIBLLDB_LOG_COMMUNICATION)); +Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_COMMUNICATION)); if (log) { log->Printf ("%p Socket::Read() (socket = %" PRIu64 ", src = %p, src_len = %" PRIu64 ", flags = 0) => %" PRIi64 " (error = %s)", @@ -674,7 +674,7 @@ else num_bytes = bytes_sent; -Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_HOST)); +Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_COMMUNICATION)); if (log) { log->Printf ("%p Socket::Write() (socket = %" PRIu64 ", src = %p, src_len = %" PRIu64 ", flags = 0) => %" PRIi64 " (error = %s)", ___ lldb-commits mailing list lldb-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D11396: [lldb-mi] Fix breakpoints on functions when C++ namespaces are used.
dawn updated this revision to Diff 30609. dawn added a comment. Comment about "::func" syntax not working in lldb added as requested. Please accept this patch - it fixes namespace tokens used in lldb-mi breakpoints like "-break-insert ns::func". Patches to lldb and other issues are not intended to be part of this patch and should be handled separately. Thank you. Repository: rL LLVM http://reviews.llvm.org/D11396 Files: test/tools/lldb-mi/breakpoint/TestMiBreak.py tools/lldb-mi/MICmdCmdBreak.cpp Index: tools/lldb-mi/MICmdCmdBreak.cpp === --- tools/lldb-mi/MICmdCmdBreak.cpp +++ tools/lldb-mi/MICmdCmdBreak.cpp @@ -108,6 +108,25 @@ } //++ +// Helper function for CMICmdCmdBreakInsert::Execute(void). +// +// Given a string, return the position of the ':' separator in 'file:func' +// or 'file:line', if any. If not found, return npos. For example, return +// 5 for 'foo.c:std::string'. +//-- +static size_t findFileSeparatorPos(const std::string& x) +{ +// Full paths in windows can have ':' after a drive letter, so we +// search backwards, taking care to skip C++ namespace tokens '::'. +size_t n = x.find_last_of(':'); +while (n != std::string::npos && n > 1 && x[n-1] == ':') +{ +n = x.find_last_of(':', n - 2); +} +return n; +} + +//++ // Details: The invoker requires this function. The command does work in this function. // The command is likely to communicate with the LLDB SBDebugger in here. // Type:Overridden. @@ -161,17 +180,16 @@ // Determine if break on a file line or at a function BreakPoint_e eBrkPtType = eBreakPoint_NotDefineYet; -const CMIUtilString cColon = ":"; CMIUtilString fileName; MIuint nFileLine = 0; CMIUtilString strFileFn; CMIUtilString rStrLineOrFn; -// Full path in windows can have : after drive letter. So look for the -// last colon -const size_t nPosColon = m_brkName.find_last_of(cColon); +// Is the string in the form 'file:func' or 'file:line'? +// If so, find the position of the ':' separator. +const size_t nPosColon = findFileSeparatorPos(m_brkName); if (nPosColon != std::string::npos) { -// extract file name and line number from it +// Extract file name and line number from it fileName = m_brkName.substr(0, nPosColon); rStrLineOrFn = m_brkName.substr(nPosColon + 1, m_brkName.size() - nPosColon - 1); Index: test/tools/lldb-mi/breakpoint/TestMiBreak.py === --- test/tools/lldb-mi/breakpoint/TestMiBreak.py +++ test/tools/lldb-mi/breakpoint/TestMiBreak.py @@ -75,6 +75,11 @@ self.expect("\^running") self.expect("\*stopped,reason=\"breakpoint-hit\"") +# Test that we can set a BP using the global namespace token +#FIXME: this test is disabled due to a bug in lldb. +#self.runCmd("-break-insert ::main") +#self.expect("\^done,bkpt={number=\"3\"") + @lldbmi_test @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows") @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races @@ -206,7 +211,7 @@ self.expect("\^running") self.expect("\*stopped,reason=\"breakpoint-hit\",disp=\"del\",bkptno=\"3\"") -# Test that the target.language=pascal setting works and that BP #5 is not set +# Test that the target.language=pascal setting works and that BP #5 is NOT set self.runCmd("-interpreter-exec console \"settings set target.language c\"") self.expect("\^done") self.runCmd("-break-insert ns.foo1") @@ -213,14 +218,13 @@ self.expect("\^error") # Test that the target.language=c++ setting works and that BP #6 is hit -# FIXME: lldb-mi interprets 'ns::func' as file:func where file='ns:'. -#self.runCmd("-interpreter-exec console \"settings set target.language c++\"") -#self.expect("\^done") -#self.runCmd("-break-insert ns::foo1") -#self.expect("\^done,bkpt={number=\"6\"") -#self.runCmd("-exec-run") -#self.expect("\^running") - #self.expect("\*stopped,reason=\"breakpoint-hit\",disp=\"del\",bkptno=\"6\"") +self.runCmd("-interpreter-exec console \"settings set target.language c++\"") +self.expect("\^done") +self.runCmd("-break-insert ns::foo1") +self.expect("\^done,bkpt={number=\"6\"") +self.runCmd("-exec-continue") +self.expect("\^running") + self.expect("\*stopped,reason=\"breakpoint-hit\",disp=\"del\",bkptno=\"6\"") # Test that BP #1 and #2 weren't set by running to program exit self.runCmd("-exec-conti
Re: [Lldb-commits] [PATCH] D11482: Add target setting to have the language follow the frame's CU.
dawn updated this revision to Diff 30602. Repository: rL LLVM http://reviews.llvm.org/D11482 Files: include/lldb/Target/Target.h source/Commands/CommandObjectExpression.cpp source/Target/Target.cpp test/expression_command/options/main.cpp test/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py Index: test/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py === --- test/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py +++ test/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py @@ -75,13 +75,23 @@ exe = os.path.join(os.getcwd(), "a.out") self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) -# This should create a breakpoint with 1 locations. +# This should create a breakpoint with 1 location. +lldbutil.run_break_set_by_symbol (self, 'ns::func', sym_exact=False, extra_options = "-L c++", num_expected_locations=1) +# The language of the frame's CU is unknwon, so C++ is on by +# default. Hence this should create a breakpoint with 1 location. +self.runCmd("settings set target.language-follows-frame true") lldbutil.run_break_set_by_symbol (self, 'ns::func', sym_exact=False, extra_options = "-L c++", num_expected_locations=1) +self.runCmd("settings clear target.language-follows-frame") # This should create a breakpoint with 0 locations. lldbutil.run_break_set_by_symbol (self, 'ns::func', sym_exact=False, extra_options = "-L c", num_expected_locations=0) self.runCmd("settings set target.language c") lldbutil.run_break_set_by_symbol (self, 'ns::func', sym_exact=False, num_expected_locations=0) +# target.language overrides target.language-follows-frame, +# so this should also create a breakpoint with 0 locations. +self.runCmd("settings set target.language-follows-frame true") +lldbutil.run_break_set_by_symbol (self, 'ns::func', sym_exact=False, num_expected_locations=0) +self.runCmd("settings clear target.language-follows-frame") # Run the program. self.runCmd("run", RUN_SUCCEEDED) Index: test/expression_command/options/main.cpp === --- test/expression_command/options/main.cpp +++ test/expression_command/options/main.cpp @@ -10,7 +10,6 @@ int main (int argc, char const *argv[]) { -// breakpoint_in_main -bar(); +bar(); // breakpoint_in_main return foo(); } Index: source/Target/Target.cpp === --- source/Target/Target.cpp +++ source/Target/Target.cpp @@ -43,6 +43,7 @@ #include "lldb/Interpreter/OptionValues.h" #include "lldb/Interpreter/Property.h" #include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Target/LanguageRuntime.h" #include "lldb/Target/ObjCLanguageRuntime.h" @@ -383,8 +384,15 @@ if (skip_prologue == eLazyBoolCalculate) skip_prologue = GetSkipPrologue() ? eLazyBoolYes : eLazyBoolNo; + +// If breakpoint's language wasn't set, use target's. if (language == lldb::eLanguageTypeUnknown) language = GetLanguage(); +// If the target's language override wasn't set but +// was set to follow the selected frame, use that. +if (language == lldb::eLanguageTypeUnknown && +GetLanguageFollowsFrame()) +language = GetLanguageOfSelectedFrame(); BreakpointResolverSP resolver_sp (new BreakpointResolverName (NULL, func_name, @@ -415,8 +423,15 @@ if (skip_prologue == eLazyBoolCalculate) skip_prologue = GetSkipPrologue() ? eLazyBoolYes : eLazyBoolNo; + +// If breakpoint's language wasn't set, use target's. if (language == lldb::eLanguageTypeUnknown) language = GetLanguage(); +// If the target's language override wasn't set but +// was set to follow the selected frame, use that. +if (language == lldb::eLanguageTypeUnknown && +GetLanguageFollowsFrame()) +language = GetLanguageOfSelectedFrame(); BreakpointResolverSP resolver_sp (new BreakpointResolverName (NULL, func_names, @@ -446,9 +461,15 @@ if (skip_prologue == eLazyBoolCalculate) skip_prologue = GetSkipPrologue() ? eLazyBoolYes : eLazyBoolNo; + +// If breakpoint's language wasn't set, use target's. if (language == lldb::eLanguageTypeUnknown) language = GetLanguage(); - +// If the target's language override wasn't set but +// was set to follow the selected frame, use that. +
Re: [Lldb-commits] [PATCH] D11447: Specify a language to use when parsing expressions.
dawn updated this revision to Diff 30600. dawn added a comment. Changed test to use SB APIs. Repository: rL LLVM http://reviews.llvm.org/D11447 Files: source/Commands/CommandObjectExpression.cpp source/Commands/CommandObjectExpression.h test/expression_command/options/Makefile test/expression_command/options/TestExprOptions.py test/expression_command/options/foo.cpp test/expression_command/options/main.cpp Index: test/expression_command/options/main.cpp === --- test/expression_command/options/main.cpp +++ test/expression_command/options/main.cpp @@ -0,0 +1,16 @@ +extern "C" int foo(void); +static int static_value = 0; + +int +bar() +{ +static_value++; +return static_value; +} + +int main (int argc, char const *argv[]) +{ +// breakpoint_in_main +bar(); +return foo(); +} Index: test/expression_command/options/foo.cpp === --- test/expression_command/options/foo.cpp +++ test/expression_command/options/foo.cpp @@ -0,0 +1,11 @@ +namespace ns { +int func(void) +{ +return 0; +} +} + +extern "C" int foo(void) +{ +return ns::func(); +} Index: test/expression_command/options/TestExprOptions.py === --- test/expression_command/options/TestExprOptions.py +++ test/expression_command/options/TestExprOptions.py @@ -0,0 +1,100 @@ +""" +Test expression command options. + +Test cases: + +o test_expr_options: + Test expression command options. +""" + +import os, time +import unittest2 +import lldb +import lldbutil +from lldbtest import * + +class ExprOptionsTestCase(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +def setUp(self): +# Call super's setUp(). +TestBase.setUp(self) + +self.main_source = "main.cpp" +self.main_source_spec = lldb.SBFileSpec (self.main_source) +self.line = line_number('main.cpp', '// breakpoint_in_main') +self.exe = os.path.join(os.getcwd(), "a.out") + +def test_expr_options(self): +"""These expression command options should work as expected.""" +self.buildDefault() + +# Set debugger into synchronous mode +self.dbg.SetAsync(False) + +# Create a target by the debugger. +target = self.dbg.CreateTarget(self.exe) +self.assertTrue(target, VALID_TARGET) + +# Set breakpoints inside main. +breakpoint = target.BreakpointCreateBySourceRegex('// breakpoint_in_main', self.main_source_spec) +self.assertTrue(breakpoint) + +# Now launch the process, and do not stop at entry point. +process = target.LaunchSimple(None, None, self.get_process_working_directory()) +self.assertTrue(process, PROCESS_IS_VALID) + +threads = lldbutil.get_threads_stopped_at_breakpoint(process, breakpoint) +self.assertEqual(len(threads), 1) + +frame = threads[0].GetFrameAtIndex(0) +options = lldb.SBExpressionOptions() + +# -- test --language on ObjC builtin type using the SB API's -- +# Make sure we can evaluate the ObjC builtin type 'id': +val = frame.EvaluateExpression('id my_id = 0; my_id') +self.assertTrue(val.IsValid()) +self.assertTrue(val.GetError().Success()) +self.assertEqual(val.GetValueAsUnsigned(0), 0) +self.DebugSBValue(val) + +# Make sure it still works if language is set to ObjC: +options.SetLanguage(lldb.eLanguageTypeObjC) +val = frame.EvaluateExpression('id my_id = 0; my_id', options) +self.assertTrue(val.IsValid()) +self.assertTrue(val.GetError().Success()) +self.assertEqual(val.GetValueAsUnsigned(0), 0) +self.DebugSBValue(val) + +# Make sure it fails if language is set to C: +options.SetLanguage(lldb.eLanguageTypeC) +val = frame.EvaluateExpression('id my_id = 0; my_id', options) +self.assertTrue(val.IsValid()) +self.assertFalse(val.GetError().Success()) + +# -- test --language on C++ expression using the SB API's -- +# Make sure we can evaluate 'ns::func'. +val = frame.EvaluateExpression('ns::func') +self.assertTrue(val.IsValid()) +self.assertTrue(val.GetError().Success()) +self.DebugSBValue(val) + +# Make sure it still works if language is set to C++: +options.SetLanguage(lldb.eLanguageTypeC_plus_plus) +val = frame.EvaluateExpression('ns::func', options) +self.assertTrue(val.IsValid()) +self.assertTrue(val.GetError().Success()) +self.DebugSBValue(val) + +# Make sure it fails if language is set to C: +options.SetLanguage(lldb.eLanguageTypeC) +val = frame.EvaluateExpression('ns::func', options) +self.assertTrue(val.IsValid()) +self.assertFalse(val.GetError().Success()) + +if __name__ == '__m
Re: [Lldb-commits] [PATCH] D11488: Fix bug in expression display when determining if a pointer should be treated as a string
paulmaybee updated this revision to Diff 30590. paulmaybee added a comment. Add test case http://reviews.llvm.org/D11488 Files: test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py test/tools/lldb-mi/variable/main.cpp tools/lldb-mi/MICmnLLDBUtilSBValue.cpp tools/lldb-mi/MICmnLLDBUtilSBValue.h Index: tools/lldb-mi/MICmnLLDBUtilSBValue.h === --- tools/lldb-mi/MICmnLLDBUtilSBValue.h +++ tools/lldb-mi/MICmnLLDBUtilSBValue.h @@ -57,7 +57,8 @@ CMIUtilString GetSimpleValueCStringPointer(void) const; CMIUtilString GetSimpleValueCStringArray(void) const; bool GetCompositeValue(const bool vbPrintFieldNames, CMICmnMIValueTuple &vwrMiValueTuple, const MIuint vnDepth = 1) const; - +static bool IsCharBasicType(lldb::BasicType eType); + // Attributes: private: lldb::SBValue &m_rValue; Index: tools/lldb-mi/MICmnLLDBUtilSBValue.cpp === --- tools/lldb-mi/MICmnLLDBUtilSBValue.cpp +++ tools/lldb-mi/MICmnLLDBUtilSBValue.cpp @@ -136,7 +136,9 @@ } else if (IsPointerType()) { -if (m_bHandleCharType && IsFirstChildCharType()) +const lldb::BasicType eType = m_rValue.GetType().GetPointeeType().GetBasicType(); + +if (m_bHandleCharType && IsCharBasicType(eType)) { vwrValue = GetSimpleValueCStringPointer(); return MIstatus::success; @@ -358,17 +360,15 @@ } //++ -// Details: Retrieve the flag stating whether this value object is a char type or some -// other type. Char type can be signed or unsigned. +// Details: Check that basic type is a char type. Char type can be signed or unsigned. // Type:Method. -// Args:None. +// Args:eType - type to check // Return: bool- True = Yes is a char type, false = some other type. // Throws: None. //-- bool -CMICmnLLDBUtilSBValue::IsCharType(void) const +CMICmnLLDBUtilSBValue::IsCharBasicType(lldb::BasicType eType) { -const lldb::BasicType eType = m_rValue.GetType().GetBasicType(); switch (eType) { case lldb::eBasicTypeChar: @@ -383,6 +383,22 @@ } //++ +// Details: Retrieve the flag stating whether this value object is a char type or some +// other type. Char type can be signed or unsigned. +// Type:Method. +// Args:None. +// Return: bool- True = Yes is a char type, false = some other type. +// Throws: None. +//-- +bool +CMICmnLLDBUtilSBValue::IsCharType(void) const +{ +const lldb::BasicType eType = m_rValue.GetType().GetBasicType(); +return IsCharBasicType(eType); +} + + +//++ // Details: Retrieve the flag stating whether first child value object of *this object is // a char type or some other type. Returns false if there are not children. Char // type can be signed or unsigned. Index: test/tools/lldb-mi/variable/main.cpp === --- test/tools/lldb-mi/variable/main.cpp +++ test/tools/lldb-mi/variable/main.cpp @@ -67,11 +67,20 @@ // BP_gdb_set_show_print_char_array_as_string_test } +struct not_str +{ +char c; +int f; +not_str(char _c, int _f) : c(_c), f(_f) +{} +}; + void gdb_set_show_print_expand_aggregates(void) { complex_type complx = { 3, { 3L }, &complx }; complex_type complx_array[2] = { { 4, { 4L }, &complx_array[1] }, { 5, { 5 }, &complx_array[0] } }; +not_str* ps = new not_str('a', 0); // BP_gdb_set_show_print_expand_aggregates } Index: test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py === --- test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py +++ test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py @@ -132,6 +132,10 @@ self.runCmd("-var-create var2 * complx_array") self.expect("\^done,name=\"var2\",numchild=\"2\",value=\"\[2\]\",type=\"complex_type \[2\]\",thread-id=\"1\",has_more=\"0\"") +# Test that a struct with a char first element is not formatted as a string +self.runCmd("-var-create - * ps") +self.expect("\^done,name=\"var\d+\",numchild=\"2\",value=\"0x[0-9a-f]+\",type=\"not_str \*\",thread-id=\"1\",has_more=\"0\"") + # Test that -gdb-set can set print expand-aggregates flag self.runCmd("-gdb-set print expand-aggregates on") self.expect("\^done") ___ lldb-commits mailing list lldb-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D11431: Convert ScriptInterpreters to being first-class plugins
I can help you figure out the Xcode stuff, it isn't too hard once you see how Xcode does things. I don't have many cycles right now unfortunately. Greg > On Jul 24, 2015, at 10:52 AM, Zachary Turner wrote: > > > > On Fri, Jul 24, 2015 at 10:42 AM Greg Clayton wrote: > > > On Jul 24, 2015, at 10:19 AM, Zachary Turner wrote: > > > > zturner added a comment. > > > > Hi Greg, > > > > I wonder if this has something to do with the fact that the SWIG generation > > shell script is one of the build phases of LLDB.Framework as you mentioned > > once before here: > > http://lists.cs.uiuc.edu/pipermail/lldb-dev/2015-February/006685.html. Is > > it possible to change this so that the SWIG wrappers are built along with > > the regular source? It seems to me like LLDBWrapPython.cpp should be > > compiled into Plugins/ScriptInterpreter/Python > > The SWIG stuff needs to be built in your ScriptInterpreterPython static > library, not with LLDB.framework. The bindings just use the public API so > these swig bindings should be moved to where you are compiling the > ScriptInterpreterPython. > > > > > Or, alternatively, manually fiddle with the linker line as a last resort? > > Hopefully we don't have to do this. > > > This might be a better approach for now, because moving the location of > > LLDBWrapPython.cpp might require changes to the shells cript and python > > script. Which we can do, but it seems better as a followup CL just so that > > we can do things in small pieces in order to keep moving forward. > > No, this needs to be done with this CL since you are extracting all python > stuff into a plug-in. > > > > I'm still a little unclear why the problem happens though. If > > LLDBWrapPython.cpp is being linked into liblldb, and > > ScriptInterpreterPython is being built as a static library, then where are > > the linker errors coming from? They're declared extern in the Python > > plugin, which shouldn't care that they're not visible at link time, because > > liblldb contains all the definitions. What part am I missing? > > Not sure. I haven't had time to get tot this yet, but the SWIG stuff should > be being built into the static library for ScriptInterpreterPython. > > I can make this work for the CMake build, but I think I will need help > getting this working with the Xcode build since it requires changing build > phases and is not just adding / moving around source files. > > Is there anyone there that has some cycles to help out with this? I've had > this CL in the pipeline for close to 3 weeks (not including the time I was > away on vacation), so I would like to see it closed out. ___ lldb-commits mailing list lldb-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D11488: Fix bug in expression display when determining if a pointer should be treated as a string
ki.stfu added a comment. It looks strangely for me. If structure has the first element of type char then GetChildAtIndex(0) will refer to this element and GetType().GetBasicType() will be char. But if we have a pointer to that structure then I suppose GetChildAtIndex(0) will not be equal to the first element of structure. From my point of view, it should relate to this structure entirely, but not to its first element. http://reviews.llvm.org/D11488 ___ lldb-commits mailing list lldb-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D11488: Fix bug in expression display when determining if a pointer should be treated as a string
ki.stfu requested changes to this revision. ki.stfu added a comment. This revision now requires changes to proceed. Add add a test case for this please. http://reviews.llvm.org/D11488 ___ lldb-commits mailing list lldb-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D11473: Add option eTypeOptionHideEmptyAggregates.
granata.enrico accepted this revision. granata.enrico added a comment. This revision is now accepted and ready to land. If the test suite passes, go ahead and commit http://reviews.llvm.org/D11473 ___ lldb-commits mailing list lldb-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D11447: Specify a language to use when parsing expressions.
spyffe added a comment. This all looks all right to me, except that we should print errors if C or Objective-C is requested, because we can only run in C++ or Objective-C++ mode. We should be careful to switch away from ObjC++ only on request, and not based on the current compilation unit's language, but that's a different patch. Repository: rL LLVM http://reviews.llvm.org/D11447 ___ lldb-commits mailing list lldb-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D11431: Convert ScriptInterpreters to being first-class plugins
> On Jul 24, 2015, at 10:19 AM, Zachary Turner wrote: > > zturner added a comment. > > Hi Greg, > > I wonder if this has something to do with the fact that the SWIG generation > shell script is one of the build phases of LLDB.Framework as you mentioned > once before here: > http://lists.cs.uiuc.edu/pipermail/lldb-dev/2015-February/006685.html. Is it > possible to change this so that the SWIG wrappers are built along with the > regular source? It seems to me like LLDBWrapPython.cpp should be compiled > into Plugins/ScriptInterpreter/Python The SWIG stuff needs to be built in your ScriptInterpreterPython static library, not with LLDB.framework. The bindings just use the public API so these swig bindings should be moved to where you are compiling the ScriptInterpreterPython. > > Or, alternatively, manually fiddle with the linker line as a last resort? Hopefully we don't have to do this. > This might be a better approach for now, because moving the location of > LLDBWrapPython.cpp might require changes to the shells cript and python > script. Which we can do, but it seems better as a followup CL just so that > we can do things in small pieces in order to keep moving forward. No, this needs to be done with this CL since you are extracting all python stuff into a plug-in. > > I'm still a little unclear why the problem happens though. If > LLDBWrapPython.cpp is being linked into liblldb, and ScriptInterpreterPython > is being built as a static library, then where are the linker errors coming > from? They're declared extern in the Python plugin, which shouldn't care > that they're not visible at link time, because liblldb contains all the > definitions. What part am I missing? Not sure. I haven't had time to get tot this yet, but the SWIG stuff should be being built into the static library for ScriptInterpreterPython. > > > http://reviews.llvm.org/D11431 > > > ___ lldb-commits mailing list lldb-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D11447: Specify a language to use when parsing expressions.
clayborg requested changes to this revision. clayborg added a comment. This revision now requires changes to proceed. Please use SB API calls for expression evaluation instead of self.expect calls. Comment at: test/expression_command/options/TestExprOptions.py:57-87 @@ +56,33 @@ + +# -- test --language on ObjC builtin type -- +# Make sure we can evaluate the ObjC builtin type 'id': +self.expect("expr id my_id = 0; my_id", +substrs = ["= nil"]) +# Make sure it still works if language is set to ObjC: +self.expect("expr -l objc -- id my_id = 0; my_id", +substrs = ["= nil"]) +# Make sure it fails if language is set to C: +self.expect("expr -l c -- id my_id = 0; my_id", error=True, +startstr = "error") +# Make sure it fails if the target's language is set to C: +self.runCmd("settings set target.language c") +self.expect("expr id my_id = 0; my_id", error=True, +startstr = "error") +self.runCmd("settings clear target.language") + +# -- test --language on C++ expression -- +# Make sure we can evaluate 'ns::func'. +self.expect("expr ns::func", +patterns = ["\(int .* = 0x.*"]) +# Make sure it still works if language is set to C++: +self.expect("expr -l c++ -- ns::func", +patterns = ["\(int .* = 0x.*"]) +# Make sure it fails if language is set to C: +self.expect("expr -l c -- ns::func", error=True, +startstr = "error") +# Make sure it fails if the target's language is set to C: +self.runCmd("settings set target.language c") +self.expect("expr ns::func", error=True, +startstr = "error") +self.runCmd("settings clear target.language") + Please use SB API calls for expression evaluation instead of self.expect calls. Repository: rL LLVM http://reviews.llvm.org/D11447 ___ lldb-commits mailing list lldb-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D11488: Fix bug in expression display when determining if a pointer should be treated as a string
paulmaybee created this revision. paulmaybee added reviewers: abidh, ki.stfu, ChuckR. paulmaybee added subscribers: lldb-commits, greggm. Currently if the "first child" of the pointer is a char type then the pointer is displayed as a string. This test succeeds incorrectly when the pointer is to a structured type with a char type as its first field. Fix this by switching the test to retrieve the pointee type and checking that it is a char type. http://reviews.llvm.org/D11488 Files: tools/lldb-mi/MICmnLLDBUtilSBValue.cpp tools/lldb-mi/MICmnLLDBUtilSBValue.h Index: tools/lldb-mi/MICmnLLDBUtilSBValue.h === --- tools/lldb-mi/MICmnLLDBUtilSBValue.h +++ tools/lldb-mi/MICmnLLDBUtilSBValue.h @@ -57,7 +57,8 @@ CMIUtilString GetSimpleValueCStringPointer(void) const; CMIUtilString GetSimpleValueCStringArray(void) const; bool GetCompositeValue(const bool vbPrintFieldNames, CMICmnMIValueTuple &vwrMiValueTuple, const MIuint vnDepth = 1) const; - +static bool IsCharBasicType(lldb::BasicType eType); + // Attributes: private: lldb::SBValue &m_rValue; Index: tools/lldb-mi/MICmnLLDBUtilSBValue.cpp === --- tools/lldb-mi/MICmnLLDBUtilSBValue.cpp +++ tools/lldb-mi/MICmnLLDBUtilSBValue.cpp @@ -136,7 +136,9 @@ } else if (IsPointerType()) { -if (m_bHandleCharType && IsFirstChildCharType()) +const lldb::BasicType eType = m_rValue.GetType().GetPointeeType().GetBasicType(); + +if (m_bHandleCharType && IsCharBasicType(eType)) { vwrValue = GetSimpleValueCStringPointer(); return MIstatus::success; @@ -358,17 +360,15 @@ } //++ -// Details: Retrieve the flag stating whether this value object is a char type or some -// other type. Char type can be signed or unsigned. +// Details: Check that basic type is a char type. Char type can be signed or unsigned. // Type:Method. -// Args:None. +// Args:eType - type to check // Return: bool- True = Yes is a char type, false = some other type. // Throws: None. //-- bool -CMICmnLLDBUtilSBValue::IsCharType(void) const +CMICmnLLDBUtilSBValue::IsCharBasicType(lldb::BasicType eType) { -const lldb::BasicType eType = m_rValue.GetType().GetBasicType(); switch (eType) { case lldb::eBasicTypeChar: @@ -383,6 +383,22 @@ } //++ +// Details: Retrieve the flag stating whether this value object is a char type or some +// other type. Char type can be signed or unsigned. +// Type:Method. +// Args:None. +// Return: bool- True = Yes is a char type, false = some other type. +// Throws: None. +//-- +bool +CMICmnLLDBUtilSBValue::IsCharType(void) const +{ +const lldb::BasicType eType = m_rValue.GetType().GetBasicType(); +return IsCharBasicType(eType); +} + + +//++ // Details: Retrieve the flag stating whether first child value object of *this object is // a char type or some other type. Returns false if there are not children. Char // type can be signed or unsigned. Index: tools/lldb-mi/MICmnLLDBUtilSBValue.h === --- tools/lldb-mi/MICmnLLDBUtilSBValue.h +++ tools/lldb-mi/MICmnLLDBUtilSBValue.h @@ -57,7 +57,8 @@ CMIUtilString GetSimpleValueCStringPointer(void) const; CMIUtilString GetSimpleValueCStringArray(void) const; bool GetCompositeValue(const bool vbPrintFieldNames, CMICmnMIValueTuple &vwrMiValueTuple, const MIuint vnDepth = 1) const; - +static bool IsCharBasicType(lldb::BasicType eType); + // Attributes: private: lldb::SBValue &m_rValue; Index: tools/lldb-mi/MICmnLLDBUtilSBValue.cpp === --- tools/lldb-mi/MICmnLLDBUtilSBValue.cpp +++ tools/lldb-mi/MICmnLLDBUtilSBValue.cpp @@ -136,7 +136,9 @@ } else if (IsPointerType()) { -if (m_bHandleCharType && IsFirstChildCharType()) +const lldb::BasicType eType = m_rValue.GetType().GetPointeeType().GetBasicType(); + +if (m_bHandleCharType && IsCharBasicType(eType)) { vwrValue = GetSimpleValueCStringPointer(); return MIstatus::success; @@ -358,17 +360,15 @@ } //++ -// Details: Retrieve the flag stating whether this value object is a char type or some -// other type. Char type can be signed or unsigned. +// Details: Check that basic type is a char type. Char type can be signed or unsigned. // Type:Method. -// Args:None. +//
[Lldb-commits] [lldb] r243118 - Bind to the loopback when we are expecting a connection from 127.0.0.1 so we don't set off firewall protections.
Author: gclayton Date: Fri Jul 24 11:55:00 2015 New Revision: 243118 URL: http://llvm.org/viewvc/llvm-project?rev=243118&view=rev Log: Bind to the loopback when we are expecting a connection from 127.0.0.1 so we don't set off firewall protections. Modified: lldb/trunk/source/Host/common/Socket.cpp Modified: lldb/trunk/source/Host/common/Socket.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Socket.cpp?rev=243118&r1=243117&r2=243118&view=diff == --- lldb/trunk/source/Host/common/Socket.cpp (original) +++ lldb/trunk/source/Host/common/Socket.cpp Fri Jul 24 11:55:00 2015 @@ -201,12 +201,12 @@ Error Socket::TcpConnect(llvm::StringRef return error; } -Error Socket::TcpListen( -llvm::StringRef host_and_port, -bool child_processes_inherit, -Socket *&socket, -Predicate* predicate, -int backlog) +Error +Socket::TcpListen (llvm::StringRef host_and_port, + bool child_processes_inherit, + Socket *&socket, + Predicate* predicate, + int backlog) { std::unique_ptr listen_socket; NativeSocket listen_sock = kInvalidSocketValue; @@ -237,10 +237,19 @@ Error Socket::TcpListen( if (!DecodeHostAndPort (host_and_port, host_str, port_str, port, &error)) return error; -SocketAddress anyaddr; -if (anyaddr.SetToAnyAddress (family, port)) +SocketAddress bind_addr; +bool bind_addr_success = false; + +// Only bind to the loopback address if we are expecting a connection from +// localhost to avoid any firewall issues. +if (host_str == "127.0.0.1") +bind_addr_success = bind_addr.SetToLocalhost (family, port); +else +bind_addr_success = bind_addr.SetToAnyAddress (family, port); + +if (bind_addr_success) { -int err = ::bind (listen_sock, anyaddr, anyaddr.GetLength()); +int err = ::bind (listen_sock, bind_addr, bind_addr.GetLength()); if (err == -1) { SetLastError (error); ___ lldb-commits mailing list lldb-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D11323: Initialize variable to prevent garbage values (RenderScriptRuntime)
This revision was automatically updated to reflect the committed changes. Closed by commit rL243104: Initialize variable to prevent garbage values (RenderScriptRuntime) (authored by EwanCrawford). Changed prior to commit: http://reviews.llvm.org/D11323?vs=30064&id=30567#toc Repository: rL LLVM http://reviews.llvm.org/D11323 Files: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp Index: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp === --- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp +++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp @@ -776,7 +776,7 @@ return; } -bool kernels_found; +bool kernels_found = false; ConstString kernel_name(name); for (const auto &module : m_rsmodules) { Index: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp === --- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp +++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp @@ -776,7 +776,7 @@ return; } -bool kernels_found; +bool kernels_found = false; ConstString kernel_name(name); for (const auto &module : m_rsmodules) { ___ lldb-commits mailing list lldb-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r243104 - Initialize variable to prevent garbage values (RenderScriptRuntime)
Author: ewancrawford Date: Fri Jul 24 05:01:11 2015 New Revision: 243104 URL: http://llvm.org/viewvc/llvm-project?rev=243104&view=rev Log: Initialize variable to prevent garbage values (RenderScriptRuntime) The kernels_found variable is not initialized, so if it is not assigned true on line 823, then it will be a garbage value in the branch condition on line 828. This patch initializes the variable to false. Patch by neilparikh. Reviewers: domipheus Differential Revision: http://reviews.llvm.org/D11323 Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp?rev=243104&r1=243103&r2=243104&view=diff == --- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp Fri Jul 24 05:01:11 2015 @@ -776,7 +776,7 @@ RenderScriptRuntime::AttemptBreakpointAt return; } -bool kernels_found; +bool kernels_found = false; ConstString kernel_name(name); for (const auto &module : m_rsmodules) { ___ lldb-commits mailing list lldb-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D11323: Initialize variable to prevent garbage values (RenderScriptRuntime)
neilparikh added a comment. That site says that commit access is granted after a few patches. This is my first patch, so it seems like I need to get someone else commit it for me (based on how I interpreted that page). If that's the case, could you commit this? Repository: rL LLVM http://reviews.llvm.org/D11323 ___ lldb-commits mailing list lldb-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits