[Lldb-commits] [PATCH] D26260: Fix typo which broke debugging on older OSX systems after r285172.
dawn created this revision. dawn added a reviewer: jasonmolenda. dawn added a subscriber: lldb-commits. dawn set the repository for this revision to rL LLVM. Clearly ">=" was meant to be ">". :) Repository: rL LLVM https://reviews.llvm.org/D26260 Files: source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp Index: source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp === --- source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp +++ source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp @@ -1137,7 +1137,7 @@ // macOS 10.12 and newer if (os_type == llvm::Triple::MacOSX && -(major >= 10 || (major == 10 && minor >= 12))) { +(major > 10 || (major == 10 && minor >= 12))) { use_new_spi_interface = true; } Index: source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp === --- source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp +++ source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp @@ -1137,7 +1137,7 @@ // macOS 10.12 and newer if (os_type == llvm::Triple::MacOSX && -(major >= 10 || (major == 10 && minor >= 12))) { +(major > 10 || (major == 10 && minor >= 12))) { use_new_spi_interface = true; } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r285858 - Fix typo which broke debugging on older OSX systems after r285172.
Author: dperchik Date: Wed Nov 2 15:57:34 2016 New Revision: 285858 URL: http://llvm.org/viewvc/llvm-project?rev=285858&view=rev Log: Fix typo which broke debugging on older OSX systems after r285172. Reviewed by: jasonmolenda Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D26260 Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp?rev=285858&r1=285857&r2=285858&view=diff == --- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp (original) +++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp Wed Nov 2 15:57:34 2016 @@ -1137,7 +1137,7 @@ bool DynamicLoaderDarwin::UseDYLDSPI(Pro // macOS 10.12 and newer if (os_type == llvm::Triple::MacOSX && -(major >= 10 || (major == 10 && minor >= 12))) { +(major > 10 || (major == 10 && minor >= 12))) { use_new_spi_interface = true; } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [Diffusion] rL247836: Add using directives to the clang::DeclContext and fix decls for variables…
dawn added a subscriber: lldb-commits. Users: paulherman (Author) http://reviews.llvm.org/rL247836 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [Diffusion] rL247746: Search variables based on clang::DeclContext and clang::Decl tree
dawn accepted this commit. dawn added a comment. > Clang (the LLDB compiler) does not ask for the value ScNSpacGl in the global > namespace, but just for a value named ScNSpacGl. Ok, I've opened a separate bug for this then, https://llvm.org/bugs/show_bug.cgi?id=24994. Users: paulherman (Author) dawn (Auditor) http://reviews.llvm.org/rL247746 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [Diffusion] rL247836: Add using directives to the clang::DeclContext and fix decls for variables…
dawn added a subscriber: dawn. dawn added a comment. Bug https://llvm.org/bugs/show_bug.cgi?id=24995 opened for "regressions" after this commit. Users: paulherman (Author) http://reviews.llvm.org/rL247836 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13267: Decide on the expression language inside UserExpression
dawn accepted this revision. dawn added a comment. This revision is now accepted and ready to land. Please apply requested changes, then it's good to commit. Thanks for fixing this! Comment at: source/Commands/CommandObjectExpression.cpp:306 @@ -306,7 +305,3 @@ if (m_command_options.language != eLanguageTypeUnknown) options.SetLanguage(m_command_options.language); These lsat 6 lines can be just: options.SetLanguage(m_command_options.language); Comment at: source/Expression/UserExpression.cpp:526 @@ -514,2 +525,3 @@ + lldb::UserExpressionSP user_expression_sp(target->GetUserExpressionForLanguage (expr_cstr, nit pick: remove extra line :) http://reviews.llvm.org/D13267 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r249072 - [lldb-mi] Add support for StopAtEntry in MI via "-exec-run --start".
Author: dperchik Date: Thu Oct 1 16:15:43 2015 New Revision: 249072 URL: http://llvm.org/viewvc/llvm-project?rev=249072&view=rev Log: [lldb-mi] Add support for StopAtEntry in MI via "-exec-run --start". This patch adds a --start option to the lldb-mi -exec-run command for getting process stopped at entry point after launch. It is equivelent to the -s option in the lldb command line interpreter: process launch -s and is therefore not supported on all hosts and/or targets. To check if the --start option is supported, see if the corresponding feature "exec-run-start-option" is in the list of options reported by the lldb-mi "-list-features" command. Patch from engineer.develo...@gmail.com (Kirill Lapshin) Reviewed by: ki.stfu Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D12977 Modified: lldb/trunk/test/tools/lldb-mi/control/TestMiExec.py lldb/trunk/tools/lldb-mi/MICmdCmdExec.cpp lldb/trunk/tools/lldb-mi/MICmdCmdExec.h lldb/trunk/tools/lldb-mi/MICmdCmdSupportList.cpp Modified: lldb/trunk/test/tools/lldb-mi/control/TestMiExec.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/control/TestMiExec.py?rev=249072&r1=249071&r2=249072&view=diff == --- lldb/trunk/test/tools/lldb-mi/control/TestMiExec.py (original) +++ lldb/trunk/test/tools/lldb-mi/control/TestMiExec.py Thu Oct 1 16:15:43 2015 @@ -13,6 +13,26 @@ class MiExecTestCase(lldbmi_testcase.MiT @lldbmi_test @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races +@expectedFailureLinux # llvm.org/pr25000: lldb-mi does not receive broadcasted notification from Core/Process about process stopped +def test_lldbmi_exec_run(self): +"""Test that 'lldb-mi --interpreter' can stop at entry.""" + +self.spawnLldbMi(args = None) + +# Load executable +self.runCmd("-file-exec-and-symbols %s" % self.myexe) +self.expect("\^done") + +# Test that program is stopped at entry +self.runCmd("-exec-run --start") +self.expect("\^running") + self.expect("\*stopped,reason=\"signal-received\",signal-name=\"SIGSTOP\",signal-meaning=\"Stop\",.*?thread-id=\"1\",stopped-threads=\"all\"") +# Test that lldb-mi is ready to execute next commands +self.expect(self.child_prompt, exactly = True) + +@lldbmi_test +@skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows +@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races @expectedFailureAll("llvm.org/pr23139", oslist=["linux"], compiler="gcc", compiler_version=[">=","4.9"], archs=["i386"]) def test_lldbmi_exec_abort(self): """Test that 'lldb-mi --interpreter' works for -exec-abort.""" Modified: lldb/trunk/tools/lldb-mi/MICmdCmdExec.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdExec.cpp?rev=249072&r1=249071&r2=249072&view=diff == --- lldb/trunk/tools/lldb-mi/MICmdCmdExec.cpp (original) +++ lldb/trunk/tools/lldb-mi/MICmdCmdExec.cpp Thu Oct 1 16:15:43 2015 @@ -48,6 +48,7 @@ // Throws: None. //-- CMICmdCmdExecRun::CMICmdCmdExecRun() +: m_constStrArgStart("start") { // Command factory matches this name with that received from the stdin stream m_strMiCmd = "exec-run"; @@ -68,6 +69,23 @@ CMICmdCmdExecRun::~CMICmdCmdExecRun() } //++ +// Details: The invoker requires this function. It parses the command line options' +// arguments to extract values for each of those arguments. +// Type:Overridden. +// Args:None. +// Return: MIstatus::success - Functional succeeded. +// MIstatus::failure - Functional failed. +// Throws: None. +//-- +bool +CMICmdCmdExecRun::ParseArgs() +{ +m_setCmdArgs.Add( +new CMICmdArgValOptionLong(m_constStrArgStart, false, true, CMICmdArgValListBase::eArgValType_OptionLong, 0)); +return ParseValidateCmdOptions(); +} + +//++ // 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. @@ -84,6 +102,14 @@ CMICmdCmdExecRun::Execute() lldb::SBStream errMsg; lldb::SBLaunchInfo launchInfo = rSessionInfo.GetTarget().GetLaunchInfo(); launchInfo.SetListener(rSessionInfo.GetListener()); + +// Run to first instruction or main() requested? +CMICMDBASE_GETOPTION(pArgStart, OptionLong, m_constStrArgStart); +if (pArgStart->GetFound()) +{ +launchInfo.SetLaunchFlags(launchInfo.GetLaunchFlags() | lldb::eLa
Re: [Lldb-commits] [PATCH] D13350: [lldb] Fix evaluation of qualified global variables
dawn added a subscriber: dawn. dawn added a comment. This patch fixes bugs: - https://llvm.org/bugs/show_bug.cgi?id=24994 (::val gets NS::val inside NS since r247746) - https://llvm.org/bugs/show_bug.cgi?id=24995 (shadowed var gets ambiguity since r247836) See inline comments. Mostly had concerns about indentation - please always run patches through clang-format (both clang and lldb have their own config file in the root dir). Comment at: clang/include/clang/AST/DeclBase.h:1769 @@ +1768,3 @@ + return old_value; + } + Indenting in clang is 2 spaces. Comment at: lldb/include/lldb/Symbol/CompilerDeclContext.h:17 @@ -16,2 +16,3 @@ #include "lldb/Core/ConstString.h" +#include "clang/AST/DeclBase.h" clang includes should precede lldb ones. Comment at: lldb/include/lldb/Symbol/TypeSystem.h:121 @@ -120,1 +120,3 @@ +// extra is language dependant +virtual std::vector I don't understand this comment - please clarify? Also, please start comments with capital letters. Comment at: lldb/include/lldb/Symbol/TypeSystem.h:123 @@ +122,3 @@ +virtual std::vector +DeclContextFindDeclByNameEx (void *opaque_decl_ctx, ConstString name, void* extra) +{ It would be cleaner to have a default argument instead of this second overload. What are the guidelines on using default arguments in lldb? I've seen them both used and not used. Comment at: lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp:1370 @@ -1370,1 +1369,3 @@ +std::vector found_decls = +compiler_decl_context.FindDeclByName(name, context.m_decl_context); Looks like indentation was accidentally changed here? Comment at: lldb/source/Symbol/ClangASTContext.cpp:8984 @@ +8983,3 @@ +return nd->getLexicalDeclContext()->getDeclKind() == lookupCtx->getDeclKind(); +} + Please run patch through clang-format to fix indentation issues. http://reviews.llvm.org/D13350 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13350: [lldb] Fix evaluation of qualified global variables
dawn added a comment. Was this patch run on the entire set of lldb tests? Were there any regressions? http://reviews.llvm.org/D13350 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13058: LLDB-MI: Bug when evaluating strings containing characters from non-ascii range
dawn added a comment. > You can use clang-format to follow the LLDB coding style, or just do the > following: So we've been telling folks to use clang-format, but it's not working correctly (my version is clang-format version 3.6.0 (217927)). It's turns: bool DoesPrintValue (lldb::SBValue value); into: bool DoesPrintValue (lldb::SBValue value); We have AlwaysBreakAfterDefinitionReturnType set to true, but that only works on function definitions. I see there is a patch for AlwaysBreakAfterDeclarationReturnType at http://reviews.llvm.org/D10370?id=27471, but it's not been accepted yet. So for now, we can't rely on clang-format for function declarations :( http://reviews.llvm.org/D13058 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13058: LLDB-MI: Bug when evaluating strings containing characters from non-ascii range
dawn added a comment. This patch is good to commit now right? It's not marked "accepted" for some reason. http://reviews.llvm.org/D13058 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [Diffusion] rL247773: [LLDB][MIPS] Debug bare-iron targets lacking support for qC /qfThreadInfo
dawn added a comment. This test is still failing. Can you please have a look? Thanks. Users: jaydeep (Author) dawn (Auditor) http://reviews.llvm.org/rL247773 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [Diffusion] rL247968: [LLDB][MIPS] Debug bare-iron targets lacking support for qC /qfThreadInfo
dawn added a comment. This test is still failing. Can you please have a look? Thanks. Users: jaydeep (Author) dawn (Auditor) http://reviews.llvm.org/rL247968 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [Diffusion] rL247709: Make the source-map help grammatical.
dawn added a comment. This test is still failing. Can you please have a look? Thanks. Users: jingham (Author) dawn (Auditor) http://reviews.llvm.org/rL247709 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [Diffusion] rL248048: Added support for resolving symbolic links to FileSpec.
dawn added a comment. Test TestTerminal.LaunchInTerminalTestCase.test_launch_in_terminal is still failing. Can you please have a look? Thanks. Users: spyffe (Author) dawn (Auditor) http://reviews.llvm.org/rL248048 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r249597 - [lldb-mi] Fix evaluation of strings containing characters from non-ascii range
Author: dperchik Date: Wed Oct 7 14:55:33 2015 New Revision: 249597 URL: http://llvm.org/viewvc/llvm-project?rev=249597&view=rev Log: [lldb-mi] Fix evaluation of strings containing characters from non-ascii range If a string contained characters outside the ASCII range, lldb-mi would print them as hexadecimal codes. This patch fixes this behaviour by converting to UTF-8 instead, by having lldb-mi use registered type summary providers, when they are available. This patch also fixes incorrect evaluation of some composite types, like std::string, by having them use a type registered type summary provider. Based on patch from evgeny.levi...@gmail.com Reviewed by: ki.stfu, granata.enrico, clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D13058 Modified: lldb/trunk/include/lldb/API/SBTypeSummary.h lldb/trunk/source/API/SBTypeSummary.cpp lldb/trunk/test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py lldb/trunk/test/tools/lldb-mi/variable/main.cpp lldb/trunk/tools/lldb-mi/MICmnLLDBUtilSBValue.cpp lldb/trunk/tools/lldb-mi/MICmnLLDBUtilSBValue.h Modified: lldb/trunk/include/lldb/API/SBTypeSummary.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTypeSummary.h?rev=249597&r1=249596&r2=249597&view=diff == --- lldb/trunk/include/lldb/API/SBTypeSummary.h (original) +++ lldb/trunk/include/lldb/API/SBTypeSummary.h Wed Oct 7 14:55:33 2015 @@ -126,6 +126,9 @@ namespace lldb { operator = (const lldb::SBTypeSummary &rhs); bool +DoesPrintValue (lldb::SBValue value); + +bool IsEqualTo (lldb::SBTypeSummary &rhs); bool Modified: lldb/trunk/source/API/SBTypeSummary.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTypeSummary.cpp?rev=249597&r1=249596&r2=249597&view=diff == --- lldb/trunk/source/API/SBTypeSummary.cpp (original) +++ lldb/trunk/source/API/SBTypeSummary.cpp Wed Oct 7 14:55:33 2015 @@ -8,9 +8,8 @@ //===--===// #include "lldb/API/SBTypeSummary.h" - #include "lldb/API/SBStream.h" - +#include "lldb/API/SBValue.h" #include "lldb/DataFormatters/DataVisualization.h" using namespace lldb; @@ -284,6 +283,15 @@ SBTypeSummary::GetDescription (lldb::SBS } } +bool +SBTypeSummary::DoesPrintValue (lldb::SBValue value) +{ +if (!IsValid()) +return false; +lldb::ValueObjectSP value_sp = value.GetSP(); +return m_opaque_sp->DoesPrintValue(value_sp.get()); +} + lldb::SBTypeSummary & SBTypeSummary::operator = (const lldb::SBTypeSummary &rhs) { Modified: lldb/trunk/test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py?rev=249597&r1=249596&r2=249597&view=diff == --- lldb/trunk/test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py (original) +++ lldb/trunk/test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py Wed Oct 7 14:55:33 2015 @@ -1,3 +1,4 @@ +#coding=utf8 """ Test lldb-mi -gdb-set and -gdb-show commands for 'print option-name'. """ @@ -10,6 +11,17 @@ class MiGdbSetShowTestCase(lldbmi_testca mydir = TestBase.compute_mydir(__file__) +# evaluates array when char-array-as-string is off +def eval_and_check_array(self, var, typ, length): +self.runCmd("-var-create - * %s" % var) + self.expect('\^done,name="var\d+",numchild="%d",value="\[%d\]",type="%s \[%d\]",thread-id="1",has_more="0"' % (length, length, typ, length)) + +# evaluates any type which can be represented as string of characters +def eval_and_match_string(self, var, value, typ): +value=value.replace("\\", "").replace("\"", "\\\"") +self.runCmd("-var-create - * " + var) + self.expect('\^done,name="var\d+",numchild="[0-9]+",value="%s",type="%s",thread-id="1",has_more="0"' % (value, typ)) + @lldbmi_test @skipIfWindows #llvm.org/pr24452: Get lldb-mi working on Windows @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races @@ -35,29 +47,23 @@ class MiGdbSetShowTestCase(lldbmi_testca self.runCmd("-gdb-show print char-array-as-string") self.expect("\^done,value=\"off\"") -# Test that an char* is expanded to string when print char-array-as-string is "off" -self.runCmd("-var-create - * cp") -self.expect("\^done,name=\"var\d+\",numchild=\"1\",value=\"0x[0-9a-f]+ \\\"t\"hello\"n\\\"\",type=\"const char \*\",thread-id=\"1\",has_more=\"0\"") - -# Test that an char[] isn't expanded to string when print char-ar
Re: [Lldb-commits] [Diffusion] rL249434: Fix Darwin build of lldb-server.
dawn added a subscriber: lldb-commits. Users: sas (Author) http://reviews.llvm.org/rL249434 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [Diffusion] rL249434: Fix Darwin build of lldb-server.
dawn added a subscriber: dawn. dawn raised a concern with this commit. dawn added a comment. This broke the lldb build on OSX using cmake. After this commit, we get: CMake Error at cmake/modules/AddLLVM.cmake:401 (add_library): Cannot find source file: /Users/testuser/build/workspace/LLDB_master_release_OSX_git-hash/llvm/build_ninja/tools/lldb/source/LLDB_vers.c Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx Call Stack (most recent call first): tools/lldb/cmake/modules/AddLLDB.cmake:59 (llvm_add_library) tools/lldb/source/API/CMakeLists.txt:9 (add_lldb_library) Users: sas (Author) dawn (Auditor) http://reviews.llvm.org/rL249434 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D13535: Fix cmake build on OSX after r249434.
dawn created this revision. dawn added reviewers: sas, clayborg, zturner. dawn added a subscriber: lldb-commits. dawn set the repository for this revision to rL LLVM. This fixes the cmake build on OSX when building in a new workspace. It reverts r249434 and instead fixes the issue as proposed in lldb-dev in message 'cmake question and [PATCH] for Undefined symbol "_liblldb_coreVersionString"'. It gets the warning: ninja: warning: multiple rules generate tools/lldb/source/LLDB_vers.c. builds involving this target will not be correct; continuing anyway (which no one was able to suggest a fix for in lldb-dev), but at least it fixes the problem without breaking the entire build :) Repository: rL LLVM http://reviews.llvm.org/D13535 Files: cmake/LLDBDependencies.cmake source/CMakeLists.txt tools/lldb-server/CMakeLists.txt Index: tools/lldb-server/CMakeLists.txt === --- tools/lldb-server/CMakeLists.txt +++ tools/lldb-server/CMakeLists.txt @@ -35,9 +35,14 @@ lldb-server.cpp LLDBServerUtilities.cpp ../../source/lldb.cpp +${LLDB_VERS_GENERATED_FILE} ) - # The Darwin linker doesn't understand --start-group/--end-group. + if (LLDB_VERS_GENERATED_FILE) +add_dependencies(lldb-server swig_wrapper) + endif() + +# The Darwin linker doesn't understand --start-group/--end-group. if (LLDB_LINKER_SUPPORTS_GROUPS) target_link_libraries(lldb-server -Wl,--start-group ${LLDB_USED_LIBS} -Wl,--end-group) Index: source/CMakeLists.txt === --- source/CMakeLists.txt +++ source/CMakeLists.txt @@ -14,19 +14,8 @@ ) endif () -if ( CMAKE_SYSTEM_NAME MATCHES "Darwin" ) - set(LLDB_VERS_GENERATED_FILE ${LLDB_BINARY_DIR}/source/LLDB_vers.c) - add_custom_command(OUTPUT ${LLDB_VERS_GENERATED_FILE} -COMMAND ${LLDB_SOURCE_DIR}/scripts/generate-vers.pl -${LLDB_SOURCE_DIR}/lldb.xcodeproj/project.pbxproj liblldb_core -> ${LLDB_VERS_GENERATED_FILE}) - - set_source_files_properties(${LLDB_VERS_GENERATED_FILE} PROPERTIES GENERATED 1) -endif () - add_lldb_library(lldbBase lldb.cpp - ${LLDB_VERS_GENERATED_FILE} ) add_subdirectory(Breakpoint) Index: cmake/LLDBDependencies.cmake === --- cmake/LLDBDependencies.cmake +++ cmake/LLDBDependencies.cmake @@ -104,6 +104,13 @@ # Darwin-only libraries if ( CMAKE_SYSTEM_NAME MATCHES "Darwin" ) + set(LLDB_VERS_GENERATED_FILE ${LLDB_BINARY_DIR}/source/LLDB_vers.c) + add_custom_command(OUTPUT ${LLDB_VERS_GENERATED_FILE} +COMMAND ${LLDB_SOURCE_DIR}/scripts/generate-vers.pl +${LLDB_SOURCE_DIR}/lldb.xcodeproj/project.pbxproj liblldb_core +> ${LLDB_VERS_GENERATED_FILE}) + + set_source_files_properties(${LLDB_VERS_GENERATED_FILE} PROPERTIES GENERATED 1) list(APPEND LLDB_USED_LIBS lldbPluginDynamicLoaderDarwinKernel lldbPluginObjectFileMachO Index: tools/lldb-server/CMakeLists.txt === --- tools/lldb-server/CMakeLists.txt +++ tools/lldb-server/CMakeLists.txt @@ -35,9 +35,14 @@ lldb-server.cpp LLDBServerUtilities.cpp ../../source/lldb.cpp +${LLDB_VERS_GENERATED_FILE} ) - # The Darwin linker doesn't understand --start-group/--end-group. + if (LLDB_VERS_GENERATED_FILE) +add_dependencies(lldb-server swig_wrapper) + endif() + +# The Darwin linker doesn't understand --start-group/--end-group. if (LLDB_LINKER_SUPPORTS_GROUPS) target_link_libraries(lldb-server -Wl,--start-group ${LLDB_USED_LIBS} -Wl,--end-group) Index: source/CMakeLists.txt === --- source/CMakeLists.txt +++ source/CMakeLists.txt @@ -14,19 +14,8 @@ ) endif () -if ( CMAKE_SYSTEM_NAME MATCHES "Darwin" ) - set(LLDB_VERS_GENERATED_FILE ${LLDB_BINARY_DIR}/source/LLDB_vers.c) - add_custom_command(OUTPUT ${LLDB_VERS_GENERATED_FILE} -COMMAND ${LLDB_SOURCE_DIR}/scripts/generate-vers.pl -${LLDB_SOURCE_DIR}/lldb.xcodeproj/project.pbxproj liblldb_core -> ${LLDB_VERS_GENERATED_FILE}) - - set_source_files_properties(${LLDB_VERS_GENERATED_FILE} PROPERTIES GENERATED 1) -endif () - add_lldb_library(lldbBase lldb.cpp - ${LLDB_VERS_GENERATED_FILE} ) add_subdirectory(Breakpoint) Index: cmake/LLDBDependencies.cmake === --- cmake/LLDBDependencies.cmake +++ cmake/LLDBDependencies.cmake @@ -104,6 +104,13 @@ # Darwin-only libraries if ( CMAKE_SYSTEM_NAME MATCHES "Darwin" ) + set(LLDB_VERS_GENERATED_FILE ${LLDB_BINARY_DIR}/source/LLDB_vers.c) + add_custom_command(OUTPUT ${LLDB_VERS_GENERATED_FILE} +COMMAND ${LLDB_SOURCE_DIR}/scripts/generate-vers.pl +${LLDB_SOURCE_DIR}/lldb.xcodeproj/project.pb
Re: [Lldb-commits] [Diffusion] rL249434: Fix Darwin build of lldb-server.
dawn added a comment. See http://reviews.llvm.org/D13535 for a workaround. Users: sas (Author) dawn (Auditor) http://reviews.llvm.org/rL249434 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r249624 - Decide on the expression language inside UserExpression
Author: dperchik Date: Wed Oct 7 17:01:12 2015 New Revision: 249624 URL: http://llvm.org/viewvc/llvm-project?rev=249624&view=rev Log: Decide on the expression language inside UserExpression When the target settings are consulted to decide the expression language is decided in CommandObjectExpression, this doesn't help if you're running SBFrame::EvaluateExpression(). Moving the logic into UserExpression fixes this. Based on patch from scalla...@apple.com Reviewed by: dawn Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D13267 Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp lldb/trunk/source/Expression/UserExpression.cpp Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.cpp?rev=249624&r1=249623&r2=249624&view=diff == --- lldb/trunk/source/Commands/CommandObjectExpression.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectExpression.cpp Wed Oct 7 17:01:12 2015 @@ -299,16 +299,7 @@ CommandObjectExpression::EvaluateExpress options.SetUseDynamic(m_varobj_options.use_dynamic); options.SetTryAllThreads(m_command_options.try_all_threads); options.SetDebug(m_command_options.debug); - -// If the language was not specified in the expression command, -// set it to the language in the target's properties if -// specified, else default to the language for the frame. -if (m_command_options.language != eLanguageTypeUnknown) -options.SetLanguage(m_command_options.language); -else if (target->GetLanguage() != eLanguageTypeUnknown) -options.SetLanguage(target->GetLanguage()); -else if (frame) -options.SetLanguage(frame->GetLanguage()); +options.SetLanguage(m_command_options.language); // 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 Modified: lldb/trunk/source/Expression/UserExpression.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/UserExpression.cpp?rev=249624&r1=249623&r2=249624&view=diff == --- lldb/trunk/source/Expression/UserExpression.cpp (original) +++ lldb/trunk/source/Expression/UserExpression.cpp Wed Oct 7 17:01:12 2015 @@ -470,7 +470,7 @@ UserExpression::Evaluate (ExecutionConte Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_EXPRESSIONS | LIBLLDB_LOG_STEP)); lldb_private::ExecutionPolicy execution_policy = options.GetExecutionPolicy(); -const lldb::LanguageType language = options.GetLanguage(); +lldb::LanguageType language = options.GetLanguage(); const ResultType desired_type = options.DoesCoerceToId() ? UserExpression::eResultTypeId : UserExpression::eResultTypeAny; lldb::ExpressionResults execution_results = lldb::eExpressionSetupError; @@ -515,6 +515,17 @@ UserExpression::Evaluate (ExecutionConte else full_prefix = option_prefix; +// If the language was not specified in the expression command, +// set it to the language in the target's properties if +// specified, else default to the langage for the frame. +if (language == lldb::eLanguageTypeUnknown) +{ +if (target->GetLanguage() != lldb::eLanguageTypeUnknown) +language = target->GetLanguage(); +else if (StackFrame *frame = exe_ctx.GetFramePtr()) +language = frame->GetLanguage(); +} + lldb::UserExpressionSP user_expression_sp(target->GetUserExpressionForLanguage (expr_cstr, full_prefix, language, ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13535: Fix cmake build on OSX after r249434.
dawn added a comment. In http://reviews.llvm.org/D13535#262225, @zturner wrote: > I can't verify that this works on MacOSX at the moment. Did you verify that > this works on other platforms as well? I've confirmed it works on MacOSX - I'll try to test Linux later today if no one beats me to it. Repository: rL LLVM http://reviews.llvm.org/D13535 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13535: Fix cmake build on OSX after r249434.
dawn added a comment. Works fine on Linux too. Repository: rL LLVM http://reviews.llvm.org/D13535 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13535: Fix cmake build on OSX after r249434.
dawn added a comment. Can someone accept this patch so I can commit please? Repository: rL LLVM http://reviews.llvm.org/D13535 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [Diffusion] rL247773: [LLDB][MIPS] Debug bare-iron targets lacking support for qC /qfThreadInfo
dawn added a comment. What other details are you looking for? Users: jaydeep (Author) dawn (Auditor) http://reviews.llvm.org/rL247773 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13535: Fix cmake build on OSX after r249434.
dawn added inline comments. Comment at: tools/lldb-server/CMakeLists.txt:42 @@ +41,3 @@ + if (LLDB_VERS_GENERATED_FILE) +add_dependencies(lldb-server swig_wrapper) + endif() brucem wrote: > Why is this needed? You get undefined symbol otherwise (if you build from scratch). Repository: rL LLVM http://reviews.llvm.org/D13535 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13535: Fix cmake build on OSX after r249434.
dawn added inline comments. Comment at: tools/lldb-server/CMakeLists.txt:42 @@ +41,3 @@ + if (LLDB_VERS_GENERATED_FILE) +add_dependencies(lldb-server swig_wrapper) + endif() dawn wrote: > brucem wrote: > > Why is this needed? > You get undefined symbol otherwise (if you build from scratch). I should clarify - lldb-server needs to link with LLDB_vers.c or you get unresolved symbol (that's the fix at line 38). This sets up the dependency - see example in source/API/CMakeLists.txt. Repository: rL LLVM http://reviews.llvm.org/D13535 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r249684 - [cmake] Fix cmake build on OSX after r249434.
Author: dperchik Date: Thu Oct 8 07:35:21 2015 New Revision: 249684 URL: http://llvm.org/viewvc/llvm-project?rev=249684&view=rev Log: [cmake] Fix cmake build on OSX after r249434. Reviewed by: zturner Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D13535 Modified: lldb/trunk/cmake/LLDBDependencies.cmake lldb/trunk/source/CMakeLists.txt lldb/trunk/tools/lldb-server/CMakeLists.txt Modified: lldb/trunk/cmake/LLDBDependencies.cmake URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/LLDBDependencies.cmake?rev=249684&r1=249683&r2=249684&view=diff == --- lldb/trunk/cmake/LLDBDependencies.cmake (original) +++ lldb/trunk/cmake/LLDBDependencies.cmake Thu Oct 8 07:35:21 2015 @@ -104,6 +104,13 @@ endif () # Darwin-only libraries if ( CMAKE_SYSTEM_NAME MATCHES "Darwin" ) + set(LLDB_VERS_GENERATED_FILE ${LLDB_BINARY_DIR}/source/LLDB_vers.c) + add_custom_command(OUTPUT ${LLDB_VERS_GENERATED_FILE} +COMMAND ${LLDB_SOURCE_DIR}/scripts/generate-vers.pl +${LLDB_SOURCE_DIR}/lldb.xcodeproj/project.pbxproj liblldb_core +> ${LLDB_VERS_GENERATED_FILE}) + + set_source_files_properties(${LLDB_VERS_GENERATED_FILE} PROPERTIES GENERATED 1) list(APPEND LLDB_USED_LIBS lldbPluginDynamicLoaderDarwinKernel lldbPluginObjectFileMachO Modified: lldb/trunk/source/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/CMakeLists.txt?rev=249684&r1=249683&r2=249684&view=diff == --- lldb/trunk/source/CMakeLists.txt (original) +++ lldb/trunk/source/CMakeLists.txt Thu Oct 8 07:35:21 2015 @@ -14,19 +14,8 @@ include_directories( ) endif () -if ( CMAKE_SYSTEM_NAME MATCHES "Darwin" ) - set(LLDB_VERS_GENERATED_FILE ${LLDB_BINARY_DIR}/source/LLDB_vers.c) - add_custom_command(OUTPUT ${LLDB_VERS_GENERATED_FILE} -COMMAND ${LLDB_SOURCE_DIR}/scripts/generate-vers.pl -${LLDB_SOURCE_DIR}/lldb.xcodeproj/project.pbxproj liblldb_core -> ${LLDB_VERS_GENERATED_FILE}) - - set_source_files_properties(${LLDB_VERS_GENERATED_FILE} PROPERTIES GENERATED 1) -endif () - add_lldb_library(lldbBase lldb.cpp - ${LLDB_VERS_GENERATED_FILE} ) add_subdirectory(Breakpoint) Modified: lldb/trunk/tools/lldb-server/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-server/CMakeLists.txt?rev=249684&r1=249683&r2=249684&view=diff == --- lldb/trunk/tools/lldb-server/CMakeLists.txt (original) +++ lldb/trunk/tools/lldb-server/CMakeLists.txt Thu Oct 8 07:35:21 2015 @@ -35,8 +35,13 @@ else() lldb-server.cpp LLDBServerUtilities.cpp ../../source/lldb.cpp +${LLDB_VERS_GENERATED_FILE} ) + if (LLDB_VERS_GENERATED_FILE) +add_dependencies(lldb-server swig_wrapper) + endif() + # The Darwin linker doesn't understand --start-group/--end-group. if (LLDB_LINKER_SUPPORTS_GROUPS) target_link_libraries(lldb-server ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13535: Fix cmake build on OSX after r249434.
dawn added a comment. I went ahead and committed this since the build was completely broken - I'd be happy to apply any suggestions folks make here in subsequent commits. Repository: rL LLVM http://reviews.llvm.org/D13535 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13535: Fix cmake build on OSX after r249434.
dawn added a comment. In http://reviews.llvm.org/D13535#262670, @brucem wrote: > The way to do this correctly is something like > ... Can you open a new patch which shows your suggested changes please? Or at least clarify how the add_custom_command should look in this case and where it should go? Repository: rL LLVM http://reviews.llvm.org/D13535 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13535: Fix cmake build on OSX after r249434.
dawn added a comment. In http://reviews.llvm.org/D13535#262672, @brucem wrote: > I don't know what's broken for you. My build hasn't had any issues on Mac OS > X using cmake. In a clean workspace, cmake would fail because LLDB_vers.c hadn't been created yet. You get the error: CMake Error at cmake/modules/AddLLVM.cmake:401 (add_library): Cannot find source file: /Users/testuser/build/workspace/LLVM-Clang-LLDB_master_release_OSX/llvm/build_ninja/tools/lldb/source/LLDB_vers.c Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx Call Stack (most recent call first): tools/lldb/cmake/modules/AddLLDB.cmake:59 (llvm_add_library) tools/lldb/source/API/CMakeLists.txt:9 (add_lldb_library) Repository: rL LLVM http://reviews.llvm.org/D13535 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13535: Fix cmake build on OSX after r249434.
dawn added a comment. FYI - our Jenkins master build just picked up the change and is finally building again - yay!! :) Repository: rL LLVM http://reviews.llvm.org/D13535 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [Diffusion] rL249434: Fix Darwin build of lldb-server.
dawn accepted this commit. dawn added a comment. Build fixed in svn r249684. Users: sas (Author) dawn (Auditor) http://reviews.llvm.org/rL249434 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13552: Fix handling of LLDB_VERS_GENERATED_FILE.
dawn added a comment. Hi Bruce, thanks for this patch! I'll give it a try now... http://reviews.llvm.org/D13552 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13552: Fix handling of LLDB_VERS_GENERATED_FILE.
dawn accepted this revision. dawn added a comment. This revision is now accepted and ready to land. Works great! Please commit. (Sorry for delay - I ran into problems with clang crashing on me for unknown reasons - finally got the build working again so I could test). http://reviews.llvm.org/D13552 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [Diffusion] rL247968: [LLDB][MIPS] Debug bare-iron targets lacking support for qC /qfThreadInfo
dawn accepted this commit. dawn added a comment. The filing test was removed by Greg in r249613. Users: jaydeep (Author) dawn (Auditor) http://reviews.llvm.org/rL247968 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [Diffusion] rL247773: [LLDB][MIPS] Debug bare-iron targets lacking support for qC /qfThreadInfo
dawn accepted this commit. dawn added a comment. This test is no longer failing. Users: jaydeep (Author) dawn (Auditor) http://reviews.llvm.org/rL247773 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [Diffusion] rL250335: Fix codesign command with cmake.
dawn added a subscriber: lldb-commits. Users: sas (Author) http://reviews.llvm.org/rL250335 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [Diffusion] rL250335: Fix codesign command with cmake.
dawn added a subscriber: dawn. dawn raised a concern with this commit. dawn added a comment. First, sorry for my delay in reviewing your patch, but I've been on vacation and now am at the C++ ANSI meeting in Kona for this week. But... This broke the build of cmake on OSX. We get: [...] [2632/2743] Linking CXX executable bin/debugserver FAILED: : && /usr/bin/c++ -std=c++11 -stdlib=libc++ [...] -o bin/debugserver lib/liblldbDebugserverCommon.a lib/liblldbUtility.a lib/liblldbDebugserverMacOSX_I386.a lib/liblldbDebugserverMacOSX_X86_64.a -framework Cocoa -Wl,-rpath,@executable_path/../lib && cd /Users/testuser/build/workspace/LLVM-Clang-LLDB_master_release_OSX/llvm/build_ninja/bin && /usr/local/Cellar/cmake/3.0.2/bin/cmake -E env CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate codesign --force --sign lldb_codesign debugserver CMake Error: cmake version 3.0.2 Usage: /usr/local/Cellar/cmake/3.0.2/bin/cmake -E [command] [arguments ...] Available commands: chdir dir cmd [args]... - run command in a given directory [...] lldb is built on OSX as: mkdir "$BUILDDIR" && cd "$BUILDDIR" cmake -G Ninja .. "-DLLVM_TARGETS_TO_BUILD=ARM;X86;AArch64" -DCMAKE_CXX_FLAGS="-std=c++11 -stdlib=libc++" -DCMAKE_BUILD_TYPE=Release security unlock-keychain -p testuser /Users/testuser/Library/Keychains/login.keychain ninja Does the new "-E env" option require a new version of cmake? Is there a way to change the patch to only add the -E option if cmake supports it? Thanks in advance, -Dawn Users: sas (Author) dawn (Auditor) http://reviews.llvm.org/rL250335 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [Diffusion] rL250335: Fix codesign command with cmake.
dawn added a comment. One resolution would be to check for the cmake version and conditionally enable the new code, but that's beyond my capabilities - anyone know how? If not, can we please revert this commit? Users: sas (Author) dawn (Auditor) http://reviews.llvm.org/rL250335 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [Diffusion] rL250335: Fix codesign command with cmake.
dawn added a comment. Please review http://reviews.llvm.org/D13995 for a proposed fix. Users: sas (Author) dawn (Auditor) http://reviews.llvm.org/rL250335 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D13995: [cmake] Fix cmake build on OSX after r250335 for older versions of cmake
dawn created this revision. dawn added reviewers: brucem, sas, krytarowski, enlight, labath. dawn added a subscriber: lldb-commits. dawn set the repository for this revision to rL LLVM. Older versions of cmake don't support the -E env option which was added in r250335, causing the build to fail with: [...] [2632/2743] Linking CXX executable bin/debugserver FAILED: : && /usr/bin/c++ -std=c++11 -stdlib=libc++ [...] -o bin/debugserver lib/liblldbDebugserverCommon.a lib/liblldbUtility.a lib/liblldbDebugserverMacOSX_I386.a lib/liblldbDebugserverMacOSX_X86_64.a -framework Cocoa -Wl,-rpath,@executable_path/../lib && cd /Users/testuser/build/workspace/LLVM-Clang-LLDB_master_release_OSX/llvm/build_ninja/bin && /usr/local/Cellar/cmake/3.0.2/bin/cmake -E env CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate codesign --force --sign lldb_codesign debugserver CMake Error: cmake version 3.0.2 Usage: /usr/local/Cellar/cmake/3.0.2/bin/cmake -E [command] [arguments ...] Available commands: chdir dir cmd [args]... - run command in a given directory [...] This patch fixes this by invoking codesigning as it was before the commit if the cmake version is less than than 3.2. Repository: rL LLVM http://reviews.llvm.org/D13995 Files: tools/debugserver/source/MacOSX/CMakeLists.txt Index: tools/debugserver/source/MacOSX/CMakeLists.txt === --- tools/debugserver/source/MacOSX/CMakeLists.txt +++ tools/debugserver/source/MacOSX/CMakeLists.txt @@ -66,13 +66,23 @@ OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE CODESIGN_ALLOCATE ) -add_custom_command(TARGET debugserver - POST_BUILD - # --entitlements option removed, as it causes errors when debugging. - #was: COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --entitlements ${CMAKE_CURRENT_SOURCE_DIR}/../debugserver-entitlements.plist --force --sign ${CODESIGN_IDENTITY} debugserver - COMMAND ${CMAKE_COMMAND} -E env CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --force --sign ${CODESIGN_IDENTITY} debugserver - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin +# Older cmake versions don't support "-E env". +if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 3.2) + add_custom_command(TARGET debugserver +POST_BUILD +# Note: --entitlements option removed, as it causes errors when debugging. +# was: COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --entitlements ${CMAKE_CURRENT_SOURCE_DIR}/../debugserver-entitlements.plist --force --sign ${CODESIGN_IDENTITY} debugserver +COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --force --sign ${CODESIGN_IDENTITY} debugserver +WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin ) +else() + add_custom_command(TARGET debugserver +POST_BUILD +# Note: --entitlements option removed (see comment above). +COMMAND ${CMAKE_COMMAND} -E env CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --force --sign ${CODESIGN_IDENTITY} debugserver +WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin + ) +endif() install(TARGETS debugserver RUNTIME DESTINATION bin Index: tools/debugserver/source/MacOSX/CMakeLists.txt === --- tools/debugserver/source/MacOSX/CMakeLists.txt +++ tools/debugserver/source/MacOSX/CMakeLists.txt @@ -66,13 +66,23 @@ OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE CODESIGN_ALLOCATE ) -add_custom_command(TARGET debugserver - POST_BUILD - # --entitlements option removed, as it causes errors when debugging. - #was: COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --entitlements ${CMAKE_CURRENT_SOURCE_DIR}/../debugserver-entitlements.plist --force --sign ${CODESIGN_IDENTITY} debugserver - COMMAND ${CMAKE_COMMAND} -E env CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --force --sign ${CODESIGN_IDENTITY} debugserver - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin +# Older cmake versions don't support "-E env". +if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 3.2) + add_custom_command(TARGET debugserver +POST_BUILD +# Note: --entitlements option removed, as it causes errors when debugging. +# was: COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --entitlements ${CMAKE_CURRENT_SOURCE_DIR}/../debugserver-entitlements.plist --force --sign ${CODESIGN_IDENTITY} debugserver +COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --force --sign ${CODESIGN_IDENTITY} debugserver +WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin ) +else() + add_custom_command(TARGET debugserver +POST_BUILD +# Note: --entitlements option removed (see comment above). +COMMAND ${CMAKE_COMMAND} -E env CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --force --sign ${CODESIGN_IDENTITY} debugserver +WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin + ) +endif() install(TARGETS debugserver RUNTIME DESTINA
[Lldb-commits] [lldb] r251073 - [cmake] Fix cmake build on OSX after r250335 for older versions of cmake
Author: dperchik Date: Thu Oct 22 17:48:52 2015 New Revision: 251073 URL: http://llvm.org/viewvc/llvm-project?rev=251073&view=rev Log: [cmake] Fix cmake build on OSX after r250335 for older versions of cmake Reviewed by: sas Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D13995 Modified: lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt Modified: lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt?rev=251073&r1=251072&r2=251073&view=diff == --- lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt (original) +++ lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt Thu Oct 22 17:48:52 2015 @@ -66,13 +66,23 @@ execute_process( OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE CODESIGN_ALLOCATE ) -add_custom_command(TARGET debugserver - POST_BUILD - # --entitlements option removed, as it causes errors when debugging. - #was: COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --entitlements ${CMAKE_CURRENT_SOURCE_DIR}/../debugserver-entitlements.plist --force --sign ${CODESIGN_IDENTITY} debugserver - COMMAND ${CMAKE_COMMAND} -E env CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --force --sign ${CODESIGN_IDENTITY} debugserver - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin +# Older cmake versions don't support "-E env". +if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 3.2) + add_custom_command(TARGET debugserver +POST_BUILD +# Note: --entitlements option removed, as it causes errors when debugging. +# was: COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --entitlements ${CMAKE_CURRENT_SOURCE_DIR}/../debugserver-entitlements.plist --force --sign ${CODESIGN_IDENTITY} debugserver +COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --force --sign ${CODESIGN_IDENTITY} debugserver +WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin ) +else() + add_custom_command(TARGET debugserver +POST_BUILD +# Note: --entitlements option removed (see comment above). +COMMAND ${CMAKE_COMMAND} -E env CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --force --sign ${CODESIGN_IDENTITY} debugserver +WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin + ) +endif() install(TARGETS debugserver RUNTIME DESTINATION bin ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [Diffusion] rL250335: Fix codesign command with cmake.
dawn accepted this commit. dawn added a comment. Breakage with older cmake versions fixed in svn r251073. Users: sas (Author) dawn (Auditor) http://reviews.llvm.org/rL250335 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r251080 - Summary provider for char.
Author: dperchik Date: Thu Oct 22 19:02:56 2015 New Revision: 251080 URL: http://llvm.org/viewvc/llvm-project?rev=251080&view=rev Log: Summary provider for char. This patch enables type summary for 'char' type. Given: char c = 'h'; Before this patch, c evaluates as: (char) $0 = 'h' After this patch, we get: (char) $0 = 104 'h' This change allows the formatting of character types in MI to be removed and replaced with that in lldb, and can be useful when evaluating non-printable characters. Patch from evgeny.levi...@gmail.com Reviewed by: granata.enrico Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D13657 Modified: lldb/trunk/include/lldb/API/SBTypeSummary.h lldb/trunk/source/API/SBTypeSummary.cpp Modified: lldb/trunk/include/lldb/API/SBTypeSummary.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTypeSummary.h?rev=251080&r1=251079&r2=251080&view=diff == --- lldb/trunk/include/lldb/API/SBTypeSummary.h (original) +++ lldb/trunk/include/lldb/API/SBTypeSummary.h Thu Oct 22 19:02:56 2015 @@ -69,6 +69,9 @@ namespace lldb { public: SBTypeSummary(); + +// Native function summary formatter callback +typedef bool (*FormatCallback) (SBValue, SBTypeSummaryOptions, SBStream&); static SBTypeSummary CreateWithSummaryString (const char* data, @@ -81,6 +84,10 @@ namespace lldb { static SBTypeSummary CreateWithScriptCode (const char* data, uint32_t options = 0); // see lldb::eTypeOption values + +static SBTypeSummary +CreateWithCallback (FormatCallback cb, +uint32_t options = 0); SBTypeSummary (const lldb::SBTypeSummary &rhs); Modified: lldb/trunk/source/API/SBTypeSummary.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTypeSummary.cpp?rev=251080&r1=251079&r2=251080&view=diff == --- lldb/trunk/source/API/SBTypeSummary.cpp (original) +++ lldb/trunk/source/API/SBTypeSummary.cpp Thu Oct 22 19:02:56 2015 @@ -146,6 +146,25 @@ SBTypeSummary::CreateWithScriptCode (con return SBTypeSummary(TypeSummaryImplSP(new ScriptSummaryFormat(options, "", data))); } +SBTypeSummary +SBTypeSummary::CreateWithCallback (FormatCallback cb, uint32_t options) +{ +return SBTypeSummary( + TypeSummaryImplSP( + cb ? new CXXFunctionSummaryFormat(options, + [cb] (ValueObject& valobj, Stream& stm, const TypeSummaryOptions& opt) -> bool { +BStream stream; +if (!cb(SBValue(valobj.GetSP()), SBTypeSummaryOptions(&opt), stream)) +return false; +stm.Write(stream.GetData(), stream.GetSize()); +return true; + }, + "SBTypeSummary formatter callback" + ) : nullptr +) +); +} + SBTypeSummary::SBTypeSummary (const lldb::SBTypeSummary &rhs) : m_opaque_sp(rhs.m_opaque_sp) { ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r251082 - [lldb-mi] display summary for simple types + refactor (use lldb formatting for all cases)
Author: dperchik Date: Thu Oct 22 19:23:53 2015 New Revision: 251082 URL: http://llvm.org/viewvc/llvm-project?rev=251082&view=rev Log: [lldb-mi] display summary for simple types + refactor (use lldb formatting for all cases) Previously, lldb did not use type summaries for simple types with no children (like function pointers). This patch enables MI to use lldb type summaries for evaluation of all types of objects, so MI own formatters are no longer needed. Patch from evgeny.levi...@gmail.com Reviewed by: abidh Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D13799 Modified: lldb/trunk/test/tools/lldb-mi/data/TestMiData.py lldb/trunk/test/tools/lldb-mi/symbol/TestMiSymbol.py lldb/trunk/tools/lldb-mi/MICmnLLDBDebugger.cpp lldb/trunk/tools/lldb-mi/MICmnLLDBDebugger.h lldb/trunk/tools/lldb-mi/MICmnLLDBUtilSBValue.cpp lldb/trunk/tools/lldb-mi/MICmnLLDBUtilSBValue.h Modified: lldb/trunk/test/tools/lldb-mi/data/TestMiData.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/data/TestMiData.py?rev=251082&r1=251081&r2=251082&view=diff == --- lldb/trunk/test/tools/lldb-mi/data/TestMiData.py (original) +++ lldb/trunk/test/tools/lldb-mi/data/TestMiData.py Thu Oct 22 19:23:53 2015 @@ -33,8 +33,8 @@ class MiDataTestCase(lldbmi_testcase.MiT # Get an address for disassembling: use main self.runCmd("-data-evaluate-expression main") -self.expect("\^done,value=\"0x[0-9a-f]+\"") -addr = int(self.child.after.split("\"")[1], 16) +self.expect("\^done,value=\"0x[0-9a-f]+ \(a.out`main at main.cpp:[0-9]+\)\"") +addr = int(self.child.after.split("\"")[1].split(" ")[0], 16) # Test -data-disassemble: try to disassemble some address self.runCmd("-data-disassemble -s %#x -e %#x -- 0" % (addr, addr + 0x10)) @@ -49,8 +49,8 @@ class MiDataTestCase(lldbmi_testcase.MiT # Get an address for disassembling: use hello_world self.runCmd("-data-evaluate-expression hello_world") -self.expect("\^done,value=\"0x[0-9a-f]+\"") -addr = int(self.child.after.split("\"")[1], 16) +self.expect("\^done,value=\"0x[0-9a-f]+ \(a.out`hello_world\(\) at main.cpp:[0-9]+\)\"") +addr = int(self.child.after.split("\"")[1].split(" ")[0], 16) # Test -data-disassemble: try to disassemble some address self.runCmd("-data-disassemble -s %#x -e %#x -- 0" % (addr, addr + 0x10)) @@ -288,8 +288,8 @@ class MiDataTestCase(lldbmi_testcase.MiT # Get the address of main and its line self.runCmd("-data-evaluate-expression main") -self.expect("\^done,value=\"0x[0-9a-f]+\"") -addr = int(self.child.after.split("\"")[1], 16) +self.expect("\^done,value=\"0x[0-9a-f]+ \(a.out`main at main.cpp:[0-9]+\)\"") +addr = int(self.child.after.split("\"")[1].split(" ")[0], 16) line = line_number('main.cpp', '// FUNC_main') # Test that -data-info-line works for address Modified: lldb/trunk/test/tools/lldb-mi/symbol/TestMiSymbol.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/symbol/TestMiSymbol.py?rev=251082&r1=251081&r2=251082&view=diff == --- lldb/trunk/test/tools/lldb-mi/symbol/TestMiSymbol.py (original) +++ lldb/trunk/test/tools/lldb-mi/symbol/TestMiSymbol.py Thu Oct 22 19:23:53 2015 @@ -32,8 +32,8 @@ class MiSymbolTestCase(lldbmi_testcase.M # Get address of main and its line self.runCmd("-data-evaluate-expression main") -self.expect("\^done,value=\"0x[0-9a-f]+\"") -addr = int(self.child.after.split("\"")[1], 16) +self.expect("\^done,value=\"0x[0-9a-f]+ \(a.out`main at main.cpp:[0-9]+\)\"") +addr = int(self.child.after.split("\"")[1].split(" ")[0], 16) line = line_number('main.cpp', '// FUNC_main') # Test that -symbol-list-lines works on valid data Modified: lldb/trunk/tools/lldb-mi/MICmnLLDBDebugger.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmnLLDBDebugger.cpp?rev=251082&r1=251081&r2=251082&view=diff == --- lldb/trunk/tools/lldb-mi/MICmnLLDBDebugger.cpp (original) +++ lldb/trunk/tools/lldb-mi/MICmnLLDBDebugger.cpp Thu Oct 22 19:23:53 2015 @@ -12,6 +12,11 @@ #include "lldb/API/SBThread.h" #include "lldb/API/SBProcess.h" #include "lldb/API/SBCommandInterpreter.h" +#include "lldb/API/SBTypeSummary.h" +#include "lldb/API/SBTypeCategory.h" +#include "lldb/API/SBTypeNameSpecifier.h" +#include "lldb/API/SBStream.h" +#include "lldb/API/SBType.h" // In-house headers: #include "MICmnLLDBDebugger.h" @@ -24,6 +29,40 @@ #include "MIUtilSingletonHelper.h" //++ +// MI
[Lldb-commits] [PATCH] D14036: [debugserver] Fix OSX build for older XCode versions after r251091.
dawn created this revision. dawn added reviewers: jasonmolenda, clayborg. dawn added a subscriber: lldb-commits. dawn set the repository for this revision to rL LLVM. svn r251091 introduced references to LC_VERSION_MIN_TVOS and LC_VERSION_MIN_WATCHOS which aren't defined in XCode versions older than 7. This patch fixes the build by skipping the code if TARGET_OS_TV or TARGET_OS_WATCH aren't defined. Repository: rL LLVM http://reviews.llvm.org/D14036 Files: tools/debugserver/source/RNBRemote.cpp Index: tools/debugserver/source/RNBRemote.cpp === --- tools/debugserver/source/RNBRemote.cpp +++ tools/debugserver/source/RNBRemote.cpp @@ -5846,17 +5846,21 @@ DNBLogThreadedIf (LOG_RNB_PROC, "LC_VERSION_MIN_MACOSX -> 'ostype:macosx;'"); break; +#if defined (TARGET_OS_TV) && TARGET_OS_TV == 1 case LC_VERSION_MIN_TVOS: os_handled = true; rep << "ostype:tvos;"; DNBLogThreadedIf (LOG_RNB_PROC, "LC_VERSION_MIN_TVOS -> 'ostype:tvos;'"); break; +#endif +#if defined (TARGET_OS_WATCH) && TARGET_OS_WATCH == 1 case LC_VERSION_MIN_WATCHOS: os_handled = true; rep << "ostype:watchos;"; DNBLogThreadedIf (LOG_RNB_PROC, "LC_VERSION_MIN_WATCHOS -> 'ostype:watchos;'"); break; +#endif default: break; Index: tools/debugserver/source/RNBRemote.cpp === --- tools/debugserver/source/RNBRemote.cpp +++ tools/debugserver/source/RNBRemote.cpp @@ -5846,17 +5846,21 @@ DNBLogThreadedIf (LOG_RNB_PROC, "LC_VERSION_MIN_MACOSX -> 'ostype:macosx;'"); break; +#if defined (TARGET_OS_TV) && TARGET_OS_TV == 1 case LC_VERSION_MIN_TVOS: os_handled = true; rep << "ostype:tvos;"; DNBLogThreadedIf (LOG_RNB_PROC, "LC_VERSION_MIN_TVOS -> 'ostype:tvos;'"); break; +#endif +#if defined (TARGET_OS_WATCH) && TARGET_OS_WATCH == 1 case LC_VERSION_MIN_WATCHOS: os_handled = true; rep << "ostype:watchos;"; DNBLogThreadedIf (LOG_RNB_PROC, "LC_VERSION_MIN_WATCHOS -> 'ostype:watchos;'"); break; +#endif default: break; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r251169 - [debugserver] Fix indentation in RNBRemote.cpp.
Author: dperchik Date: Fri Oct 23 20:24:00 2015 New Revision: 251169 URL: http://llvm.org/viewvc/llvm-project?rev=251169&view=rev Log: [debugserver] Fix indentation in RNBRemote.cpp. Modified: lldb/trunk/tools/debugserver/source/RNBRemote.cpp Modified: lldb/trunk/tools/debugserver/source/RNBRemote.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/RNBRemote.cpp?rev=251169&r1=251168&r2=251169&view=diff == --- lldb/trunk/tools/debugserver/source/RNBRemote.cpp (original) +++ lldb/trunk/tools/debugserver/source/RNBRemote.cpp Fri Oct 23 20:24:00 2015 @@ -5871,83 +5871,83 @@ RNBRemote::HandlePacket_qProcessInfo (co // to set it correctly by using the cpu type and other tricks if (!os_handled) { -// The OS in the triple should be "ios" or "macosx" which doesn't match our -// "Darwin" which gets returned from "kern.ostype", so we need to hardcode -// this for now. -if (cputype == CPU_TYPE_ARM || cputype == CPU_TYPE_ARM64) +// The OS in the triple should be "ios" or "macosx" which doesn't match our +// "Darwin" which gets returned from "kern.ostype", so we need to hardcode +// this for now. +if (cputype == CPU_TYPE_ARM || cputype == CPU_TYPE_ARM64) { #if defined (TARGET_OS_TV) && TARGET_OS_TV == 1 rep << "ostype:tvos;"; #elif defined (TARGET_OS_WATCH) && TARGET_OS_WATCH == 1 rep << "ostype:watchos;"; #else -rep << "ostype:ios;"; +rep << "ostype:ios;"; #endif } -else -{ -bool is_ios_simulator = false; -if (cputype == CPU_TYPE_X86 || cputype == CPU_TYPE_X86_64) +else { -// Check for iOS simulator binaries by getting the process argument -// and environment and checking for SIMULATOR_UDID in the environment -int proc_args_mib[3] = { CTL_KERN, KERN_PROCARGS2, (int)pid }; - -uint8_t arg_data[8192]; -size_t arg_data_size = sizeof(arg_data); -if (::sysctl (proc_args_mib, 3, arg_data, &arg_data_size , NULL, 0) == 0) +bool is_ios_simulator = false; +if (cputype == CPU_TYPE_X86 || cputype == CPU_TYPE_X86_64) { -DNBDataRef data (arg_data, arg_data_size, false); -DNBDataRef::offset_t offset = 0; -uint32_t argc = data.Get32 (&offset); -const char *cstr; +// Check for iOS simulator binaries by getting the process argument +// and environment and checking for SIMULATOR_UDID in the environment +int proc_args_mib[3] = { CTL_KERN, KERN_PROCARGS2, (int)pid }; -cstr = data.GetCStr (&offset); -if (cstr) +uint8_t arg_data[8192]; +size_t arg_data_size = sizeof(arg_data); +if (::sysctl (proc_args_mib, 3, arg_data, &arg_data_size , NULL, 0) == 0) { -// Skip NULLs -while (1) -{ -const char *p = data.PeekCStr(offset); -if ((p == NULL) || (*p != '\0')) -break; -++offset; -} -// Now skip all arguments -for (uint32_t i = 0; i < argc; ++i) -{ -data.GetCStr(&offset); -} +DNBDataRef data (arg_data, arg_data_size, false); +DNBDataRef::offset_t offset = 0; +uint32_t argc = data.Get32 (&offset); +const char *cstr; -// Now iterate across all environment variables -while ((cstr = data.GetCStr(&offset))) +cstr = data.GetCStr (&offset); +if (cstr) { -if (strncmp(cstr, "SIMULATOR_UDID=", strlen("SIMULATOR_UDID=")) == 0) +// Skip NULLs +while (1) { -is_ios_simulator = true; -break; +const char *p = data.PeekCStr(offset); +if ((p == NULL) || (*p != '\0')) +break; +++offset; +} +// Now skip all arguments +for (uint32_t i = 0; i < argc; ++i) +{ +data.GetCStr(&offset); } -if (cstr[0] == '\0') -break; +// Now iterate across all environment vari
[Lldb-commits] [lldb] r251172 - [debugserver] Fix OSX build for older XCode versions after r251091.
Author: dperchik Date: Fri Oct 23 20:31:12 2015 New Revision: 251172 URL: http://llvm.org/viewvc/llvm-project?rev=251172&view=rev Log: [debugserver] Fix OSX build for older XCode versions after r251091. This fixes the OSX build for XCode versions older than 7 by skipping references to LC_VERSION_MIN_TVOS and LC_VERSION_MIN_WATCHOS if TARGET_OS_TV or TARGET_OS_WATCH aren't defined. Reviewed by: jasonmolenda Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D14036 Modified: lldb/trunk/tools/debugserver/source/RNBRemote.cpp Modified: lldb/trunk/tools/debugserver/source/RNBRemote.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/RNBRemote.cpp?rev=251172&r1=251171&r2=251172&view=diff == --- lldb/trunk/tools/debugserver/source/RNBRemote.cpp (original) +++ lldb/trunk/tools/debugserver/source/RNBRemote.cpp Fri Oct 23 20:31:12 2015 @@ -5846,17 +5846,21 @@ RNBRemote::HandlePacket_qProcessInfo (co DNBLogThreadedIf (LOG_RNB_PROC, "LC_VERSION_MIN_MACOSX -> 'ostype:macosx;'"); break; +#if defined (TARGET_OS_TV) && TARGET_OS_TV == 1 case LC_VERSION_MIN_TVOS: os_handled = true; rep << "ostype:tvos;"; DNBLogThreadedIf (LOG_RNB_PROC, "LC_VERSION_MIN_TVOS -> 'ostype:tvos;'"); break; +#endif +#if defined (TARGET_OS_WATCH) && TARGET_OS_WATCH == 1 case LC_VERSION_MIN_WATCHOS: os_handled = true; rep << "ostype:watchos;"; DNBLogThreadedIf (LOG_RNB_PROC, "LC_VERSION_MIN_WATCHOS -> 'ostype:watchos;'"); break; +#endif default: break; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r251176 - [lldb-mi] Fix expansion of anonymous structures and unions
Author: dperchik Date: Fri Oct 23 21:01:28 2015 New Revision: 251176 URL: http://llvm.org/viewvc/llvm-project?rev=251176&view=rev Log: [lldb-mi] Fix expansion of anonymous structures and unions A variable of type: struct S { union { inti1; unsigned u1; }; union { inti2; unsigned u2; }; }; had been impossible to evaluate in lldb-mi, because MI assigns '??' as the variable name to each of the unnamed unions after "-var-list-children" command. Also '??' incorrectly goes to 'exp' field which is treated by IDE as a structure field name and is displayed in watch window. The patch fixes this returning empty string as type name for unnamed union and assigning $N to variable name, where N is the field number in the parent entity. Patch from evgeny.levi...@gmail.com Reviewed by: clayborg, abidh Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D13947 Modified: lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py lldb/trunk/test/tools/lldb-mi/variable/main.cpp lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp lldb/trunk/tools/lldb-mi/MICmnLLDBUtilSBValue.cpp Modified: lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py?rev=251176&r1=251175&r2=251176&view=diff == --- lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py (original) +++ lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py Fri Oct 23 21:01:28 2015 @@ -356,3 +356,45 @@ class MiVarTestCase(lldbmi_testcase.MiTe # Test for std::string self.runCmd("-var-create - * std_string") self.expect('\^done,name="var\d+",numchild="[0-9]+",value=""hello"",type="std::[\S]*?string",thread-id="1",has_more="0"') + +@lldbmi_test +@skipIfWindows #llvm.org/pr24452: Get lldb-mi working on Windows +@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races +@skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots +def test_lldbmi_var_create_for_unnamed_objects(self): +"""Test that 'lldb-mi --interpreter' can expand unnamed structures and unions.""" + +self.spawnLldbMi(args = None) + +# Load executable +self.runCmd("-file-exec-and-symbols %s" % self.myexe) +self.expect("\^done") + +# Run to breakpoint +line = line_number('main.cpp', '// BP_unnamed_objects_test') +self.runCmd("-break-insert main.cpp:%d" % line) +self.expect("\^done,bkpt={number=\"1\"") +self.runCmd("-exec-run") +self.expect("\^running") +self.expect("\*stopped,reason=\"breakpoint-hit\"") + +# Evaluate struct_with_unions type and its children +self.runCmd("-var-create v0 * swu") + self.expect('\^done,name="v0",numchild="2",value="\{\.\.\.\}",type="struct_with_unions",thread-id="1",has_more="0"') + +self.runCmd("-var-list-children v0") + +# inspect the first unnamed union +self.runCmd("-var-list-children v0.$0") +self.runCmd("-var-evaluate-expression v0.$0.u_i") +self.expect('\^done,value="1"') + +# inspect the second unnamed union +self.runCmd("-var-list-children v0.$1") +self.runCmd("-var-evaluate-expression v0.$1.u1") +self.expect('\^done,value="-1"') +# inspect unnamed structure +self.runCmd("-var-list-children v0.$1.$1") +self.runCmd("-var-evaluate-expression v0.$1.$1.s1") +self.expect('\^done,value="-1"') + Modified: lldb/trunk/test/tools/lldb-mi/variable/main.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/variable/main.cpp?rev=251176&r1=251175&r2=251176&view=diff == --- lldb/trunk/test/tools/lldb-mi/variable/main.cpp (original) +++ lldb/trunk/test/tools/lldb-mi/variable/main.cpp Fri Oct 23 21:01:28 2015 @@ -27,6 +27,25 @@ struct pcomplex_type : complex_type int pcomplex_type::si; +struct struct_with_unions +{ +struct_with_unions(): u_i(1), u1(-1) {} +union +{ +int u_i; +int u_j; +}; +union +{ +int u1; +struct +{ +short s1; +short s2; +}; +}; +}; + void var_update_test(void) { @@ -80,6 +99,13 @@ cpp_stl_types_test(void) // BP_cpp_stl_types_test } +void +unnamed_objects_test(void) +{ +struct_with_unions swu; +// BP_unnamed_objects_test +} + struct not_str { not_str(char _c, int _f) @@ -119,6 +145,7 @@ main(int argc, char const *argv[]) var_list_children_test(); gdb_set_show_print_char_array_as_string_test(); cpp_stl_types_test(); +unnamed_objects_test(); gdb_set_show_print_expand_aggregates(); gdb_set_show_p
Re: [Lldb-commits] [PATCH] D12115: [LLDB-MI] Fix -data-info-line and -symbol-list-lines when Windows filenames are used.
dawn marked an inline comment as done. dawn added a comment. In http://reviews.llvm.org/D12115#248069, @chaoren wrote: > Could you please take a look at these issues? > > TestMiSymbol started to fail on Linux with gcc-4.9: > http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-cmake/builds/6387 Hi Chaoren, I believe the issue with gcc was fixed for gcc a while back. Just checking to make sure you're no longer seeing the failure. Let me know otherwise. Comment at: lldb/trunk/tools/lldb-mi/MIUtilParse.h:13 @@ +12,3 @@ +// Third party headers: +#include "../lib/Support/regex_impl.h" + chaoren wrote: > This caused a build failure on OS X: > http://lab.llvm.org:8011/builders/lldb-x86_64-darwin-13.4/builds/5801 This was fixed by Sean - the XCode build wasn't including the full set of include paths when building lldb-mi. Repository: rL LLVM http://reviews.llvm.org/D12115 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13073: Add an expression parser for Go
dawn added a subscriber: dawn. dawn closed this revision. dawn added a comment. This was committed in svn r251820. Repository: rL LLVM http://reviews.llvm.org/D13073 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D12809: Better scheme to lookup alternate mangled name when looking up function address.
dawn added a subscriber: dawn. dawn added a reviewer: evgeny777. dawn added a comment. Eugene has been doing some work in this area - perhaps he can accept this patch for you. http://reviews.llvm.org/D12809 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D12809: Better scheme to lookup alternate mangled name when looking up function address.
dawn requested changes to this revision. dawn added a reviewer: dawn. dawn added a comment. This revision now requires changes to proceed. 1. Please rebase again - this patch no longer applies cleanly, and fails to build after fixing merge conflicts. 2. Please add tests. http://reviews.llvm.org/D12809 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D14542: [lldb] Fix name lookup in ClangASTContext
dawn added a subscriber: dawn. dawn accepted this revision. dawn added a reviewer: dawn. dawn added a comment. Patch is correct - without it we loop through the same decl context again. I've tested it locally - there are no new regressions. http://reviews.llvm.org/D14542 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r252831 - [test] Fix comment.
Author: dperchik Date: Wed Nov 11 18:43:22 2015 New Revision: 252831 URL: http://llvm.org/viewvc/llvm-project?rev=252831&view=rev Log: [test] Fix comment. Modified: lldb/trunk/packages/Python/lldbsuite/test/expression_command/options/TestExprOptions.py Modified: lldb/trunk/packages/Python/lldbsuite/test/expression_command/options/TestExprOptions.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/options/TestExprOptions.py?rev=252831&r1=252830&r2=252831&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/expression_command/options/TestExprOptions.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/expression_command/options/TestExprOptions.py Wed Nov 11 18:43:22 2015 @@ -56,7 +56,7 @@ class ExprOptionsTestCase(TestBase): # test --language on C++ expression using the SB API's -# Make sure we can evaluate 'ns::func'. +# Make sure we can evaluate a C++11 expression. val = frame.EvaluateExpression('foo != nullptr') self.assertTrue(val.IsValid()) self.assertTrue(val.GetError().Success()) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D14542: [lldb] Fix name lookup in ClangASTContext
dawn added a comment. See inline comment. Comment at: source/Symbol/ClangASTContext.cpp:9191 @@ -9189,2 +9190,3 @@ +continue; searched.insert(it->second); symbol_file->ParseDeclsForContext(CompilerDeclContext(this, it->second)); Minor efficiency improvement - change these 3 lines to: if (!searched.insert(it->second).first) continue; No need for new patch - just change in final commit. http://reviews.llvm.org/D14542 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D14631: [dwarf] Handle DWARF forms for address other than DW_FORM_GNU_addr_index and DW_FORM_addr.
dawn created this revision. dawn added reviewers: tberghammer, clayborg, tfiala. dawn added a subscriber: lldb-commits. dawn set the repository for this revision to rL LLVM. Other compilers (and older Clang compilers) use data4/data8 forms to specify addresses in DWARF. This patch fixes lldb to correctly read the addresses in DWARF generated by those compilers. Repository: rL LLVM http://reviews.llvm.org/D14631 Files: source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp Index: source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp === --- source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp +++ source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp @@ -477,11 +477,10 @@ { SymbolFileDWARF* symbol_file = m_cu->GetSymbolFileDWARF(); -if (m_form == DW_FORM_addr) +if (m_form != DW_FORM_GNU_addr_index) return Unsigned(); assert(m_cu); -assert(m_form == DW_FORM_GNU_addr_index); if (!symbol_file) return 0; Index: source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp === --- source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp +++ source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp @@ -477,11 +477,10 @@ { SymbolFileDWARF* symbol_file = m_cu->GetSymbolFileDWARF(); -if (m_form == DW_FORM_addr) +if (m_form != DW_FORM_GNU_addr_index) return Unsigned(); assert(m_cu); -assert(m_form == DW_FORM_GNU_addr_index); if (!symbol_file) return 0; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D14631: [dwarf] Handle DWARF forms for address other than DW_FORM_GNU_addr_index and DW_FORM_addr.
dawn abandoned this revision. dawn added a comment. > If you have a compiler that is actually emitting addresses incorrectly using > DW_FORM_data* when the values are not offsets, the compiler should be fixed. Thanks Greg! In this case it indeed appears to be a compiler bug (we are getting relocations emitted for them). But I like your suggestion of how to rewrite the Address function. If any valid cases arise, I will use your idea, but instead create an overload which takes a parameter (that way only the DWARF contexts in which addresses are represented using data4/data8 will have to pay the cost of the added code). Repository: rL LLVM http://reviews.llvm.org/D14631 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D14631: [dwarf] Handle DWARF forms for address other than DW_FORM_GNU_addr_index and DW_FORM_addr.
dawn added a comment. In http://reviews.llvm.org/D14631#289917, @tberghammer wrote: > How you end up in calling DWARFFormValue::Address() with a value what have a > form type other then DW_FORM_addr and DW_FORM_GNU_addr_index? What is the > attribute tag and the form type used? Can you post a call stack for the case > when you hit this issue? We see it in the comp unit's low_pc: 0x000b: DW_TAG_compile_unit: abbrev_num=1 0x000c: DW_AT_producer : DW_FORM_strp string=Embarcadero Technologies Inc. clang version 3.1 (33931.6d56f68.9eae00b) (based on LLVM 3.1svn) 0x0010: DW_AT_language : DW_FORM_data2 uval=0x4 language=DW_LANG_C_plus_plus 0x0012: DW_AT_name : DW_FORM_strp string=cprops.cpp 0x0016: DW_AT_low_pc : DW_FORM_data4 uval=0x0 Address is called at the beginning of reading the CU's DIE. Repository: rL LLVM http://reviews.llvm.org/D14631 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [Diffusion] rL248048: Added support for resolving symbolic links to FileSpec.
dawn accepted this commit. dawn added a comment. Not really an acceptance, but the test that started failing as a result of this commit (LaunchInTerminalTestCase.test_launch_in_terminal) has been XFAILed o OSX in svn.252699 thanks to Todd Fiala. None the less, it would be a good idea to investigate why this commit caused the test to start failing. Users: spyffe (Author) dawn (Auditor) http://reviews.llvm.org/rL248048 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D15175: Fix breakpoint language filtering for other C variants (like C99) and Pascal.
dawn created this revision. dawn added a reviewer: jingham. dawn added a subscriber: lldb-commits. dawn set the repository for this revision to rL LLVM. This patch fixes setting breakpoints on symbol for variants of C and Pascal where the language is "unknown" within the filtering process added in r252356. It also renames GetLanguageForSymbolByName to GuessLanguageForSymbolByName and adds comments explaining the pitfalls of the flawed assumption that the language can be determined solely from the name and target. Comment: Our users want to be able to set breakpoints in C, C++ or Pascal, but since the parsing of Pascal breakpoint identifiers is incompatible with ObjC, they're forced to set the target language option to Pascal. After r252356 however, the Pascal identifiers are interpreted as C++ and the C symbols are unknown, so all symbols are filtered out because they don't match the target language setting of Pascal, and they can no longer set symbolic breakpoints. I don't see a way to fix this without breaking the intent of r252356. Locally we have had to disable the filtering code. Ideas for how to resolve this? Repository: rL LLVM http://reviews.llvm.org/D15175 Files: include/lldb/Target/LanguageRuntime.h source/Breakpoint/BreakpointResolverName.cpp source/Target/LanguageRuntime.cpp Index: source/Target/LanguageRuntime.cpp === --- source/Target/LanguageRuntime.cpp +++ source/Target/LanguageRuntime.cpp @@ -347,16 +347,21 @@ } lldb::LanguageType -LanguageRuntime::GetLanguageForSymbolByName (Target &target, const char *symbol_name) +LanguageRuntime::GuessLanguageForSymbolByName (Target &target, const char *symbol_name) { -// This is not the right way to do this. Different targets could have different ways of mangling names -// from a given language. So we should ask the various LanguageRuntime plugin instances for this target -// to recognize the name. But right now the plugin instances depend on the process, not the target. -// That is unfortunate, because I want to use this for filtering breakpoints by language, and so I need to know -// the "language for symbol-name" prior to running. So we'd have to make a "LanguageRuntimeTarget" and -// "LanguageRuntimeProcess", and direct the questions that don't need a running process to the former, and that -// do to the latter. +// We "guess" the language because we can't determine a symbol's language from it's name. +// For example, a Pascal symbol can be mangled using the C++ Itanium scheme, and defined +// in a compilation unit within the same module as other C++ units. // +// In addition, different targets could have different ways of mangling names from a given +// language, likewise compilation units within those targets. It would help to be able to +// ask the various LanguageRuntime plugin instances for this target to recognize the name, +// but right now the plugin instances depend on the process, not the target. That is +// unfortunate, because to use this for filtering breakpoints by language, we need to know +// the "language for symbol-name" prior to running. So we'd have to make a +// "LanguageRuntimeTarget" and "LanguageRuntimeProcess", and direct the questions that don't +// need a running process to the former, and that do to the latter. +// // That's more work than I want to do for this feature. if (CPlusPlusLanguage::IsCPPMangledName (symbol_name)) return eLanguageTypeC_plus_plus; Index: source/Breakpoint/BreakpointResolverName.cpp === --- source/Breakpoint/BreakpointResolverName.cpp +++ source/Breakpoint/BreakpointResolverName.cpp @@ -279,8 +279,9 @@ const char *name = sc.GetFunctionName(Mangled::ePreferMangled).AsCString(); if (name) { -LanguageType sym_language = LanguageRuntime::GetLanguageForSymbolByName(target, name); -if (m_language == eLanguageTypeC) +LanguageType sym_language = LanguageRuntime::GuessLanguageForSymbolByName(target, name); +if (Language::LanguageIsC(m_language) || +Language::LanguageIsPascal(m_language)) { // We don't currently have a way to say "This symbol name is C" so for now, C means // not ObjC and not C++, etc... @@ -293,6 +294,12 @@ } else if (sym_language != m_language) { +// Note: This code prevents us from being able to find symbols +// like 'printf' if the target language's option is set. It +// would be better to limit this filtering to only when the +
Re: [Lldb-commits] [PATCH] D12809: Better scheme to lookup alternate mangled name when looking up function address.
dawn accepted this revision. dawn added a comment. lgtm. Patch was applied locally and tested with no regressions. Thanks for fixing the patch. http://reviews.llvm.org/D12809 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15175: Fix breakpoint language filtering for other C variants (like C99) and Pascal.
dawn added a comment. Jim, this patch doesn't attempt to fix the issue I raised in my comment - it just fixes the oversight of other C variants (clang picks C99 for example) and renames your function to a more meaningful name (and matches Mangled::GuessLanguage which is also uses the name to guess the language). I see no reason why to reject it. I didn't want to try and tackle the bigger problem in this patch, but wanted to raise the question so I might know how to resolve it in a different patch. Thank you for the feedback however - I like your "Any" suggestion and will submit another patch for it. Please accept this patch? Repository: rL LLVM http://reviews.llvm.org/D15175 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r254753 - Fix breakpoint language filtering for other C variants (like C99) and Pascal.
Author: dperchik Date: Fri Dec 4 13:34:00 2015 New Revision: 254753 URL: http://llvm.org/viewvc/llvm-project?rev=254753&view=rev Log: Fix breakpoint language filtering for other C variants (like C99) and Pascal. This patch fixes setting breakpoints on symbol for variants of C and Pascal where the language is "unknown" within the filter-by-language process added in r252356. It also renames GetLanguageForSymbolByName to GuessLanguageForSymbolByName and adds comments explaining the pitfalls of the flawed assumption that the language can be determined solely from the name and target. Reviewed by: jingham Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D15175 Modified: lldb/trunk/include/lldb/Target/LanguageRuntime.h lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp lldb/trunk/source/Target/LanguageRuntime.cpp Modified: lldb/trunk/include/lldb/Target/LanguageRuntime.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/LanguageRuntime.h?rev=254753&r1=254752&r2=254753&view=diff == --- lldb/trunk/include/lldb/Target/LanguageRuntime.h (original) +++ lldb/trunk/include/lldb/Target/LanguageRuntime.h Fri Dec 4 13:34:00 2015 @@ -118,7 +118,7 @@ public: } static lldb::LanguageType -GetLanguageForSymbolByName (Target &target, const char *symbol_name); +GuessLanguageForSymbolByName (Target &target, const char *symbol_name); Target& GetTargetRef() Modified: lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp?rev=254753&r1=254752&r2=254753&view=diff == --- lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp Fri Dec 4 13:34:00 2015 @@ -279,8 +279,9 @@ BreakpointResolverName::SearchCallback(S const char *name = sc.GetFunctionName(Mangled::ePreferMangled).AsCString(); if (name) { -LanguageType sym_language = LanguageRuntime::GetLanguageForSymbolByName(target, name); -if (m_language == eLanguageTypeC) +LanguageType sym_language = LanguageRuntime::GuessLanguageForSymbolByName(target, name); +if (Language::LanguageIsC(m_language) || +Language::LanguageIsPascal(m_language)) { // We don't currently have a way to say "This symbol name is C" so for now, C means // not ObjC and not C++, etc... @@ -293,6 +294,12 @@ BreakpointResolverName::SearchCallback(S } else if (sym_language != m_language) { +// Note: This code prevents us from being able to find symbols +// like 'printf' if the target language's option is set. It +// would be better to limit this filtering to only when the +// breakpoint's language option is set (and not the target's), +// but we can't know if m_language was set from the target or +// breakpoint option. remove_it = true; } } Modified: lldb/trunk/source/Target/LanguageRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/LanguageRuntime.cpp?rev=254753&r1=254752&r2=254753&view=diff == --- lldb/trunk/source/Target/LanguageRuntime.cpp (original) +++ lldb/trunk/source/Target/LanguageRuntime.cpp Fri Dec 4 13:34:00 2015 @@ -347,15 +347,20 @@ LanguageRuntime::CreateExceptionSearchFi } lldb::LanguageType -LanguageRuntime::GetLanguageForSymbolByName (Target &target, const char *symbol_name) +LanguageRuntime::GuessLanguageForSymbolByName (Target &target, const char *symbol_name) { -// This is not the right way to do this. Different targets could have different ways of mangling names -// from a given language. So we should ask the various LanguageRuntime plugin instances for this target -// to recognize the name. But right now the plugin instances depend on the process, not the target. -// That is unfortunate, because I want to use this for filtering breakpoints by language, and so I need to know -// the "language for symbol-name" prior to running. So we'd have to make a "LanguageRuntimeTarget" and -// "LanguageRuntimeProcess", and direct the questions that don't need a running process to the former, and that -// do to the latter. +// We "guess" the language because we can't determine a symbol's language from it's name. +// For example, a P
Re: [Lldb-commits] [PATCH] D12809: Better scheme to lookup alternate mangled name when looking up function address.
dawn added a comment. In http://reviews.llvm.org/D12809#301752, @sivachandra wrote: > @dawn: Thanks for accepting the patch. I guess I still need to wait for > sign-off/comments from a CODE_OWNER. Yeah. Maybe add more proactive reviewers? And definitely be a squeaky wheel about it. Keep adding reviewers and spamming them until someone gets irritated enough to have a look :) http://reviews.llvm.org/D12809 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D15312: Fix scope-based lookup when more than one function is found.
dawn created this revision. dawn added reviewers: paulherman, clayborg, granata.enrico. dawn added a subscriber: lldb-commits. dawn set the repository for this revision to rL LLVM. When multiple functions are found by name, lldb removes duplicate entries of functions with the same type, so the first function in the symbol context list is chosen, even if it isn't in scope. This patch uses the declaration context of the execution context to select the function which is in scope. This fixes cases like the following: int func(); namespace ns { int func(); void here() { // Run to BP here and eval 'p func()'; // lldb used to find ::func(), now finds ns::func(). } } Repository: rL LLVM http://reviews.llvm.org/D15312 Files: include/lldb/Symbol/ClangASTContext.h include/lldb/Symbol/GoASTContext.h include/lldb/Symbol/TypeSystem.h packages/Python/lldbsuite/test/lang/cpp/namespace/Makefile packages/Python/lldbsuite/test/lang/cpp/namespace/TestNamespaceLookup.py packages/Python/lldbsuite/test/lang/cpp/namespace/main.cpp packages/Python/lldbsuite/test/lang/cpp/namespace/ns.cpp packages/Python/lldbsuite/test/lang/cpp/namespace/ns.h packages/Python/lldbsuite/test/lang/cpp/namespace/ns2.cpp packages/Python/lldbsuite/test/lang/cpp/namespace/ns3.cpp source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp source/Symbol/ClangASTContext.cpp Index: source/Symbol/ClangASTContext.cpp === --- source/Symbol/ClangASTContext.cpp +++ source/Symbol/ClangASTContext.cpp @@ -9224,6 +9224,96 @@ return found_decls; } +// Look for opaque_find_decl_ctx's lookup scope in opaque_decl_ctx and its parents, +// and return the number of levels it took to find it, or LLDB_INVALID_DECL_LEVEL +// if not found. If the decl was imported via a using declaration, its name and +// type, if set, will be used to check that the decl found in the scope is a match. +// +// NOTE: Because file statics are at the TranslationUnit along with globals, a +// function at file scope will return the same level as a function at global scope. +// Ideally we'd like to treat the file scope as an additional scope just below the +// global scope. More work needs to be done to recognise that, if the decl we're +// trying to look up is static, we should compare its source file with that of the +// current scope and return a lower number for it. +uint32_t +ClangASTContext::DeclContextCountDeclLevels(void *opaque_decl_ctx, +void *opaque_find_decl_ctx, +ConstString *find_name, +CompilerType *find_type) +{ +int level = LLDB_INVALID_DECL_LEVEL; +if (opaque_decl_ctx) +{ +DeclContext *root_decl_ctx = (DeclContext *)opaque_decl_ctx; +DeclContext *find_decl_ctx = (DeclContext *)opaque_find_decl_ctx; +std::set searched; +std::multimap search_queue; +SymbolFile *symbol_file = GetSymbolFile(); + +// Get the lookup scope for the decl we're trying to find. +find_decl_ctx = find_decl_ctx->getLookupParent(); + +// Look for it in our scope's decl context and its parents. +for (clang::DeclContext *decl_context = root_decl_ctx; decl_context != nullptr; decl_context = decl_context->getParent()) +{ +if (!decl_context->isLookupContext()) +continue; +++level; +if (decl_context == find_decl_ctx) +// Found it! +return level; +search_queue.insert(std::make_pair(decl_context, decl_context)); + +for (auto it = search_queue.find(decl_context); it != search_queue.end(); it++) +{ +if (searched.find(it->second) != searched.end()) +continue; +searched.insert(it->second); +symbol_file->ParseDeclsForContext(CompilerDeclContext(this, it->second)); + +for (clang::Decl *child : it->second->decls()) +{ +if (clang::UsingDirectiveDecl *ud = llvm::dyn_cast(child)) +{ +clang::DeclContext *ns = ud->getNominatedNamespace(); +if (ns == find_decl_ctx) +// Found it! +return level; +clang::DeclContext *from = ud->getCommonAncestor(); +if (searched.find(ns) == searched.end()) +search_queue.insert(std::make_pair(from, ns)); +} +else if (find_name && + clang::UsingDecl *ud = llvm::dyn_cast(child)) +{ +for (clang::UsingShadowDecl *usd : ud->shadows()) +{ +
Re: [Lldb-commits] [PATCH] D15312: Fix scope-based lookup when more than one function is found.
dawn updated this revision to Diff 42115. dawn added a comment. Updated patch to removed change related to Pascal language - it should be part of a separate patch. Repository: rL LLVM http://reviews.llvm.org/D15312 Files: include/lldb/Symbol/ClangASTContext.h include/lldb/Symbol/GoASTContext.h include/lldb/Symbol/TypeSystem.h packages/Python/lldbsuite/test/lang/cpp/namespace/Makefile packages/Python/lldbsuite/test/lang/cpp/namespace/TestNamespaceLookup.py packages/Python/lldbsuite/test/lang/cpp/namespace/main.cpp packages/Python/lldbsuite/test/lang/cpp/namespace/ns.cpp packages/Python/lldbsuite/test/lang/cpp/namespace/ns.h packages/Python/lldbsuite/test/lang/cpp/namespace/ns2.cpp packages/Python/lldbsuite/test/lang/cpp/namespace/ns3.cpp source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp source/Symbol/ClangASTContext.cpp Index: source/Symbol/ClangASTContext.cpp === --- source/Symbol/ClangASTContext.cpp +++ source/Symbol/ClangASTContext.cpp @@ -9224,6 +9224,98 @@ return found_decls; } +// Look for opaque_find_decl_ctx's lookup scope in opaque_decl_ctx and its parents, +// and return the number of levels it took to find it, or LLDB_INVALID_DECL_LEVEL +// if not found. If the decl was imported via a using declaration, its name and +// type, if set, will be used to check that the decl found in the scope is a match. +// +// NOTE: Because file statics are at the TranslationUnit along with globals, a +// function at file scope will return the same level as a function at global scope. +// Ideally we'd like to treat the file scope as an additional scope just below the +// global scope. More work needs to be done to recognise that, if the decl we're +// trying to look up is static, we should compare its source file with that of the +// current scope and return a lower number for it. +uint32_t +ClangASTContext::DeclContextCountDeclLevels(void *opaque_decl_ctx, +void *opaque_find_decl_ctx, +ConstString *find_name, +CompilerType *find_type) +{ +int level = LLDB_INVALID_DECL_LEVEL; +if (opaque_decl_ctx) +{ +DeclContext *root_decl_ctx = (DeclContext *)opaque_decl_ctx; +DeclContext *find_decl_ctx = (DeclContext *)opaque_find_decl_ctx; +std::set searched; +std::multimap search_queue; +SymbolFile *symbol_file = GetSymbolFile(); + +// Get the lookup scope for the decl we're trying to find. +find_decl_ctx = find_decl_ctx->getLookupParent(); + +// Look for it in our scope's decl context and its parents. +for (clang::DeclContext *decl_context = root_decl_ctx; decl_context != nullptr; decl_context = decl_context->getParent()) +{ +if (!decl_context->isLookupContext()) +continue; +++level; +if (decl_context == find_decl_ctx) +// Found it! +return level; +search_queue.insert(std::make_pair(decl_context, decl_context)); + +for (auto it = search_queue.find(decl_context); it != search_queue.end(); it++) +{ +if (searched.find(it->second) != searched.end()) +continue; +searched.insert(it->second); +symbol_file->ParseDeclsForContext(CompilerDeclContext(this, it->second)); + +for (clang::Decl *child : it->second->decls()) +{ +if (clang::UsingDirectiveDecl *ud = llvm::dyn_cast(child)) +{ +clang::DeclContext *ns = ud->getNominatedNamespace(); +if (ns == find_decl_ctx) +// Found it! +return level; +clang::DeclContext *from = ud->getCommonAncestor(); +if (searched.find(ns) == searched.end()) +search_queue.insert(std::make_pair(from, ns)); +} +else if (find_name) +{ +if (clang::UsingDecl *ud = llvm::dyn_cast(child)) +{ +for (clang::UsingShadowDecl *usd : ud->shadows()) +{ +clang::Decl *target = usd->getTargetDecl(); +clang::NamedDecl *nd = llvm::dyn_cast(target); +if (!nd) +continue; +// Check names. +IdentifierInfo *ii = nd->getIdentifier(); +if (ii == nullptr || !ii->getName().equals(find_name->AsCString(nullptr))) +continue; +
[Lldb-commits] [PATCH] D15326: Rework breakpoint language filtering to use the symbol context's language.
dawn created this revision. dawn added a reviewer: jingham. dawn added a subscriber: lldb-commits. dawn set the repository for this revision to rL LLVM. This patch reworks the breakpoint filter-by-language patch to use the symbol context instead of trying to guess the language solely from the symbol's name. This has the advantage that symbols compiled with debug info will have their actual language known. Symbols without debug info will still do the same "guess"ing because Symbol::GetLanguage() is implemented using Mangled::GuessLanguage(). The recognition of ObjC names was merged into Mangled::GuessLanguage. Repository: rL LLVM http://reviews.llvm.org/D15326 Files: include/lldb/Symbol/SymbolContext.h include/lldb/Target/Language.h include/lldb/Target/LanguageRuntime.h source/Breakpoint/BreakpointResolverName.cpp source/Core/Mangled.cpp source/Symbol/SymbolContext.cpp source/Target/Language.cpp source/Target/LanguageRuntime.cpp Index: source/Target/LanguageRuntime.cpp === --- source/Target/LanguageRuntime.cpp +++ source/Target/LanguageRuntime.cpp @@ -345,28 +345,3 @@ { return m_process->GetTarget().GetSearchFilterForModule(NULL); } - -lldb::LanguageType -LanguageRuntime::GuessLanguageForSymbolByName (Target &target, const char *symbol_name) -{ -// We "guess" the language because we can't determine a symbol's language from it's name. -// For example, a Pascal symbol can be mangled using the C++ Itanium scheme, and defined -// in a compilation unit within the same module as other C++ units. -// -// In addition, different targets could have different ways of mangling names from a given -// language, likewise compilation units within those targets. It would help to be able to -// ask the various LanguageRuntime plugin instances for this target to recognize the name, -// but right now the plugin instances depend on the process, not the target. That is -// unfortunate, because to use this for filtering breakpoints by language, we need to know -// the "language for symbol-name" prior to running. So we'd have to make a -// "LanguageRuntimeTarget" and "LanguageRuntimeProcess", and direct the questions that don't -// need a running process to the former, and that do to the latter. -// -// That's more work than I want to do for this feature. -if (CPlusPlusLanguage::IsCPPMangledName (symbol_name)) -return eLanguageTypeC_plus_plus; -else if (ObjCLanguage::IsPossibleObjCMethodName (symbol_name)) -return eLanguageTypeObjC; -else -return eLanguageTypeUnknown; -} Index: source/Target/Language.cpp === --- source/Target/Language.cpp +++ source/Target/Language.cpp @@ -287,6 +287,57 @@ } } +LanguageType +Language::GetPrimaryLanguage (LanguageType language) +{ +switch (language) +{ +case eLanguageTypeC_plus_plus: +case eLanguageTypeC_plus_plus_03: +case eLanguageTypeC_plus_plus_11: +case eLanguageTypeC_plus_plus_14: +return eLanguageTypeC_plus_plus; +case eLanguageTypeC: +case eLanguageTypeC89: +case eLanguageTypeC99: +case eLanguageTypeC11: +return eLanguageTypeC; +case eLanguageTypeObjC: +case eLanguageTypeObjC_plus_plus: +return eLanguageTypeObjC; +case eLanguageTypePascal83: +case eLanguageTypeCobol74: +case eLanguageTypeCobol85: +case eLanguageTypeFortran77: +case eLanguageTypeFortran90: +case eLanguageTypeFortran95: +case eLanguageTypeFortran03: +case eLanguageTypeFortran08: +case eLanguageTypeAda83: +case eLanguageTypeAda95: +case eLanguageTypeModula2: +case eLanguageTypeJava: +case eLanguageTypePLI: +case eLanguageTypeUPC: +case eLanguageTypeD: +case eLanguageTypePython: +case eLanguageTypeOpenCL: +case eLanguageTypeGo: +case eLanguageTypeModula3: +case eLanguageTypeHaskell: +case eLanguageTypeOCaml: +case eLanguageTypeRust: +case eLanguageTypeSwift: +case eLanguageTypeJulia: +case eLanguageTypeDylan: +case eLanguageTypeMipsAssembler: +case eLanguageTypeExtRenderScript: +case eLanguageTypeUnknown: +default: +return language; +} +} + void Language::GetLanguagesSupportingTypeSystems (std::set &languages, std::set &languages_for_expressions) Index: source/Symbol/SymbolContext.cpp === --- source/Symbol/SymbolContext.cpp +++ source/Symbol/SymbolContext.cpp @@ -525,6 +525,38 @@ return false; } +LanguageType +SymbolContext::GetLanguage () const +{ +LanguageType lang; +if
Re: [Lldb-commits] [PATCH] D15312: Fix scope-based lookup when more than one function is found.
dawn added a comment. bloodbath:~% exit Thanks Greg! To address your main point: > So either make it generic, or clang specific. DeclContextCountDeclLevels's interface follows DeclContextFindDeclByName (authored by Paul Herman). If DeclContextCountDeclLevels is to change, then DeclContextFindDeclByName should also change for consistency. My take on this is that the code in ClangExpressionDeclMap::FindExternalVisibleDecls which calls these scope-based lookup routines should be moved out of ClangExpressionDeclMap.cpp into CompilerExpressionDeclMap.cpp, so the interfaces to DeclContextFindDeclByName/DeclContextCountDeclLevels should remain generic while the implementations are compiler specific. That's way more than I'd like to take on as part of this patch however. Paul, any feedback from you on this? Repository: rL LLVM http://reviews.llvm.org/D15312 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15312: Fix scope-based lookup when more than one function is found.
dawn added a comment. > Greg: But going forward I would like to see more of "find a struct named 'X' in CompilerDeclContext 'Y'" queries, instead of ... I think lldb should have both, a "search for anything named foo in my scope context" (for when a user does "p foo"), and a "search for a thingy (functions/types/variables/etc.) named foo in my scope context" (for when a user does "expr --type function -- foo"). > tberghammer: I am not sure if doing all of the parsing lazily is the good > approach because of speed considerations. ... looking into the direction we > are heading now we will need to parse more and more information to improve > the expression evaluation Agreed. > Greg: > > int32_t CompilerDeclContext::GetDepth (const CompilerDeclContext &decl_ctx); > > This would get the depth of one CompilerDeclContext within another > CompilerDeclContext, it would return -1 if "decl_ctx" doesn't fall within the > object, and zero or above it is is contained. The problem with this is that it won't work for using declarations which require information about the thing we're looking up before it can determine the proper scope levels. > BTW: I fixed DeclContextFindDeclByName to return a vector of CompilerDecl > objects: Cool, but it needs to accept an optional type to deal with function overloading. I can add that and see if I can come up with a new patch that uses the new DeclContextFindDeclByName. (In my copious spare time - heh). But... One major performance benefit of my original implementation is that the function's name and type *only* need to be tested in the case of a using declaration, so in general it's much faster, because we only need to look for the function's parent's lookup scope. So, are you sure you want to go down this path? Repository: rL LLVM http://reviews.llvm.org/D15312 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15326: Rework breakpoint language filtering to use the symbol context's language.
dawn added a comment. In http://reviews.llvm.org/D15326#305163, @jingham wrote: > The part of this fix which is using info in the SymbolContext to make the > language detection more accurate is fine. > > We have to do something better about how we detect the language from a > mangled name. The target knows some that it should be able to contribute, > but there's no clear way to do that now. But you aren't making that any > worse (except the one inline comment about cstring_is_mangled above, which > will need to get fixed) so I don't think you are obligated to solve that > problem now. Can we please accept this as is? It helps *a lot* - we know the *exact* language whenever we have debug info for an identifier. I've been able to remove my #if 0's around the filtering code with this patch. As you say, it doesn't make anything worse, and for many of us makes, things are far better. Why would you reject it? The name mangling issue is a whole other beast - it was a flawed assumption from the start (and I complained about it then). I'm simply trying to make the best with what we have. Repository: rL LLVM http://reviews.llvm.org/D15326 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15326: Rework breakpoint language filtering to use the symbol context's language.
dawn added a reviewer: clayborg. dawn added a comment. (Added Greg - he wrote Mangled::GetLanguage - now GuessLanguage). This patch removes the dependence on determining language from the name mangling for 99% of cases (there's still the much less common problem for symbols since Symbol 's GetLanguage calls Mangled::GuessLanguage). It is a win win. Repository: rL LLVM http://reviews.llvm.org/D15326 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15326: Rework breakpoint language filtering to use the symbol context's language.
dawn requested a review of this revision. dawn added a comment. Please reconsider. Thanks. Repository: rL LLVM http://reviews.llvm.org/D15326 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15326: Rework breakpoint language filtering to use the symbol context's language.
dawn marked an inline comment as done. dawn added a comment. Thanks Greg. Will fix comment in commit. @Jim, can you accept please? Repository: rL LLVM http://reviews.llvm.org/D15326 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15312: Fix scope-based lookup when more than one function is found.
dawn marked 6 inline comments as done. dawn added a comment. Hi Greg, I'm working on a new revision to change the patch as you suggest (thanks for your review - you had some great suggestions!). Sorry, if I'm missing something obviously here, but there's still some things I don't understand: 1. What exactly was clang specific about the DeclContextCountDeclLevels API? 2. How is it anymore clang specific than DeclContextFindDeclByName? Anyway, I didn't want to drag this out any longer so am making the code clang specific. We can always generalize it in the future (I want it for Delphi). Comment at: source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp:1467-1468 @@ +1466,4 @@ +// Filter out class/instance methods. +if (decl_ctx.IsClassMethod(nullptr, nullptr, nullptr)) +continue; +sc_func_list.Append(sym_ctx); clayborg wrote: > Why are we pulling out class methods here? To save time - they're thrown out by the loop that actually adds the functions which follows this, so no point in spending time on them. Comment at: source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp:1505-1509 @@ +1504,7 @@ +// scope and shadows the other. +fdi.m_func_decl_lvl = + ast->DeclContextCountDeclLevels(compiler_decl_context.GetOpaqueDeclContext(), + func_decl_context.GetOpaqueDeclContext(), + &fdi.m_function_name, + &fdi.m_copied_function_type); +} clayborg wrote: > Seems like you actually want this to be something like: > > ``` > fdi.m_func_decl_lvl = func_decl_context.Depth(compiler_decl_context); > ``` > > This would be a function on CompilerDeclContext that would calculate the > depth of a decl context if the first argument (compiler_decl_context) is > contained within the object (func_decl_context). This would be a useful API > to add to CompilerDeclContext. It can return an integer and return "-1" if > the compiler_decl_context ins't contained within func_decl_context, or zero > or greater if it is. > > Then you would need to add more functions the CompilerDeclContext to get > "fdi.m_function_name" and "fdi.m_copied_function_type". > As mentioned in prior discussions, this API is basically what you are suggesting. The name and type are not returned - they are optional inputs into the function to allow for languages which support using declarations (because using declarations need to check type and/or name). For example, in Delphi where using declarations are not supported, these would default to nullptr. Comment at: source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp:1517 @@ +1516,3 @@ +uint32_t num_indices = sc_func_list.GetSize(); +std::vector fdi_cache; +fdi_cache.reserve(num_indices); clayborg wrote: > wouldn't this be better as std::multimap where the > uint32_t is the depth? Then you can change your foo loop at 1531 to just grab > the first entry in the map and iterate as long as the depth is the same... That won't work because we can have functions at more than one level that we'll want to keep in our set. Using std::multimap might help to clean things up a little however - will give it a try. Repository: rL LLVM http://reviews.llvm.org/D15312 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15312: Fix scope-based lookup when more than one function is found.
dawn marked 3 inline comments as done. dawn added a comment. > It seems like you combined "find this decl instance within a decl context" > with "find a decl by name in the CompilerDeclContext and optionally get the > type". It it exactly "find this decl instance within a decl context". > I am still unclear as to what the name and type are doing in > DeclContextCountDeclLevels. I don't see how we would ever have a decl (in > opaque_find_decl_ctx) that isn't unique where the same decl could have > different names and different types? The optional name is required by languages (like C++) to handle using declarations like: void poo(); namespace ns { void foo(); void goo(); } void bar() { using ns::foo; // Here, 'foo' is needed so that we can match it // with the using declaration. // // We want the API to return 0 for 'foo', // -1 for 'goo', and 1 for 'poo'. } The optional type might be required by languages which have a using declaration-like concept where a type can be specified, like: void foo(int, int); namespace ns { void foo(); void foo(int); } void bar() { using_like ns::foo(int); // Here, 'foo' and its type are both needed so that // we can match it with the using_like declaration. // // We want the API to return 0 for { 'foo', 'void(int)' }, // -1 for { 'foo', 'void()' }, // and 1 for { 'foo', 'void(int, int)' }, } The name and type are optional (default to 0) for languages which don't have these concepts. Repository: rL LLVM http://reviews.llvm.org/D15312 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15312: Fix scope-based lookup when more than one function is found.
dawn updated this revision to Diff 42375. dawn added a comment. This version of the patch makes the API specific to clang. Repository: rL LLVM http://reviews.llvm.org/D15312 Files: include/lldb/Symbol/ClangASTContext.h packages/Python/lldbsuite/test/lang/cpp/namespace/Makefile packages/Python/lldbsuite/test/lang/cpp/namespace/main.cpp packages/Python/lldbsuite/test/lang/cpp/namespace/ns.cpp packages/Python/lldbsuite/test/lang/cpp/namespace/ns.h packages/Python/lldbsuite/test/lang/cpp/namespace/ns2.cpp packages/Python/lldbsuite/test/lang/cpp/namespace/ns3.cpp source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp source/Symbol/ClangASTContext.cpp Index: source/Symbol/ClangASTContext.cpp === --- source/Symbol/ClangASTContext.cpp +++ source/Symbol/ClangASTContext.cpp @@ -9224,6 +9224,125 @@ return found_decls; } +// Look for child_decl_ctx's lookup scope in frame_decl_ctx and its parents, +// and return the number of levels it took to find it, or LLDB_INVALID_DECL_LEVEL +// if not found. If the decl was imported via a using declaration, its name and/or +// type, if set, will be used to check that the decl found in the scope is a match. +// +// The optional name is required by languages (like C++) to handle using declarations +// like: +// +// void poo(); +// namespace ns { +// void foo(); +// void goo(); +// } +// void bar() { +// using ns::foo; +// // CountDeclLevels returns 0 for 'foo', 1 for 'poo', and +// // LLDB_INVALID_DECL_LEVEL for 'goo'. +// } +// +// The optional type might be useful in the case that there's a specific overload +// that we're looking for, like: +// +// void foo(int, int); +// namespace ns { +// void foo(); +// void foo(int); +// } +// void bar() { +// using_like ns::foo(int); +// // CountDeclLevels returns 0 for { 'foo', void(int) }, +// // 1 for { 'foo', void(int, int) }, and +// // LLDB_INVALID_DECL_LEVEL for { 'foo', void() }. +// } +// +// NOTE: Because file statics are at the TranslationUnit along with globals, a +// function at file scope will return the same level as a function at global scope. +// Ideally we'd like to treat the file scope as an additional scope just below the +// global scope. More work needs to be done to recognise that, if the decl we're +// trying to look up is static, we should compare its source file with that of the +// current scope and return a lower number for it. +uint32_t +ClangASTContext::CountDeclLevels (clang::DeclContext *frame_decl_ctx, + clang::DeclContext *child_decl_ctx, + ConstString *child_name, + CompilerType *child_type) +{ +if (frame_decl_ctx) +{ +std::set searched; +std::multimap search_queue; +SymbolFile *symbol_file = GetSymbolFile(); + +// Get the lookup scope for the decl we're trying to find. +clang::DeclContext *parent_decl_ctx = child_decl_ctx->getParent(); + +// Look for it in our scope's decl context and its parents. +uint32_t level = 0; +for (clang::DeclContext *decl_ctx = frame_decl_ctx; decl_ctx != nullptr; decl_ctx = decl_ctx->getParent()) +{ +if (!decl_ctx->isLookupContext()) +continue; +if (decl_ctx == parent_decl_ctx) +// Found it! +return level; +search_queue.insert(std::make_pair(decl_ctx, decl_ctx)); + +for (auto it = search_queue.find(decl_ctx); it != search_queue.end(); it++) +{ +if (searched.find(it->second) != searched.end()) +continue; +searched.insert(it->second); +symbol_file->ParseDeclsForContext(CompilerDeclContext(this, it->second)); + +for (clang::Decl *child : it->second->decls()) +{ +if (clang::UsingDirectiveDecl *ud = llvm::dyn_cast(child)) +{ +clang::DeclContext *ns = ud->getNominatedNamespace(); +if (ns == parent_decl_ctx) +// Found it! +return level; +clang::DeclContext *from = ud->getCommonAncestor(); +if (searched.find(ns) == searched.end()) +search_queue.insert(std::make_pair(from, ns)); +} +else if (child_name) +{ +if (clang::UsingDecl *ud = llvm::dyn_cast(child)) +{ +for (clang::UsingShadowDecl *usd : ud->shadows()) +{ +clang::Decl *target = usd->getTargetDecl(); +
Re: [Lldb-commits] [PATCH] D15312: Fix scope-based lookup when more than one function is found.
dawn updated this revision to Diff 42385. dawn added a comment. This version of the patch is the API "generic" version of the patch. Please choose to review which ever is preferred, and I will submit another patch based on that version if needed. BTW Greg, thanks for the suggestion of multimap - it definitely simplified things! And if you're wondering why we want to keep a set of functions for each type in FindExternalVisibleDecls, it's because overload resolution hasn't chosen a function yet, so we must keep all possible candidates in our set. Repository: rL LLVM http://reviews.llvm.org/D15312 Files: include/lldb/Symbol/ClangASTContext.h include/lldb/Symbol/GoASTContext.h include/lldb/Symbol/TypeSystem.h packages/Python/lldbsuite/test/lang/cpp/namespace/Makefile packages/Python/lldbsuite/test/lang/cpp/namespace/main.cpp packages/Python/lldbsuite/test/lang/cpp/namespace/ns.cpp packages/Python/lldbsuite/test/lang/cpp/namespace/ns.h packages/Python/lldbsuite/test/lang/cpp/namespace/ns2.cpp packages/Python/lldbsuite/test/lang/cpp/namespace/ns3.cpp source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp source/Symbol/ClangASTContext.cpp Index: source/Symbol/ClangASTContext.cpp === --- source/Symbol/ClangASTContext.cpp +++ source/Symbol/ClangASTContext.cpp @@ -9224,6 +9224,127 @@ return found_decls; } +// Look for child_decl_ctx's lookup scope in frame_decl_ctx and its parents, +// and return the number of levels it took to find it, or LLDB_INVALID_DECL_LEVEL +// if not found. If the decl was imported via a using declaration, its name and/or +// type, if set, will be used to check that the decl found in the scope is a match. +// +// The optional name is required by languages (like C++) to handle using declarations +// like: +// +// void poo(); +// namespace ns { +// void foo(); +// void goo(); +// } +// void bar() { +// using ns::foo; +// // CountDeclLevels returns 0 for 'foo', 1 for 'poo', and +// // LLDB_INVALID_DECL_LEVEL for 'goo'. +// } +// +// The optional type might be useful in the case that there's a specific overload +// that we're looking for, like: +// +// void foo(int, int); +// namespace ns { +// void foo(); +// void foo(int); +// } +// void bar() { +// using_like ns::foo(int); +// // CountDeclLevels returns 0 for { 'foo', void(int) }, +// // 1 for { 'foo', void(int, int) }, and +// // LLDB_INVALID_DECL_LEVEL for { 'foo', void() }. +// } +// +// NOTE: Because file statics are at the TranslationUnit along with globals, a +// function at file scope will return the same level as a function at global scope. +// Ideally we'd like to treat the file scope as an additional scope just below the +// global scope. More work needs to be done to recognise that, if the decl we're +// trying to look up is static, we should compare its source file with that of the +// current scope and return a lower number for it. +uint32_t +ClangASTContext::DeclContextCountDeclLevels (void *opaque_frame_decl_ctx, + void *opaque_child_decl_ctx, + ConstString *child_name, + CompilerType *child_type) +{ +if (opaque_frame_decl_ctx) +{ +DeclContext *frame_decl_ctx = (DeclContext *)opaque_frame_decl_ctx; +DeclContext *child_decl_ctx = (DeclContext *)opaque_child_decl_ctx; +std::set searched; +std::multimap search_queue; +SymbolFile *symbol_file = GetSymbolFile(); + +// Get the lookup scope for the decl we're trying to find. +clang::DeclContext *parent_decl_ctx = child_decl_ctx->getParent(); + +// Look for it in our scope's decl context and its parents. +uint32_t level = 0; +for (clang::DeclContext *decl_ctx = frame_decl_ctx; decl_ctx != nullptr; decl_ctx = decl_ctx->getParent()) +{ +if (!decl_ctx->isLookupContext()) +continue; +if (decl_ctx == parent_decl_ctx) +// Found it! +return level; +search_queue.insert(std::make_pair(decl_ctx, decl_ctx)); + +for (auto it = search_queue.find(decl_ctx); it != search_queue.end(); it++) +{ +if (searched.find(it->second) != searched.end()) +continue; +searched.insert(it->second); +symbol_file->ParseDeclsForContext(CompilerDeclContext(this, it->second)); + +for (clang::Decl *child : it->second->decls()) +{ +if (clang::UsingDirectiveDecl *ud = llvm::dyn_cast(child)) +{ +clang::DeclContext *ns = ud->getNominatedNamespace(); +if (ns == parent_
Re: [Lldb-commits] [PATCH] D15312: Fix scope-based lookup when more than one function is found.
dawn updated this revision to Diff 42476. dawn added a comment. Updated Clang-specific version of patch. Repository: rL LLVM http://reviews.llvm.org/D15312 Files: include/lldb/Symbol/ClangASTContext.h packages/Python/lldbsuite/test/lang/cpp/namespace/Makefile packages/Python/lldbsuite/test/lang/cpp/namespace/main.cpp packages/Python/lldbsuite/test/lang/cpp/namespace/ns.cpp packages/Python/lldbsuite/test/lang/cpp/namespace/ns.h packages/Python/lldbsuite/test/lang/cpp/namespace/ns2.cpp packages/Python/lldbsuite/test/lang/cpp/namespace/ns3.cpp source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp source/Symbol/ClangASTContext.cpp Index: source/Symbol/ClangASTContext.cpp === --- source/Symbol/ClangASTContext.cpp +++ source/Symbol/ClangASTContext.cpp @@ -9224,6 +9224,123 @@ return found_decls; } +// Look for child_decl_ctx's lookup scope in frame_decl_ctx and its parents, +// and return the number of levels it took to find it, or LLDB_INVALID_DECL_LEVEL +// if not found. If the decl was imported via a using declaration, its name and/or +// type, if set, will be used to check that the decl found in the scope is a match. +// +// The optional name is required by languages (like C++) to handle using declarations +// like: +// +// void poo(); +// namespace ns { +// void foo(); +// void goo(); +// } +// void bar() { +// using ns::foo; +// // CountDeclLevels returns 0 for 'foo', 1 for 'poo', and +// // LLDB_INVALID_DECL_LEVEL for 'goo'. +// } +// +// The optional type is useful in the case that there's a specific overload +// that we're looking for that might otherwise be shadowed, like: +// +// void foo(int); +// namespace ns { +// void foo(); +// } +// void bar() { +// using ns::foo; +// // CountDeclLevels returns 0 for { 'foo', void() }, +// // 1 for { 'foo', void(int) }, and +// // LLDB_INVALID_DECL_LEVEL for { 'foo', void(int, int) }. +// } +// +// NOTE: Because file statics are at the TranslationUnit along with globals, a +// function at file scope will return the same level as a function at global scope. +// Ideally we'd like to treat the file scope as an additional scope just below the +// global scope. More work needs to be done to recognise that, if the decl we're +// trying to look up is static, we should compare its source file with that of the +// current scope and return a lower number for it. +uint32_t +ClangASTContext::CountDeclLevels (clang::DeclContext *frame_decl_ctx, + clang::DeclContext *child_decl_ctx, + ConstString *child_name, + CompilerType *child_type) +{ +if (frame_decl_ctx) +{ +std::set searched; +std::multimap search_queue; +SymbolFile *symbol_file = GetSymbolFile(); + +// Get the lookup scope for the decl we're trying to find. +clang::DeclContext *parent_decl_ctx = child_decl_ctx->getParent(); + +// Look for it in our scope's decl context and its parents. +uint32_t level = 0; +for (clang::DeclContext *decl_ctx = frame_decl_ctx; decl_ctx != nullptr; decl_ctx = decl_ctx->getParent()) +{ +if (!decl_ctx->isLookupContext()) +continue; +if (decl_ctx == parent_decl_ctx) +// Found it! +return level; +search_queue.insert(std::make_pair(decl_ctx, decl_ctx)); +for (auto it = search_queue.find(decl_ctx); it != search_queue.end(); it++) +{ +if (searched.find(it->second) != searched.end()) +continue; +searched.insert(it->second); +symbol_file->ParseDeclsForContext(CompilerDeclContext(this, it->second)); + +for (clang::Decl *child : it->second->decls()) +{ +if (clang::UsingDirectiveDecl *ud = llvm::dyn_cast(child)) +{ +clang::DeclContext *ns = ud->getNominatedNamespace(); +if (ns == parent_decl_ctx) +// Found it! +return level; +clang::DeclContext *from = ud->getCommonAncestor(); +if (searched.find(ns) == searched.end()) +search_queue.insert(std::make_pair(from, ns)); +} +else if (child_name) +{ +if (clang::UsingDecl *ud = llvm::dyn_cast(child)) +{ +for (clang::UsingShadowDecl *usd : ud->shadows()) +{ +clang::Decl *target = usd->getTargetDecl(); +clang::Name
Re: [Lldb-commits] [PATCH] D15326: Rework breakpoint language filtering to use the symbol context's language.
dawn added a comment. ping? Repository: rL LLVM http://reviews.llvm.org/D15326 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r282941 - Fix comment - Module::PrepareForFunctionNameLookup should be Module::LookupInfo::LookupInfo.
Author: dperchik Date: Fri Sep 30 15:38:33 2016 New Revision: 282941 URL: http://llvm.org/viewvc/llvm-project?rev=282941&view=rev Log: Fix comment - Module::PrepareForFunctionNameLookup should be Module::LookupInfo::LookupInfo. Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/trunk/source/Symbol/Symtab.cpp Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=282941&r1=282940&r2=282941&view=diff == --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Fri Sep 30 15:38:33 2016 @@ -2395,7 +2395,7 @@ SymbolFileDWARF::FindFunctions(const Con name.AsCString()); // eFunctionNameTypeAuto should be pre-resolved by a call to - // Module::PrepareForFunctionNameLookup() + // Module::LookupInfo::LookupInfo() assert((name_type_mask & eFunctionNameTypeAuto) == 0); Log *log(LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS)); Modified: lldb/trunk/source/Symbol/Symtab.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Symtab.cpp?rev=282941&r1=282940&r2=282941&view=diff == --- lldb/trunk/source/Symbol/Symtab.cpp (original) +++ lldb/trunk/source/Symbol/Symtab.cpp Fri Sep 30 15:38:33 2016 @@ -1069,7 +1069,7 @@ size_t Symtab::FindFunctionSymbols(const const char *name_cstr = name.GetCString(); // eFunctionNameTypeAuto should be pre-resolved by a call to - // Module::PrepareForFunctionNameLookup() + // Module::LookupInfo::LookupInfo() assert((name_type_mask & eFunctionNameTypeAuto) == 0); if (name_type_mask & (eFunctionNameTypeBase | eFunctionNameTypeFull)) { ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D25137: [lldbmi] Fix prompt which can get inserted in the middle of lldb-mi output
dawn created this revision. dawn added reviewers: ted, zturner, clayborg. dawn added subscribers: amccarth, lldb-commits. dawn set the repository for this revision to rL LLVM. The code added in svn trunk 264332 causes "(lldb)" to be printed in the middle of program console output. This fix restores the behavior for non-Windows platforms to before the patch. From a C++ program with the following source: ... printf("\n#Break: Function parameters - arrays"); printf("\n#Evaluate:A[0]-C[0] + (A[1]-C[1])*1000 #ExpectedEval:%d", 1001); printf("\n#Evaluate:FuncArr(C,B) #ExpectedEval:%d", RES); printf("\n#Evaluate:A[0]-C[0] + (A[1]-C[1])*1000 + 0 #ExpectedEval:%d", 0); printf("\n#Evaluate:ref[0] + ref[1]*10 #ExpectedEval:%d", 65); printf("\n#Evaluate:FuncArrRet(7,8) #ExpectedLike:deferred"); ... produce the following output on iOS: #Break: Function parameters - arrays #Evaluate:A[0]-C[0] + (A[1]-C[1])*1000 #ExpectedEval:1001 #Evaluate:FuncArr(C,B) #ExpectedEval:4321 #Evaluate:A[0]-C[0] + (A[1]-C[1])*1000 + 0 #ExpectedEval:0 #Evaluate:ref[0] + ref[1]*10 #ExpectedEval:65 #Evalua(lldb) te:FuncArrRet(7,8) #ExpectedLike:deferred ... Note the "(lldb) " inserted into the program output of the 6th print statement. Repository: rL LLVM https://reviews.llvm.org/D25137 Files: source/Core/IOHandler.cpp Index: source/Core/IOHandler.cpp === --- source/Core/IOHandler.cpp +++ source/Core/IOHandler.cpp @@ -590,8 +590,8 @@ else #endif { +#ifdef _MSC_VER const char *prompt = GetPrompt(); -#ifdef _MSC_VER if (prompt) { // Back up over previous prompt using Windows API CONSOLE_SCREEN_BUFFER_INFO screen_buffer_info; @@ -605,9 +605,11 @@ } #endif IOHandler::PrintAsync(stream, s, len); +#ifdef _MSC_VER if (prompt) IOHandler::PrintAsync(GetOutputStreamFile().get(), prompt, strlen(prompt)); +#endif } } Index: source/Core/IOHandler.cpp === --- source/Core/IOHandler.cpp +++ source/Core/IOHandler.cpp @@ -590,8 +590,8 @@ else #endif { +#ifdef _MSC_VER const char *prompt = GetPrompt(); -#ifdef _MSC_VER if (prompt) { // Back up over previous prompt using Windows API CONSOLE_SCREEN_BUFFER_INFO screen_buffer_info; @@ -605,9 +605,11 @@ } #endif IOHandler::PrintAsync(stream, s, len); +#ifdef _MSC_VER if (prompt) IOHandler::PrintAsync(GetOutputStreamFile().get(), prompt, strlen(prompt)); +#endif } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r283031 - [lldb-mi] Fix prompt which can get inserted in the middle of program output in lldb-mi
Author: dperchik Date: Sat Oct 1 05:37:56 2016 New Revision: 283031 URL: http://llvm.org/viewvc/llvm-project?rev=283031&view=rev Log: [lldb-mi] Fix prompt which can get inserted in the middle of program output in lldb-mi Summary: The code added in svn r264332 causes "(lldb) " to be printed in the middle of program console output. This fix restores the behavior for non-Windows platforms to before the patch. Reviewers: ted, zturner, clayborg Subscribers: amccarth, lldb-commits Differential Revision: http://reviews.llvm.org/D25137 Modified: lldb/trunk/source/Core/IOHandler.cpp Modified: lldb/trunk/source/Core/IOHandler.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/IOHandler.cpp?rev=283031&r1=283030&r2=283031&view=diff == --- lldb/trunk/source/Core/IOHandler.cpp (original) +++ lldb/trunk/source/Core/IOHandler.cpp Sat Oct 1 05:37:56 2016 @@ -590,8 +590,8 @@ void IOHandlerEditline::PrintAsync(Strea else #endif { -const char *prompt = GetPrompt(); #ifdef _MSC_VER +const char *prompt = GetPrompt(); if (prompt) { // Back up over previous prompt using Windows API CONSOLE_SCREEN_BUFFER_INFO screen_buffer_info; @@ -605,9 +605,11 @@ void IOHandlerEditline::PrintAsync(Strea } #endif IOHandler::PrintAsync(stream, s, len); +#ifdef _MSC_VER if (prompt) IOHandler::PrintAsync(GetOutputStreamFile().get(), prompt, strlen(prompt)); +#endif } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r255439 - Fix scope-based lookup when more than one function is found.
Author: dperchik Date: Sat Dec 12 13:31:41 2015 New Revision: 255439 URL: http://llvm.org/viewvc/llvm-project?rev=255439&view=rev Log: Fix scope-based lookup when more than one function is found. When multiple functions are found by name, lldb removes duplicate entries of functions with the same type, so the first function in the symbol context list is chosen, even if it isn't in scope. This patch uses the declaration context of the execution context to select the function which is in scope. This fixes cases like the following: int func(); namespace ns { int func(); void here() { // Run to BP here and eval 'p func()'; // lldb used to find ::func(), now finds ns::func(). } } Reviewed by: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D15312 Added: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace/ns.cpp lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace/ns.h lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace/ns2.cpp lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace/ns3.cpp Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace/Makefile lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace/main.cpp lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp lldb/trunk/source/Symbol/ClangASTContext.cpp Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=255439&r1=255438&r2=255439&view=diff == --- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original) +++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Sat Dec 12 13:31:41 2015 @@ -944,6 +944,15 @@ public: CompilerType GetTypeForFormatters (void* type) override; +#define LLDB_INVALID_DECL_LEVELUINT32_MAX +// LLDB_INVALID_DECL_LEVEL is returned by CountDeclLevels if +// child_decl_ctx could not be found in decl_ctx. +uint32_t +CountDeclLevels (clang::DeclContext *frame_decl_ctx, + clang::DeclContext *child_decl_ctx, + ConstString *child_name = nullptr, + CompilerType *child_type = nullptr); + //-- // Modifying RecordType //-- Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace/Makefile?rev=255439&r1=255438&r2=255439&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace/Makefile (original) +++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace/Makefile Sat Dec 12 13:31:41 2015 @@ -1,5 +1,5 @@ LEVEL = ../../../make -CXX_SOURCES := main.cpp +CXX_SOURCES := main.cpp ns.cpp ns2.cpp ns3.cpp include $(LEVEL)/Makefile.rules Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace/main.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace/main.cpp?rev=255439&r1=255438&r2=255439&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace/main.cpp (original) +++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace/main.cpp Sat Dec 12 13:31:41 2015 @@ -8,6 +8,7 @@ //===--===// #include +#include "ns.h" namespace { typedef unsigned int my_uint_t; @@ -80,7 +81,6 @@ namespace ns2 { int value = 200; } -#include void test_namespace_scopes() { do { using namespace ns1; @@ -113,5 +113,12 @@ int Foo::myfunc(int a) int main (int argc, char const *argv[]) { +test_lookup_at_global_scope(); +test_lookup_at_file_scope(); +A::test_lookup_at_ns_scope(); +A::B::test_lookup_at_nested_ns_scope(); +A::B::test_lookup_at_nested_ns_scope_after_using(); +test_lookup_before_using_directive(); +test_lookup_after_using_directive(); return Foo::myfunc(12); } Added: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace/ns.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace/ns.cpp?rev=255439&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace/ns.cpp (added) +++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace/ns.cpp Sat Dec 12 13:31:41 2015 @@ -0,0 +1,32 @@ +//===-- ns.cpp ---
[Lldb-commits] [lldb] r255440 - Test case for "Fix scope-based lookup when more than one function is found."
Author: dperchik Date: Sat Dec 12 14:44:08 2015 New Revision: 255440 URL: http://llvm.org/viewvc/llvm-project?rev=255440&view=rev Log: Test case for "Fix scope-based lookup when more than one function is found." Missed commit in r255439. Differential Revision: http://reviews.llvm.org/D15312 Added: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace/TestNamespaceLookup.py Added: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace/TestNamespaceLookup.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace/TestNamespaceLookup.py?rev=255440&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace/TestNamespaceLookup.py (added) +++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace/TestNamespaceLookup.py Sat Dec 12 14:44:08 2015 @@ -0,0 +1,216 @@ +""" +Test the printing of anonymous and named namespace variables. +""" + +from __future__ import print_function + + +import os, time +import lldb +from lldbsuite.test.lldbtest import * +import lldbsuite.test.lldbutil as lldbutil + +class NamespaceLookupTestCase(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +def setUp(self): +# Call super's setUp(). +TestBase.setUp(self) +# Break inside different scopes and evaluate value +self.line_break_global_scope = line_number('ns.cpp', '// BP_global_scope') +self.line_break_file_scope = line_number('ns2.cpp', '// BP_file_scope') +self.line_break_ns_scope = line_number('ns2.cpp', '// BP_ns_scope') +self.line_break_nested_ns_scope = line_number('ns2.cpp', '// BP_nested_ns_scope') +self.line_break_nested_ns_scope_after_using = line_number('ns2.cpp', '// BP_nested_ns_scope_after_using') +self.line_break_before_using_directive = line_number('ns3.cpp', '// BP_before_using_directive') +self.line_break_after_using_directive = line_number('ns3.cpp', '// BP_after_using_directive') + +def runToBkpt(self, command): +self.runCmd(command, RUN_SUCCEEDED) +# The stop reason of the thread should be breakpoint. +self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, +substrs = ['stopped', + 'stop reason = breakpoint']) + +def test_scope_lookup_with_run_command(self): +"""Test scope lookup of functions in lldb.""" +self.build() +self.runCmd("file a.out", CURRENT_EXECUTABLE_SET) + +lldbutil.run_break_set_by_file_and_line (self, "ns.cpp", self.line_break_global_scope, num_expected_locations=1, loc_exact=False) +lldbutil.run_break_set_by_file_and_line (self, "ns2.cpp", self.line_break_ns_scope, num_expected_locations=1, loc_exact=False) +lldbutil.run_break_set_by_file_and_line (self, "ns2.cpp", self.line_break_nested_ns_scope, num_expected_locations=1, loc_exact=False) +lldbutil.run_break_set_by_file_and_line (self, "ns2.cpp", self.line_break_nested_ns_scope_after_using, num_expected_locations=1, loc_exact=False) +lldbutil.run_break_set_by_file_and_line (self, "ns3.cpp", self.line_break_before_using_directive, num_expected_locations=1, loc_exact=False) +lldbutil.run_break_set_by_file_and_line (self, "ns3.cpp", self.line_break_after_using_directive, num_expected_locations=1, loc_exact=False) + +# Run to BP_global_scope at global scope +self.runToBkpt("run") +# Evaluate func() - should call ::func() +self.expect("expr -- func()", startstr = "(int) $0 = 1") +# Evaluate A::B::func() - should call A::B::func() +self.expect("expr -- A::B::func()", startstr = "(int) $1 = 4") +# Evaluate func(10) - should call ::func(int) +self.expect("expr -- func(10)", startstr = "(int) $2 = 11") +# Evaluate ::func() - should call A::func() +self.expect("expr -- ::func()", startstr = "(int) $3 = 1") +# Evaluate A::foo() - should call A::foo() +self.expect("expr -- A::foo()", startstr = "(int) $4 = 42") + +# Continue to BP_ns_scope at ns scope +self.runToBkpt("continue") +# Evaluate func(10) - should call A::func(int) +self.expect("expr -- func(10)", startstr = "(int) $5 = 13") +# Evaluate B::func() - should call B::func() +self.expect("expr -- B::func()", startstr = "(int) $6 = 4") +# Evaluate func() - should call A::func() +self.expect("expr -- func()", startstr = "(int) $7 = 3") + +# Continue to BP_nested_ns_scope at nested ns scope +self.runToBkpt("continue") +# Evaluate func() - should call A::B::func() +self.expect("expr -- func()", startstr = "(int) $8 = 4") +# Evaluate A::func() - should call A::func() +self.expect("expr -- A::func()", startstr = "(int) $9 = 3") + +# Evaluate func(10) - should call A::func(10) +# NO
Re: [Lldb-commits] [PATCH] D15326: Rework breakpoint language filtering to use the symbol context's language.
dawn updated this revision to Diff 42911. dawn added a comment. Updated patch which changes Mangled::GuessLanguage to use the same algorithm for detecting the language from the mangled name as was added to LanguageRuntime::GuessLanguageForSymbolByName. Jim, sorry for the previous ping - I missed your comment which included your objections. Hopefully the patch is acceptable now? Repository: rL LLVM http://reviews.llvm.org/D15326 Files: include/lldb/Symbol/SymbolContext.h include/lldb/Target/Language.h include/lldb/Target/LanguageRuntime.h source/Breakpoint/BreakpointResolverName.cpp source/Core/Mangled.cpp source/Symbol/SymbolContext.cpp source/Target/Language.cpp source/Target/LanguageRuntime.cpp Index: source/Target/LanguageRuntime.cpp === --- source/Target/LanguageRuntime.cpp +++ source/Target/LanguageRuntime.cpp @@ -345,28 +345,3 @@ { return m_process->GetTarget().GetSearchFilterForModule(NULL); } - -lldb::LanguageType -LanguageRuntime::GuessLanguageForSymbolByName (Target &target, const char *symbol_name) -{ -// We "guess" the language because we can't determine a symbol's language from it's name. -// For example, a Pascal symbol can be mangled using the C++ Itanium scheme, and defined -// in a compilation unit within the same module as other C++ units. -// -// In addition, different targets could have different ways of mangling names from a given -// language, likewise compilation units within those targets. It would help to be able to -// ask the various LanguageRuntime plugin instances for this target to recognize the name, -// but right now the plugin instances depend on the process, not the target. That is -// unfortunate, because to use this for filtering breakpoints by language, we need to know -// the "language for symbol-name" prior to running. So we'd have to make a -// "LanguageRuntimeTarget" and "LanguageRuntimeProcess", and direct the questions that don't -// need a running process to the former, and that do to the latter. -// -// That's more work than I want to do for this feature. -if (CPlusPlusLanguage::IsCPPMangledName (symbol_name)) -return eLanguageTypeC_plus_plus; -else if (ObjCLanguage::IsPossibleObjCMethodName (symbol_name)) -return eLanguageTypeObjC; -else -return eLanguageTypeUnknown; -} Index: source/Target/Language.cpp === --- source/Target/Language.cpp +++ source/Target/Language.cpp @@ -287,6 +287,57 @@ } } +LanguageType +Language::GetPrimaryLanguage (LanguageType language) +{ +switch (language) +{ +case eLanguageTypeC_plus_plus: +case eLanguageTypeC_plus_plus_03: +case eLanguageTypeC_plus_plus_11: +case eLanguageTypeC_plus_plus_14: +return eLanguageTypeC_plus_plus; +case eLanguageTypeC: +case eLanguageTypeC89: +case eLanguageTypeC99: +case eLanguageTypeC11: +return eLanguageTypeC; +case eLanguageTypeObjC: +case eLanguageTypeObjC_plus_plus: +return eLanguageTypeObjC; +case eLanguageTypePascal83: +case eLanguageTypeCobol74: +case eLanguageTypeCobol85: +case eLanguageTypeFortran77: +case eLanguageTypeFortran90: +case eLanguageTypeFortran95: +case eLanguageTypeFortran03: +case eLanguageTypeFortran08: +case eLanguageTypeAda83: +case eLanguageTypeAda95: +case eLanguageTypeModula2: +case eLanguageTypeJava: +case eLanguageTypePLI: +case eLanguageTypeUPC: +case eLanguageTypeD: +case eLanguageTypePython: +case eLanguageTypeOpenCL: +case eLanguageTypeGo: +case eLanguageTypeModula3: +case eLanguageTypeHaskell: +case eLanguageTypeOCaml: +case eLanguageTypeRust: +case eLanguageTypeSwift: +case eLanguageTypeJulia: +case eLanguageTypeDylan: +case eLanguageTypeMipsAssembler: +case eLanguageTypeExtRenderScript: +case eLanguageTypeUnknown: +default: +return language; +} +} + void Language::GetLanguagesSupportingTypeSystems (std::set &languages, std::set &languages_for_expressions) Index: source/Symbol/SymbolContext.cpp === --- source/Symbol/SymbolContext.cpp +++ source/Symbol/SymbolContext.cpp @@ -525,6 +525,38 @@ return false; } +LanguageType +SymbolContext::GetLanguage () const +{ +LanguageType lang; +if (function && +(lang = function->GetLanguage()) != eLanguageTypeUnknown) +{ +return lang; +} +else if (variable && + (lang = variable->GetLanguage()) != eLanguageTypeUnknown) +{ +return l
[Lldb-commits] [lldb] r255808 - Rework breakpoint language filtering to use the symbol context's language.
Author: dperchik Date: Wed Dec 16 13:40:00 2015 New Revision: 255808 URL: http://llvm.org/viewvc/llvm-project?rev=255808&view=rev Log: Rework breakpoint language filtering to use the symbol context's language. This patch reworks the breakpoint filter-by-language patch to use the symbol context instead of trying to guess the language solely from the symbol's name. This has the advantage that symbols compiled with debug info will have their actual language known. Symbols without debug info will still do the same "guess"ing because Symbol::GetLanguage() is implemented using Mangled::GuessLanguage(). The recognition of ObjC names was merged into Mangled::GuessLanguage. Reviewed by: jingham, clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D15326 Modified: lldb/trunk/include/lldb/Symbol/SymbolContext.h lldb/trunk/include/lldb/Target/Language.h lldb/trunk/include/lldb/Target/LanguageRuntime.h lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp lldb/trunk/source/Core/Mangled.cpp lldb/trunk/source/Symbol/SymbolContext.cpp lldb/trunk/source/Target/Language.cpp lldb/trunk/source/Target/LanguageRuntime.cpp Modified: lldb/trunk/include/lldb/Symbol/SymbolContext.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolContext.h?rev=255808&r1=255807&r2=255808&view=diff == --- lldb/trunk/include/lldb/Symbol/SymbolContext.h (original) +++ lldb/trunk/include/lldb/Symbol/SymbolContext.h Wed Dec 16 13:40:00 2015 @@ -253,6 +253,9 @@ public: uint32_t GetResolvedMask () const; +lldb::LanguageType +GetLanguage () const; + //-- /// Find a block that defines the function represented by this /// symbol context. Modified: lldb/trunk/include/lldb/Target/Language.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Language.h?rev=255808&r1=255807&r2=255808&view=diff == --- lldb/trunk/include/lldb/Target/Language.h (original) +++ lldb/trunk/include/lldb/Target/Language.h Wed Dec 16 13:40:00 2015 @@ -173,6 +173,10 @@ public: static bool LanguageIsPascal (lldb::LanguageType language); +// return the primary language, so if LanguageIsC(l), return eLanguageTypeC, etc. +static lldb::LanguageType +GetPrimaryLanguage (lldb::LanguageType language); + static void GetLanguagesSupportingTypeSystems (std::set &languages, std::set &languages_for_expressions); Modified: lldb/trunk/include/lldb/Target/LanguageRuntime.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/LanguageRuntime.h?rev=255808&r1=255807&r2=255808&view=diff == --- lldb/trunk/include/lldb/Target/LanguageRuntime.h (original) +++ lldb/trunk/include/lldb/Target/LanguageRuntime.h Wed Dec 16 13:40:00 2015 @@ -117,9 +117,6 @@ public: return m_process; } -static lldb::LanguageType -GuessLanguageForSymbolByName (Target &target, const char *symbol_name); - Target& GetTargetRef() { Modified: lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp?rev=255808&r1=255807&r2=255808&view=diff == --- lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp Wed Dec 16 13:40:00 2015 @@ -21,7 +21,6 @@ #include "lldb/Symbol/Function.h" #include "lldb/Symbol/Symbol.h" #include "lldb/Symbol/SymbolContext.h" -#include "lldb/Target/LanguageRuntime.h" #include "Plugins/Language/ObjC/ObjCLanguage.h" using namespace lldb; @@ -259,8 +258,6 @@ BreakpointResolverName::SearchCallback(S // If the filter specifies a Compilation Unit, remove the ones that don't pass at this point. if (filter_by_cu || filter_by_language) { -Target &target = m_breakpoint->GetTarget(); - uint32_t num_functions = func_list.GetSize(); for (size_t idx = 0; idx < num_functions; idx++) @@ -276,32 +273,12 @@ BreakpointResolverName::SearchCallback(S if (filter_by_language) { -const char *name = sc.GetFunctionName(Mangled::ePreferMangled).AsCString(); -if (name) +LanguageType sym_language = sc.GetLanguage(); +if ((Language::GetPrimaryLanguage(sym_language) != + Language::GetPrimaryLanguage(m_language)) && +(sym_language != eLanguageTypeUnknown)) { -LanguageType sym_langua
Re: [Lldb-commits] [PATCH] D12809: Better scheme to lookup alternate mangled name when looking up function address.
dawn added a comment. Can a "code owner" please review this patch? Thanks, -Dawn http://reviews.llvm.org/D12809 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D15593: Add "target modules dump line-entries " command and use it to fix MI's -symbol-list-lines.
dawn created this revision. dawn added reviewers: clayborg, ki.stfu, abidh. dawn added a subscriber: lldb-commits. dawn set the repository for this revision to rL LLVM. This adds support for the new command: target modules dump line-entries which dumps the line entries found for 'file' for all CUs in all modules. This command is used to fix the MI command: -symbol-list-lines which didn't work for header files because it called: target modules dump line-table which only dumps line tables for a compilation unit. Repository: rL LLVM http://reviews.llvm.org/D15593 Files: packages/Python/lldbsuite/test/tools/lldb-mi/symbol/TestMiSymbol.py packages/Python/lldbsuite/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test.h source/Commands/CommandObjectTarget.cpp tools/lldb-mi/MICmdCmdSymbol.cpp Index: tools/lldb-mi/MICmdCmdSymbol.cpp === --- tools/lldb-mi/MICmdCmdSymbol.cpp +++ tools/lldb-mi/MICmdCmdSymbol.cpp @@ -82,11 +82,7 @@ CMICMDBASE_GETOPTION(pArgFile, File, m_constStrArgNameFile); const CMIUtilString &strFilePath(pArgFile->GetValue()); -// FIXME: this won't work for header files! To try and use existing -// commands to get this to work for header files would be too slow. -// Instead, this code should be rewritten to use APIs and/or support -// should be added to lldb which would work for header files. -const CMIUtilString strCmd(CMIUtilString::Format("target modules dump line-table \"%s\"", strFilePath.AddSlashes().c_str())); +const CMIUtilString strCmd(CMIUtilString::Format("target modules dump line-entries \"%s\"", strFilePath.AddSlashes().c_str())); CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance()); const lldb::ReturnStatus rtn = rSessionInfo.GetDebugger().GetCommandInterpreter().HandleCommand(strCmd.c_str(), m_lldbResult); @@ -110,10 +106,10 @@ { // Match LineEntry using regex. static MIUtilParse::CRegexParser g_lineentry_header_regex( -"^ *Line table for (.+) in `(.+)$"); -// ^1=file ^2=module +"^ *Lines for file (.+) in compilation unit (.+) in `(.+)$"); +// ^1=file ^2=cu^3=module -MIUtilParse::CRegexParser::Match match(3); +MIUtilParse::CRegexParser::Match match(4); const bool ok = g_lineentry_header_regex.Execute(input, match); if (ok) @@ -146,12 +142,12 @@ // Match LineEntry using regex. static MIUtilParse::CRegexParser g_lineentry_nocol_regex( -"^ *(0x[0-9a-fA-F]+): (.+):([0-9]+)$"); +"^ *\\[(0x[0-9a-fA-F]+)-(0x[0-9a-fA-F]+)\\): (.+):([0-9]+)$"); static MIUtilParse::CRegexParser g_lineentry_col_regex( -"^ *(0x[0-9a-fA-F]+): (.+):([0-9]+):[0-9]+$"); -// ^1=addr ^2=f ^3=line ^4=:col(opt) +"^ *\\[(0x[0-9a-fA-F]+)-(0x[0-9a-fA-F]+)\\): (.+):([0-9]+):[0-9]+$"); +// ^1=start ^2=end ^3=f ^4=line ^5=:col(opt) -MIUtilParse::CRegexParser::Match match(5); +MIUtilParse::CRegexParser::Match match(6); // First try matching the LineEntry with the column, // then try without the column. @@ -160,8 +156,8 @@ if (ok) { addr = match.GetMatchAtIndex(1); -file = match.GetMatchAtIndex(2); -line = match.GetMatchAtIndex(3); +file = match.GetMatchAtIndex(3); +line = match.GetMatchAtIndex(4); } return ok; } @@ -222,10 +218,6 @@ if (!ParseLLDBLineAddressEntry(rLine.c_str(), strAddr, strFile, strLine)) continue; -// Skip entries which don't match the desired source. -if (strWantFile != strFile) -continue; - const CMICmnMIValueConst miValueConst(strAddr); const CMICmnMIValueResult miValueResult("pc", miValueConst); CMICmnMIValueTuple miValueTuple(miValueResult); Index: source/Commands/CommandObjectTarget.cpp === --- source/Commands/CommandObjectTarget.cpp +++ source/Commands/CommandObjectTarget.cpp @@ -1524,6 +1524,91 @@ return num_matches; } +static uint32_t +DumpFileLineEntries (CommandInterpreter &interpreter, + Stream &strm, + Module *module, + const FileSpec &file_spec, + bool load_addresses) +{ +uint32_t num_matches = 0; +if (module) +{ +// Look through all the compilation units (CUs) for ones that contain +// lines of code from this source file. +assert(file_spec.GetFilename().AsCString()); +bool has_path = (file_spec.GetDirectory().AsCString() != 0); +int ncus = module->GetNumCompileUnits(); +for (int i = 0; i < ncus; i++) +{ +// Look for a matching source file in this CU. +CompUnitSP cu_sp(modul
Re: [Lldb-commits] [PATCH] D15593: Add "target modules dump line-entries " command and use it to fix MI's -symbol-list-lines.
dawn updated this revision to Diff 43076. dawn added a comment. Updated patch to include changes to TestHelp.py. Repository: rL LLVM http://reviews.llvm.org/D15593 Files: packages/Python/lldbsuite/test/help/TestHelp.py packages/Python/lldbsuite/test/tools/lldb-mi/symbol/TestMiSymbol.py packages/Python/lldbsuite/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test.h source/Commands/CommandObjectTarget.cpp tools/lldb-mi/MICmdCmdSymbol.cpp Index: tools/lldb-mi/MICmdCmdSymbol.cpp === --- tools/lldb-mi/MICmdCmdSymbol.cpp +++ tools/lldb-mi/MICmdCmdSymbol.cpp @@ -82,11 +82,7 @@ CMICMDBASE_GETOPTION(pArgFile, File, m_constStrArgNameFile); const CMIUtilString &strFilePath(pArgFile->GetValue()); -// FIXME: this won't work for header files! To try and use existing -// commands to get this to work for header files would be too slow. -// Instead, this code should be rewritten to use APIs and/or support -// should be added to lldb which would work for header files. -const CMIUtilString strCmd(CMIUtilString::Format("target modules dump line-table \"%s\"", strFilePath.AddSlashes().c_str())); +const CMIUtilString strCmd(CMIUtilString::Format("target modules dump line-entries \"%s\"", strFilePath.AddSlashes().c_str())); CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance()); const lldb::ReturnStatus rtn = rSessionInfo.GetDebugger().GetCommandInterpreter().HandleCommand(strCmd.c_str(), m_lldbResult); @@ -110,10 +106,10 @@ { // Match LineEntry using regex. static MIUtilParse::CRegexParser g_lineentry_header_regex( -"^ *Line table for (.+) in `(.+)$"); -// ^1=file ^2=module +"^ *Lines for file (.+) in compilation unit (.+) in `(.+)$"); +// ^1=file ^2=cu^3=module -MIUtilParse::CRegexParser::Match match(3); +MIUtilParse::CRegexParser::Match match(4); const bool ok = g_lineentry_header_regex.Execute(input, match); if (ok) @@ -146,12 +142,12 @@ // Match LineEntry using regex. static MIUtilParse::CRegexParser g_lineentry_nocol_regex( -"^ *(0x[0-9a-fA-F]+): (.+):([0-9]+)$"); +"^ *\\[(0x[0-9a-fA-F]+)-(0x[0-9a-fA-F]+)\\): (.+):([0-9]+)$"); static MIUtilParse::CRegexParser g_lineentry_col_regex( -"^ *(0x[0-9a-fA-F]+): (.+):([0-9]+):[0-9]+$"); -// ^1=addr ^2=f ^3=line ^4=:col(opt) +"^ *\\[(0x[0-9a-fA-F]+)-(0x[0-9a-fA-F]+)\\): (.+):([0-9]+):[0-9]+$"); +// ^1=start ^2=end ^3=f ^4=line ^5=:col(opt) -MIUtilParse::CRegexParser::Match match(5); +MIUtilParse::CRegexParser::Match match(6); // First try matching the LineEntry with the column, // then try without the column. @@ -160,8 +156,8 @@ if (ok) { addr = match.GetMatchAtIndex(1); -file = match.GetMatchAtIndex(2); -line = match.GetMatchAtIndex(3); +file = match.GetMatchAtIndex(3); +line = match.GetMatchAtIndex(4); } return ok; } @@ -222,10 +218,6 @@ if (!ParseLLDBLineAddressEntry(rLine.c_str(), strAddr, strFile, strLine)) continue; -// Skip entries which don't match the desired source. -if (strWantFile != strFile) -continue; - const CMICmnMIValueConst miValueConst(strAddr); const CMICmnMIValueResult miValueResult("pc", miValueConst); CMICmnMIValueTuple miValueTuple(miValueResult); Index: source/Commands/CommandObjectTarget.cpp === --- source/Commands/CommandObjectTarget.cpp +++ source/Commands/CommandObjectTarget.cpp @@ -1524,6 +1524,91 @@ return num_matches; } +static uint32_t +DumpFileLineEntries (CommandInterpreter &interpreter, + Stream &strm, + Module *module, + const FileSpec &file_spec, + bool load_addresses) +{ +uint32_t num_matches = 0; +if (module) +{ +// Look through all the compilation units (CUs) for ones that contain +// lines of code from this source file. +assert(file_spec.GetFilename().AsCString()); +bool has_path = (file_spec.GetDirectory().AsCString() != 0); +int ncus = module->GetNumCompileUnits(); +for (int i = 0; i < ncus; i++) +{ +// Look for a matching source file in this CU. +CompUnitSP cu_sp(module->GetCompileUnitAtIndex(i)); +if (!cu_sp) +continue; +CompileUnit *cu = cu_sp.get(); +const FileSpecList &cu_file_list = cu->GetSupportFiles(); +size_t file_idx = cu_file_list.FindFileIndex(0, file_spec, has_path); +if (file_idx == UINT32_MAX) +// No such file in this CU. +
Re: [Lldb-commits] [PATCH] D15593: Add "target modules dump line-entries " command and use it to fix MI's -symbol-list-lines.
dawn added a comment. In http://reviews.llvm.org/D15593#312571, @jingham wrote: > I don't think this is sufficiently different from "target modules dump > line-tables" to warrant a separate command. This seems more like a candidate > for a flag to "target modules dump line-tables" like --search-for-inlines or > something. That would keep the command surface more manageable and also make > the option more discoverable, since you can get both variants in one place. I first thought about adding it as an option to the line-table but decided against it because the information provided by each are just too different. Dumping the tables gives you raw output from the CU's DWARF .debug_line entries, including end sequences, all files in the compilation unit, etc.: (lldb) target modules du line-table x.cpp Line table for /Users/dawn/tmp/x.cpp in `x 0x00010aa0: /Users/dawn/tmp/x.cpp:12 0x00010ab6: /Users/dawn/tmp/x.cpp:14 0x00010af2: /Users/dawn/tmp/x.cpp:16 0x00010afa: /Users/dawn/tmp/x.cpp:17 [...] 0x00010cc0: /Users/dawn/tmp/x.cpp:6 0x00010ccb: /Users/dawn/tmp/x.cpp:8 [...] 0x00010d20: /Users/dawn/tmp/./x.h:10 0x00010d2c: /Users/dawn/tmp/./x.h:10 0x00010d3b: /Users/dawn/tmp/./x.h:10 Whereas dumping the line entries gives you entries after they've been interpreted and sorted by lldb, and will not include any files other than the one(s) asked for: (lldb) target modules du line-entries x.h Lines for file x.h in compilation unit x.cpp in `x [0x00010d00-0x00010d10): /Users/dawn/tmp/./x.h:10 [0x00010d10-0x00010d1b): /Users/dawn/tmp/./x.h:10 [0x00010d20-0x00010d2c): /Users/dawn/tmp/./x.h:10 [0x00010d2c-0x00010d3b): /Users/dawn/tmp/./x.h:10 (lldb) target modules du line-entries x.cpp Lines for file x.cpp in compilation unit x.cpp in `x [0x00010cc0-0x00010ccb): /Users/dawn/tmp/x.cpp:6 [0x00010ccb-0x00010cdd): /Users/dawn/tmp/x.cpp:8 [0x00010cdd-0x00010cf1): /Users/dawn/tmp/x.cpp:9 [0x00010aa0-0x00010ab6): /Users/dawn/tmp/x.cpp:12 [0x00010ab6-0x00010af2): /Users/dawn/tmp/x.cpp:14 [...] I'm fine with combining the two if we can find an interface that makes sense. 'line-table' is not appropriate for the new command, and '\-\-search\-for\-inlines' doesn't convey the differences. We could change 'line-table' to 'lines', but then what? Repository: rL LLVM http://reviews.llvm.org/D15593 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15593: Add "target modules dump line-entries " command and use it to fix MI's -symbol-list-lines.
dawn added a comment. In http://reviews.llvm.org/D15593#312665, @jingham wrote: > So it seems like your change is adding three flags > > --compile-unit-only --only-explicit-matches --show-raw > > or something. The current behavior is: > > --compile-unit-only true --only-explicit-matches false --show-raw true > > and your command does: > > --compile-unit-only false --only-explicit-matches true --show-raw false > > Does that seem right. Yup. > If so, then we have to decide whether it is worth the effort to be able to > tweak these three independently. I think these flags only make sense if you could tweak them independently, but to support something like: --compile-unit-only false --only-explicit-matches true --show-raw *true* would be a major pain - it would mean adding a lot of extra code and interfaces for something that would only be used by this one command. I think it's better to just have both: target modules line-tables target modules line-entries and if we find a need for any other combinations of the options you proposed, we can merge them at that time. Thoughts? Repository: rL LLVM http://reviews.llvm.org/D15593 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15593: Add "target modules dump line-entries " command and use it to fix MI's -symbol-list-lines.
dawn added a comment. I'm only going to support the combinations: --compile-unit-only true --only-explicit-matches false --show-raw true --compile-unit-only false --only-explicit-matches true --show-raw false OK? Repository: rL LLVM http://reviews.llvm.org/D15593 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15593: Enhance "target modules dump line " and use it to fix MI's -symbol-list-lines.
dawn retitled this revision from "Add "target modules dump line-entries " command and use it to fix MI's -symbol-list-lines." to "Enhance "target modules dump line " and use it to fix MI's -symbol-list-lines.". dawn updated the summary for this revision. dawn updated this revision to Diff 43103. Repository: rL LLVM http://reviews.llvm.org/D15593 Files: packages/Python/lldbsuite/test/help/TestHelp.py packages/Python/lldbsuite/test/tools/lldb-mi/symbol/TestMiSymbol.py packages/Python/lldbsuite/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test.h source/Commands/CommandObjectTarget.cpp tools/lldb-mi/MICmdCmdSymbol.cpp Index: tools/lldb-mi/MICmdCmdSymbol.cpp === --- tools/lldb-mi/MICmdCmdSymbol.cpp +++ tools/lldb-mi/MICmdCmdSymbol.cpp @@ -82,11 +82,7 @@ CMICMDBASE_GETOPTION(pArgFile, File, m_constStrArgNameFile); const CMIUtilString &strFilePath(pArgFile->GetValue()); -// FIXME: this won't work for header files! To try and use existing -// commands to get this to work for header files would be too slow. -// Instead, this code should be rewritten to use APIs and/or support -// should be added to lldb which would work for header files. -const CMIUtilString strCmd(CMIUtilString::Format("target modules dump line-table \"%s\"", strFilePath.AddSlashes().c_str())); +const CMIUtilString strCmd(CMIUtilString::Format("target modules dump lines -u false -e true -r false \"%s\"", strFilePath.AddSlashes().c_str())); CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance()); const lldb::ReturnStatus rtn = rSessionInfo.GetDebugger().GetCommandInterpreter().HandleCommand(strCmd.c_str(), m_lldbResult); @@ -110,10 +106,10 @@ { // Match LineEntry using regex. static MIUtilParse::CRegexParser g_lineentry_header_regex( -"^ *Line table for (.+) in `(.+)$"); -// ^1=file ^2=module +"^ *Lines for file (.+) in compilation unit (.+) in `(.+)$"); +// ^1=file ^2=cu^3=module -MIUtilParse::CRegexParser::Match match(3); +MIUtilParse::CRegexParser::Match match(4); const bool ok = g_lineentry_header_regex.Execute(input, match); if (ok) @@ -146,12 +142,12 @@ // Match LineEntry using regex. static MIUtilParse::CRegexParser g_lineentry_nocol_regex( -"^ *(0x[0-9a-fA-F]+): (.+):([0-9]+)$"); +"^ *\\[(0x[0-9a-fA-F]+)-(0x[0-9a-fA-F]+)\\): (.+):([0-9]+)$"); static MIUtilParse::CRegexParser g_lineentry_col_regex( -"^ *(0x[0-9a-fA-F]+): (.+):([0-9]+):[0-9]+$"); -// ^1=addr ^2=f ^3=line ^4=:col(opt) +"^ *\\[(0x[0-9a-fA-F]+)-(0x[0-9a-fA-F]+)\\): (.+):([0-9]+):[0-9]+$"); +// ^1=start ^2=end ^3=f ^4=line ^5=:col(opt) -MIUtilParse::CRegexParser::Match match(5); +MIUtilParse::CRegexParser::Match match(6); // First try matching the LineEntry with the column, // then try without the column. @@ -160,8 +156,8 @@ if (ok) { addr = match.GetMatchAtIndex(1); -file = match.GetMatchAtIndex(2); -line = match.GetMatchAtIndex(3); +file = match.GetMatchAtIndex(3); +line = match.GetMatchAtIndex(4); } return ok; } @@ -222,10 +218,6 @@ if (!ParseLLDBLineAddressEntry(rLine.c_str(), strAddr, strFile, strLine)) continue; -// Skip entries which don't match the desired source. -if (strWantFile != strFile) -continue; - const CMICmnMIValueConst miValueConst(strAddr); const CMICmnMIValueResult miValueResult("pc", miValueConst); CMICmnMIValueTuple miValueTuple(miValueResult); Index: source/Commands/CommandObjectTarget.cpp === --- source/Commands/CommandObjectTarget.cpp +++ source/Commands/CommandObjectTarget.cpp @@ -1485,39 +1485,120 @@ } static uint32_t -DumpCompileUnitLineTable (CommandInterpreter &interpreter, - Stream &strm, - Module *module, - const FileSpec &file_spec, - bool load_addresses) +DumpFileLines (CommandInterpreter &interpreter, + Stream &strm, + Module *module, + const FileSpec &file_spec, + bool load_addresses, + bool compile_unit_only, + bool explicit_matches_only, + bool show_raw) { uint32_t num_matches = 0; if (module) { -SymbolContextList sc_list; -num_matches = module->ResolveSymbolContextsForFileSpec (file_spec, -0, -false, -
Re: [Lldb-commits] [PATCH] D15593: Enhance "target modules dump line " and use it to fix MI's -symbol-list-lines.
dawn marked 6 inline comments as done. dawn added a comment. > clang-format your changes please (there are many deviations from the coding > style) I've made some fixes even though the code is no longer consistent with the rest of the file. Alas. I would love to run all of lldb through clang-format, but as we've seen, there are several options which still need to be added before we can do that (mostly relating to the formatting function declarations). Comment at: source/Commands/CommandObjectTarget.cpp:1510 @@ -1503,2 +1509,3 @@ -for (uint32_t i=0; i nit: fix indentation This is the original code, and is consistent with the coding style of the rest of the file. It bothers me too that lldb is so schizophrenic about its coding style, but unless we fix all of lldb, I think it's best to just try and follow the style of the code around you. Does anyone else have an opinion about this? I'll go ahead and change it, only because I see I that the new code I added didn't follow this style (oops). Comment at: source/Commands/CommandObjectTarget.cpp:1541-1542 @@ +1540,4 @@ +CompUnitSP cu_sp(module->GetCompileUnitAtIndex(i)); +if (!cu_sp) +continue; +CompileUnit *cu = cu_sp.get(); ki.stfu wrote: > Isn't it always false? Code elsewhere checks for it, so I assume there are cases when cu_sp can be null. Example in source/Core/SearchFilter.cpp: for (size_t i = 0; i < num_comp_units; i++) { CompUnitSP cu_sp (module_sp->GetCompileUnitAtIndex (i)); if (cu_sp) { Better safe than sorry. Comment at: source/Commands/CommandObjectTarget.cpp:1543 @@ +1542,3 @@ +continue; +CompileUnit *cu = cu_sp.get(); +const FileSpecList &cu_file_list = cu->GetSupportFiles(); ki.stfu wrote: > You don't need a raw pointer here, just use cu_sp.get() on line #1587 There are 5 uses of cu in this code, so I think it's cleaner to have a variable. Comment at: source/Commands/CommandObjectTarget.cpp:1594-1596 @@ +1593,5 @@ +// Anymore after this one? +start_idx++; +start_idx = cu->FindLineEntry(start_idx, line, &cu_file_spec, + /*exact=*/true, &line_entry); +} while (start_idx != UINT32_MAX); ki.stfu wrote: > combine it together: > ``` > cu->FindLineEntry(start_idx + 1, ...) > ``` I'd love to have a guideline as to when to wrap lines - lldb is all over the place about this. I've tended to try to keep lines to 100. Repository: rL LLVM http://reviews.llvm.org/D15593 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15593: Enhance "target modules dump line " and use it to fix MI's -symbol-list-lines.
dawn updated this revision to Diff 43152. dawn marked an inline comment as done. dawn added a comment. Updated patch with suggestions from Ilia's review (thanks Ilia!). Repository: rL LLVM http://reviews.llvm.org/D15593 Files: packages/Python/lldbsuite/test/help/TestHelp.py packages/Python/lldbsuite/test/tools/lldb-mi/symbol/TestMiSymbol.py packages/Python/lldbsuite/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test.h source/Commands/CommandObjectTarget.cpp tools/lldb-mi/MICmdCmdSymbol.cpp Index: tools/lldb-mi/MICmdCmdSymbol.cpp === --- tools/lldb-mi/MICmdCmdSymbol.cpp +++ tools/lldb-mi/MICmdCmdSymbol.cpp @@ -82,11 +82,7 @@ CMICMDBASE_GETOPTION(pArgFile, File, m_constStrArgNameFile); const CMIUtilString &strFilePath(pArgFile->GetValue()); -// FIXME: this won't work for header files! To try and use existing -// commands to get this to work for header files would be too slow. -// Instead, this code should be rewritten to use APIs and/or support -// should be added to lldb which would work for header files. -const CMIUtilString strCmd(CMIUtilString::Format("target modules dump line-table \"%s\"", strFilePath.AddSlashes().c_str())); +const CMIUtilString strCmd(CMIUtilString::Format("target modules dump lines --compile-unit-only false --explicit-matches-only true --show-raw false \"%s\"", strFilePath.AddSlashes().c_str())); CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance()); const lldb::ReturnStatus rtn = rSessionInfo.GetDebugger().GetCommandInterpreter().HandleCommand(strCmd.c_str(), m_lldbResult); @@ -110,10 +106,10 @@ { // Match LineEntry using regex. static MIUtilParse::CRegexParser g_lineentry_header_regex( -"^ *Line table for (.+) in `(.+)$"); -// ^1=file ^2=module +"^ *Lines for file (.+) in compilation unit (.+) in `(.+)$"); +// ^1=file ^2=cu^3=module -MIUtilParse::CRegexParser::Match match(3); +MIUtilParse::CRegexParser::Match match(4); const bool ok = g_lineentry_header_regex.Execute(input, match); if (ok) @@ -146,12 +142,12 @@ // Match LineEntry using regex. static MIUtilParse::CRegexParser g_lineentry_nocol_regex( -"^ *(0x[0-9a-fA-F]+): (.+):([0-9]+)$"); +"^ *\\[(0x[0-9a-fA-F]+)-(0x[0-9a-fA-F]+)\\): (.+):([0-9]+)$"); static MIUtilParse::CRegexParser g_lineentry_col_regex( -"^ *(0x[0-9a-fA-F]+): (.+):([0-9]+):[0-9]+$"); -// ^1=addr ^2=f ^3=line ^4=:col(opt) +"^ *\\[(0x[0-9a-fA-F]+)-(0x[0-9a-fA-F]+)\\): (.+):([0-9]+):[0-9]+$"); +// ^1=start ^2=end ^3=f ^4=line ^5=:col(opt) -MIUtilParse::CRegexParser::Match match(5); +MIUtilParse::CRegexParser::Match match(6); // First try matching the LineEntry with the column, // then try without the column. @@ -160,8 +156,8 @@ if (ok) { addr = match.GetMatchAtIndex(1); -file = match.GetMatchAtIndex(2); -line = match.GetMatchAtIndex(3); +file = match.GetMatchAtIndex(3); +line = match.GetMatchAtIndex(4); } return ok; } @@ -222,10 +218,6 @@ if (!ParseLLDBLineAddressEntry(rLine.c_str(), strAddr, strFile, strLine)) continue; -// Skip entries which don't match the desired source. -if (strWantFile != strFile) -continue; - const CMICmnMIValueConst miValueConst(strAddr); const CMICmnMIValueResult miValueResult("pc", miValueConst); CMICmnMIValueTuple miValueTuple(miValueResult); Index: source/Commands/CommandObjectTarget.cpp === --- source/Commands/CommandObjectTarget.cpp +++ source/Commands/CommandObjectTarget.cpp @@ -1485,39 +1485,118 @@ } static uint32_t -DumpCompileUnitLineTable (CommandInterpreter &interpreter, - Stream &strm, - Module *module, - const FileSpec &file_spec, - bool load_addresses) +DumpFileLines (CommandInterpreter &interpreter, + Stream &strm, + Module *module, + const FileSpec &file_spec, + bool load_addresses, + bool compile_unit_only, + bool explicit_matches_only, + bool show_raw) { uint32_t num_matches = 0; if (module) { -SymbolContextList sc_list; -num_matches = module->ResolveSymbolContextsForFileSpec (file_spec, -0, -false, -eSymbolContextCompUnit, -
Re: [Lldb-commits] [PATCH] D15593: Enhance "target modules dump line " and use it to fix MI's -symbol-list-lines.
dawn added a comment. In http://reviews.llvm.org/D15593#313342, @clayborg wrote: > Dawn, if you don't understand what I asked you to do, Sorry for late reply - been recovering from minor surgery. I have a new patch, but I've not yet gone through all of Ilia's additional comments - will probably go ahead and upload anyway just to give you all a glimpse, as I fear there will be a few more rounds before this patch is ready. > As this already does exactly what you are doing. We will need to modify > CompileUnit::ResolveSymbolContext() to accept the "line" argument being zero. > It will return an "sc_list" of all matches, inside each symbol context will > be the LineEntry that you need. I didn't do this because I added support for additional options which were supported by 'source list', and needed access to the options during the loop which collects the lines. I hope you'll agree that this was the right approach after seeing the patch. Repository: rL LLVM http://reviews.llvm.org/D15593 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15593: Enhance "target modules dump line " and use it to fix MI's -symbol-list-lines.
dawn marked 4 inline comments as done. dawn added a comment. Replies to Ilia's comments... Comment at: source/Commands/CommandObjectTarget.cpp:1543 @@ +1542,3 @@ +continue; +CompileUnit *cu = cu_sp.get(); +const FileSpecList &cu_file_list = cu->GetSupportFiles(); ki.stfu wrote: > That's no problem. Just replace s/cu/cu_sp/ on lines #1544, #1565, #1580, > #1594, and then use cu_sp.get() on line #1586. this no longer applies to the most recent patch. Comment at: source/Commands/CommandObjectTarget.cpp:2689 @@ +2688,3 @@ +break; +} + ki.stfu wrote: > nit: you forgot the dot did I forget a dot? Comment at: tools/lldb-mi/MICmdCmdSymbol.cpp:226 @@ -225,3 @@ -// Skip entries which don't match the desired source. -if (strWantFile != strFile) -continue; ki.stfu wrote: > Is strWantFile needed? Seems it's an auxiliary variable. It's no longer needed with the new code, because you'll never get a file that isn't what was asked for. Repository: rL LLVM http://reviews.llvm.org/D15593 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15593: Add support for "source info" and use it to fix MI's -symbol-list-lines.
dawn retitled this revision from "Enhance "target modules dump line " and use it to fix MI's -symbol-list-lines." to "Add support for "source info" and use it to fix MI's -symbol-list-lines.". dawn updated the summary for this revision. dawn updated this revision to Diff 43429. dawn marked 2 inline comments as done. Repository: rL LLVM http://reviews.llvm.org/D15593 Files: packages/Python/lldbsuite/test/help/TestHelp.py packages/Python/lldbsuite/test/tools/lldb-mi/symbol/TestMiSymbol.py packages/Python/lldbsuite/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test.h source/Commands/CommandObjectSource.cpp source/Commands/CommandObjectTarget.cpp tools/lldb-mi/MICmdCmdSymbol.cpp Index: tools/lldb-mi/MICmdCmdSymbol.cpp === --- tools/lldb-mi/MICmdCmdSymbol.cpp +++ tools/lldb-mi/MICmdCmdSymbol.cpp @@ -82,11 +82,7 @@ CMICMDBASE_GETOPTION(pArgFile, File, m_constStrArgNameFile); const CMIUtilString &strFilePath(pArgFile->GetValue()); -// FIXME: this won't work for header files! To try and use existing -// commands to get this to work for header files would be too slow. -// Instead, this code should be rewritten to use APIs and/or support -// should be added to lldb which would work for header files. -const CMIUtilString strCmd(CMIUtilString::Format("target modules dump line-table \"%s\"", strFilePath.AddSlashes().c_str())); +const CMIUtilString strCmd(CMIUtilString::Format("source info --file \"%s\"", strFilePath.AddSlashes().c_str())); CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance()); const lldb::ReturnStatus rtn = rSessionInfo.GetDebugger().GetCommandInterpreter().HandleCommand(strCmd.c_str(), m_lldbResult); @@ -110,10 +106,10 @@ { // Match LineEntry using regex. static MIUtilParse::CRegexParser g_lineentry_header_regex( -"^ *Line table for (.+) in `(.+)$"); -// ^1=file ^2=module +"^ *Lines for file (.+) in compilation unit (.+) in `(.+)$"); +// ^1=file ^2=cu^3=module -MIUtilParse::CRegexParser::Match match(3); +MIUtilParse::CRegexParser::Match match(4); const bool ok = g_lineentry_header_regex.Execute(input, match); if (ok) @@ -146,12 +142,12 @@ // Match LineEntry using regex. static MIUtilParse::CRegexParser g_lineentry_nocol_regex( -"^ *(0x[0-9a-fA-F]+): (.+):([0-9]+)$"); +"^ *\\[(0x[0-9a-fA-F]+)-(0x[0-9a-fA-F]+)\\): (.+):([0-9]+)$"); static MIUtilParse::CRegexParser g_lineentry_col_regex( -"^ *(0x[0-9a-fA-F]+): (.+):([0-9]+):[0-9]+$"); -// ^1=addr ^2=f ^3=line ^4=:col(opt) +"^ *\\[(0x[0-9a-fA-F]+)-(0x[0-9a-fA-F]+)\\): (.+):([0-9]+):[0-9]+$"); +// ^1=start ^2=end ^3=f ^4=line ^5=:col(opt) -MIUtilParse::CRegexParser::Match match(5); +MIUtilParse::CRegexParser::Match match(6); // First try matching the LineEntry with the column, // then try without the column. @@ -160,8 +156,8 @@ if (ok) { addr = match.GetMatchAtIndex(1); -file = match.GetMatchAtIndex(2); -line = match.GetMatchAtIndex(3); +file = match.GetMatchAtIndex(3); +line = match.GetMatchAtIndex(4); } return ok; } @@ -222,10 +218,6 @@ if (!ParseLLDBLineAddressEntry(rLine.c_str(), strAddr, strFile, strLine)) continue; -// Skip entries which don't match the desired source. -if (strWantFile != strFile) -continue; - const CMICmnMIValueConst miValueConst(strAddr); const CMICmnMIValueResult miValueResult("pc", miValueConst); CMICmnMIValueTuple miValueTuple(miValueResult); Index: source/Commands/CommandObjectTarget.cpp === --- source/Commands/CommandObjectTarget.cpp +++ source/Commands/CommandObjectTarget.cpp @@ -2577,8 +2577,9 @@ if (command.GetArgumentCount() == 0) { -result.AppendErrorWithFormat ("\nSyntax: %s\n", m_cmd_syntax.c_str()); +result.AppendError ("file option must be specified."); result.SetStatus (eReturnStatusFailed); +return result.Succeeded(); } else { Index: source/Commands/CommandObjectSource.cpp === --- source/Commands/CommandObjectSource.cpp +++ source/Commands/CommandObjectSource.cpp @@ -27,6 +27,7 @@ #include "lldb/Symbol/Symbol.h" #include "lldb/Target/Process.h" #include "lldb/Target/SectionLoadList.h" +#include "lldb/Target/StackFrame.h" #include "lldb/Target/TargetList.h" #include "lldb/Interpreter/CommandCompletions.h" #include "lldb/Interpreter/Options.h" @@ -34,9 +35,11 @@ using namespace lldb; using namespace lldb_private; -