[Lldb-commits] [lldb] r256147 - Fix emulation of the thumb str instruction
Author: tberghammer Date: Mon Dec 21 06:06:36 2015 New Revision: 256147 URL: http://llvm.org/viewvc/llvm-project?rev=256147&view=rev Log: Fix emulation of the thumb str instruction Modified: lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp Modified: lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp?rev=256147&r1=256146&r2=256147&view=diff == --- lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp (original) +++ lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp Mon Dec 21 06:06:36 2015 @@ -4781,7 +4781,11 @@ EmulateInstructionARM::EmulateSTRThumb ( address = base_address; EmulateInstruction::Context context; -context.type = eContextRegisterStore; +if (n == 13) +context.type = eContextPushRegisterOnStack; +else +context.type = eContextRegisterStore; + RegisterInfo base_reg; GetRegisterInfo (eRegisterKindDWARF, dwarf_r0 + n, base_reg); @@ -4809,8 +4813,12 @@ EmulateInstructionARM::EmulateSTRThumb ( // if wback then R[n] = offset_addr; if (wback) { -context.type = eContextRegisterLoad; +if (n == 13) +context.type = eContextAdjustStackPointer; +else +context.type = eContextAdjustBaseRegister; context.SetAddress (offset_addr); + if (!WriteRegisterUnsigned (context, eRegisterKindDWARF, dwarf_r0 + n, offset_addr)) return false; } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D15684: Add note about the "thread until" command to the llvm-gdb cheatsheet.
jlebar created this revision. jlebar added a reviewer: brucem. jlebar added a subscriber: lldb-commits. http://reviews.llvm.org/D15684 Files: www/lldb-gdb.html Index: www/lldb-gdb.html === --- www/lldb-gdb.html +++ www/lldb-gdb.html @@ -307,6 +307,15 @@ Stop hook #1 added. +Run until we hit line 12 or control leaves the current function. + + +(gdb) until 12 + + +(lldb) thread until 12 + + Index: www/lldb-gdb.html === --- www/lldb-gdb.html +++ www/lldb-gdb.html @@ -307,6 +307,15 @@ Stop hook #1 added. +Run until we hit line 12 or control leaves the current function. + + +(gdb) until 12 + + +(lldb) thread until 12 + + ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r256212 - Reduce code duplication
Author: enrico Date: Mon Dec 21 17:10:17 2015 New Revision: 256212 URL: http://llvm.org/viewvc/llvm-project?rev=256212&view=rev Log: Reduce code duplication Modified: lldb/trunk/source/Core/ValueObject.cpp Modified: lldb/trunk/source/Core/ValueObject.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=256212&r1=256211&r2=256212&view=diff == --- lldb/trunk/source/Core/ValueObject.cpp (original) +++ lldb/trunk/source/Core/ValueObject.cpp Mon Dec 21 17:10:17 2015 @@ -601,40 +601,16 @@ ValueObjectSP ValueObject::GetChildAtIndexPath (const std::initializer_list& idxs, size_t* index_of_error) { -if (idxs.size() == 0) -return GetSP(); -ValueObjectSP root(GetSP()); -for (size_t idx : idxs) -{ -root = root->GetChildAtIndex(idx, true); -if (!root) -{ -if (index_of_error) -*index_of_error = idx; -return root; -} -} -return root; +return GetChildAtIndexPath( std::vector(idxs), + index_of_error ); } ValueObjectSP ValueObject::GetChildAtIndexPath (const std::initializer_list< std::pair >& idxs, size_t* index_of_error) { -if (idxs.size() == 0) -return GetSP(); -ValueObjectSP root(GetSP()); -for (std::pair idx : idxs) -{ -root = root->GetChildAtIndex(idx.first, idx.second); -if (!root) -{ -if (index_of_error) -*index_of_error = idx.first; -return root; -} -} -return root; +return GetChildAtIndexPath( std::vector>(idxs), + index_of_error ); } lldb::ValueObjectSP @@ -681,20 +657,16 @@ lldb::ValueObjectSP ValueObject::GetChildAtNamePath (const std::initializer_list &names, ConstString* name_of_error) { -if (names.size() == 0) -return GetSP(); -ValueObjectSP root(GetSP()); -for (ConstString name : names) -{ -root = root->GetChildMemberWithName(name, true); -if (!root) -{ -if (name_of_error) -*name_of_error = name; -return root; -} -} -return root; +return GetChildAtNamePath( std::vector(names), + name_of_error ); +} + +lldb::ValueObjectSP +ValueObject::GetChildAtNamePath (const std::initializer_list< std::pair > &names, + ConstString* name_of_error) +{ +return GetChildAtNamePath( std::vector>(names), + name_of_error ); } lldb::ValueObjectSP @@ -718,7 +690,7 @@ ValueObject::GetChildAtNamePath (const s } lldb::ValueObjectSP -ValueObject::GetChildAtNamePath (const std::initializer_list< std::pair > &names, +ValueObject::GetChildAtNamePath (const std::vector< std::pair > &names, ConstString* name_of_error) { if (names.size() == 0) @@ -731,32 +703,12 @@ ValueObject::GetChildAtNamePath (const s { if (name_of_error) *name_of_error = name.first; -return root; +return root; } } return root; } -lldb::ValueObjectSP -ValueObject::GetChildAtNamePath (const std::vector< std::pair > &names, - ConstString* name_of_error) -{ -if (names.size() == 0) -return GetSP(); -ValueObjectSP root(GetSP()); -for (std::pair name : names) -{ -root = root->GetChildMemberWithName(name.first, name.second); -if (!root) -{ -if (name_of_error) -*name_of_error = name.first; -return root; -} -} -return root; -} - size_t ValueObject::GetIndexOfChildWithName (const ConstString &name) { ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r256219 - Remove an empty folder
Author: enrico Date: Mon Dec 21 18:00:35 2015 New Revision: 256219 URL: http://llvm.org/viewvc/llvm-project?rev=256219&view=rev Log: Remove an empty folder Removed: lldb/trunk/test/test_runner/ ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r256223 - No need for a custom function here; just use what C provides
Author: enrico Date: Mon Dec 21 18:47:36 2015 New Revision: 256223 URL: http://llvm.org/viewvc/llvm-project?rev=256223&view=rev Log: No need for a custom function here; just use what C provides Modified: lldb/trunk/source/Core/ValueObject.cpp Modified: lldb/trunk/source/Core/ValueObject.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=256223&r1=256222&r2=256223&view=diff == --- lldb/trunk/source/Core/ValueObject.cpp (original) +++ lldb/trunk/source/Core/ValueObject.cpp Mon Dec 21 18:47:36 2015 @@ -1178,31 +1178,6 @@ ValueObject::SetData (DataExtractor &dat return true; } -// will compute strlen(str), but without consuming more than -// maxlen bytes out of str (this serves the purpose of reading -// chunks of a string without having to worry about -// missing NULL terminators in the chunk) -// of course, if strlen(str) > maxlen, the function will return -// maxlen_value (which should be != maxlen, because that allows you -// to know whether strlen(str) == maxlen or strlen(str) > maxlen) -static uint32_t -strlen_or_inf (const char* str, - uint32_t maxlen, - uint32_t maxlen_value) -{ -uint32_t len = 0; -if (str) -{ -while(*str) -{ -len++;str++; -if (len >= maxlen) -return maxlen_value; -} -} -return len; -} - static bool CopyStringDataToBufferSP(const StreamString& source, lldb::DataBufferSP& destination) @@ -1310,10 +1285,7 @@ ValueObject::ReadPointedString (lldb::Da { total_bytes_read += bytes_read; const char *cstr = data.PeekCStr(0); -size_t len = strlen_or_inf (cstr, k_max_buf_size, k_max_buf_size+1); -if (len > k_max_buf_size) -len = k_max_buf_size; - +size_t len = strnlen (cstr, k_max_buf_size); if (cstr_len_displayed < 0) cstr_len_displayed = len; ___ 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 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
[Lldb-commits] [PATCH] D15708: Advance the return-address breakpoint location to the end of the next source line, or the next branching instruction, when stepping over a func call
jasonmolenda created this revision. jasonmolenda added a reviewer: jingham. jasonmolenda added a subscriber: lldb-commits. jasonmolenda set the repository for this revision to rL LLVM. Herald added a subscriber: aemerson. When lldb is instruction stepping (or fast-stepping / instruction stepping) over a source line, and it instruction steps into a function call, and the function is not "interesting" to the user, lldb sets a breakpoint on the return address and continues the process until that breakpoint is hit on the current thread. lldb has a fast-stepping approach to avoid stopping at every instruction in a source line range - it only stops on instructions that can branch / return / call functions. So we have one extra stop when nexting over a function call. We step into the uninteresting-function, put a breakpoint on the return address, continue, hit the breakpoint on the return address and then we fast-step to the next branch instruction. That was four extra gdb-remote protocol packets for every function call in a source line. This patch advances the stop breakpoint to the first branching instruction after we return, or to the end of the source line. It passes the testsuite. I'll be doing more by-hand testing in the following week or two when I have time, but it's a straightforward change, it shouldn't cause problems unless I've missed something. I added the new Process::AdvanceAddressToNextBranchInstruction() method but I'm only calling it from ThreadPlanStepOut::ThreadPlanStepOut. I thought I'd be able to unify this new function with the code in ThreadPlanStepRange::SetNextBranchBreakpoint but I don't think the few lines I could remove from ThreadPlanStepRange::SetNextBranchBreakpoint would be worth the change. Jim might disagree with that. The one point where this would be incorrect is a command like "finish" which displays the return value after the function exits. On an architecture where the return values are passed in volatile registers (x86, arm), that register may be overwritten after the function return so we must stop on the return address. Repository: rL LLVM http://reviews.llvm.org/D15708 Files: include/lldb/Target/Process.h include/lldb/Target/Thread.h include/lldb/Target/ThreadPlanStepOut.h source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp source/Target/Process.cpp source/Target/Thread.cpp source/Target/ThreadPlanShouldStopHere.cpp source/Target/ThreadPlanStepInstruction.cpp source/Target/ThreadPlanStepOut.cpp source/Target/ThreadPlanStepOverRange.cpp Index: source/Target/ThreadPlanStepOverRange.cpp === --- source/Target/ThreadPlanStepOverRange.cpp +++ source/Target/ThreadPlanStepOverRange.cpp @@ -185,7 +185,8 @@ stop_others, eVoteNo, eVoteNoOpinion, - 0); + 0, + true); break; } else Index: source/Target/ThreadPlanStepOut.cpp === --- source/Target/ThreadPlanStepOut.cpp +++ source/Target/ThreadPlanStepOut.cpp @@ -18,6 +18,7 @@ #include "lldb/Core/ValueObjectConstResult.h" #include "lldb/Symbol/Block.h" #include "lldb/Symbol/Function.h" +#include "lldb/Symbol/Symbol.h" #include "lldb/Symbol/Type.h" #include "lldb/Target/ABI.h" #include "lldb/Target/Process.h" @@ -44,7 +45,8 @@ Vote stop_vote, Vote run_vote, uint32_t frame_idx, -LazyBool step_out_avoids_code_without_debug_info +LazyBool step_out_avoids_code_without_debug_info, +bool private_step_out ) : ThreadPlan (ThreadPlan::eKindStepOut, "Step out", thread, stop_vote, run_vote), ThreadPlanShouldStopHere (this), @@ -86,7 +88,8 @@ eVoteNoOpinion, eVoteNoOpinion, frame_idx - 1, - eLazyBoolNo)); + eLazyBoolNo, + private_step_out)); static_cast(m_step_out_to_inline_plan_sp.get())->SetShouldStopHereCallbacks(nullptr, nullptr); m_step_out_to_inline_plan_sp->SetPrivate(true); } @@ -101,7 +104,35 @@ // Find the return addr
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; -