Re: [Lldb-commits] [PATCH] D17597: [LLDB][MIPS] Fix TestDisassembleBreakpoint
This revision was automatically updated to reflect the committed changes. Closed by commit rL262819: [LLDB][MIPS] Fix TestDisassembleBreakpoint (authored by mohit.bhakkad). Changed prior to commit: http://reviews.llvm.org/D17597?vs=49021=49936#toc Repository: rL LLVM http://reviews.llvm.org/D17597 Files: lldb/trunk/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py === --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py @@ -42,7 +42,7 @@ instructions = [' add ', ' ldr ', ' str '] elif re.match("mips" , arch): breakpoint_opcodes = ["break"] -instructions = ['lw', 'sw', 'jr'] +instructions = ['lw', 'sw'] else: # TODO please add your arch here self.fail('unimplemented for arch = "{arch}"'.format(arch=self.getArchitecture())) Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py === --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py @@ -42,7 +42,7 @@ instructions = [' add ', ' ldr ', ' str '] elif re.match("mips" , arch): breakpoint_opcodes = ["break"] -instructions = ['lw', 'sw', 'jr'] +instructions = ['lw', 'sw'] else: # TODO please add your arch here self.fail('unimplemented for arch = "{arch}"'.format(arch=self.getArchitecture())) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D16840: [LLDB][MIPS] Generalise MIPS arch names
This revision was automatically updated to reflect the committed changes. Closed by commit rL260362: [LLDB][MIPS] Generalise MIPS arch names (authored by mohit.bhakkad). Changed prior to commit: http://reviews.llvm.org/D16840?vs=46919=47423#toc Repository: rL LLVM http://reviews.llvm.org/D16840 Files: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py === --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py @@ -22,7 +22,7 @@ @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778") @expectedFailureAndroid("llvm.org/pr24497", archs=['arm', 'aarch64']) -@expectedFailureAll(archs=['mips', 'mipsel', 'mips64', 'mips64el'])# IO error due to breakpoint at invalid address +@expectedFailureAll(triple = re.compile('^mips'))# IO error due to breakpoint at invalid address def test_step_inst_with(self): """Test thread creation during step-inst handling.""" self.build(dictionary=self.getBuildFlags()) Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py === --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py @@ -74,7 +74,7 @@ # Most of the MIPS boards provide only one H/W watchpoints, and S/W watchpoints are not supported yet arch = self.getArchitecture() -if arch in ['mips', 'mipsel', 'mips64', 'mips64el']: +if re.match("^mips",arch): self.runCmd("watchpoint delete 1") # resolve_location=True, read=False, write=True Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py === --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py @@ -32,7 +32,7 @@ @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") -@expectedFailureAll(archs=['mips', 'mipsel', 'mips64', 'mips64el']) # Most of the MIPS boards provide only one H/W watchpoints, and S/W watchpoints are not supported yet +@expectedFailureAll(triple = re.compile('^mips')) # Most of the MIPS boards provide only one H/W watchpoints, and S/W watchpoints are not supported yet @skipIfDarwin def test_hello_watchlocation(self): """Test watching a location with '-s size' option.""" Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py === --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py @@ -22,7 +22,7 @@ @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778") @expectedFailureAndroid("llvm.org/pr24497", archs=['arm', 'aarch64']) -@expectedFailureAll(archs=['mips', 'mipsel', 'mips64', 'mips64el'])# IO error due to breakpoint at invalid address +@expectedFailureAll(triple = re.compile('^mips'))# IO error due to breakpoint at invalid address def test_step_inst_with(self): """Test thread creation during step-inst handling.""" self.build(dictionary=self.getBuildFlags()) Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py === --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py @@ -74,7 +74,7 @@ # Most of the MIPS boards provide only one
Re: [Lldb-commits] [PATCH] D16397: [LLDB] Consider only valid symbols while resolving by address
This revision was automatically updated to reflect the committed changes. Closed by commit rL258621: [LLDB] Consider only valid symbols while resolving by address (authored by mohit.bhakkad). Changed prior to commit: http://reviews.llvm.org/D16397?vs=45670=45789#toc Repository: rL LLVM http://reviews.llvm.org/D16397 Files: lldb/trunk/include/lldb/Core/RangeMap.h lldb/trunk/include/lldb/Symbol/Symtab.h lldb/trunk/source/Core/Module.cpp lldb/trunk/source/Symbol/Symtab.cpp Index: lldb/trunk/source/Core/Module.cpp === --- lldb/trunk/source/Core/Module.cpp +++ lldb/trunk/source/Core/Module.cpp @@ -559,7 +559,16 @@ Symtab *symtab = sym_vendor->GetSymtab(); if (symtab && so_addr.IsSectionOffset()) { -sc.symbol = symtab->FindSymbolContainingFileAddress(so_addr.GetFileAddress()); +Symbol *matching_symbol = nullptr; +symtab->ForEachSymbolContainingFileAddresss (so_addr.GetFileAddress(), [_symbol](Symbol *symbol) -> bool { +if (symbol->GetType() != eSymbolTypeInvalid) +{ +matching_symbol = symbol; +return false; // Stop iterating +} +return true; // Keep iterating +}); +sc.symbol = matching_symbol; if (!sc.symbol && resolve_scope & eSymbolContextFunction && !(resolved_flags & eSymbolContextFunction)) { Index: lldb/trunk/source/Symbol/Symtab.cpp === --- lldb/trunk/source/Symbol/Symtab.cpp +++ lldb/trunk/source/Symbol/Symtab.cpp @@ -1074,6 +1074,26 @@ } void +Symtab::ForEachSymbolContainingFileAddresss (addr_t file_addr, std::functionconst ) +{ +Mutex::Locker locker (m_mutex); + +if (!m_file_addr_to_index_computed) +InitAddressIndexes(); + +std::vector all_addr_indexes; + +// Get all symbols with file_addr +const size_t addr_match_count = m_file_addr_to_index.FindEntryIndexesThatContains(file_addr, all_addr_indexes); + +for (size_t i=0; i Contains(addr)) +indexes.push_back (pos->data); +} +} +return indexes.size() ; +} Entry * FindEntryThatContains (B addr) Index: lldb/trunk/include/lldb/Symbol/Symtab.h === --- lldb/trunk/include/lldb/Symbol/Symtab.h +++ lldb/trunk/include/lldb/Symbol/Symtab.h @@ -81,6 +81,7 @@ Symbol *FindFirstSymbolWithNameAndType (const ConstString , lldb::SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility); Symbol *FindSymbolContainingFileAddress (lldb::addr_t file_addr, const uint32_t* indexes, uint32_t num_indexes); Symbol *FindSymbolContainingFileAddress (lldb::addr_t file_addr); +voidForEachSymbolContainingFileAddresss (lldb::addr_t file_addr, std::function const ); size_t FindFunctionSymbols (const ConstString , uint32_t name_type_mask, SymbolContextList& sc_list); voidCalculateSymbolSizes (); Index: lldb/trunk/source/Core/Module.cpp === --- lldb/trunk/source/Core/Module.cpp +++ lldb/trunk/source/Core/Module.cpp @@ -559,7 +559,16 @@ Symtab *symtab = sym_vendor->GetSymtab(); if (symtab && so_addr.IsSectionOffset()) { -sc.symbol = symtab->FindSymbolContainingFileAddress(so_addr.GetFileAddress()); +Symbol *matching_symbol = nullptr; +symtab->ForEachSymbolContainingFileAddresss (so_addr.GetFileAddress(), [_symbol](Symbol *symbol) -> bool { +
Re: [Lldb-commits] [PATCH] D16060: [LLDB][MIPS] Fix ReadRegisterValue for registers with constant 32 bit size regardless of ABI
This revision was automatically updated to reflect the committed changes. Closed by commit rL257447: [LLDB][MIPS] Fix ReadRegisterValue for registers with constant 32 bit size… (authored by mohit.bhakkad). Changed prior to commit: http://reviews.llvm.org/D16060?vs=44504=44603#toc Repository: rL LLVM http://reviews.llvm.org/D16060 Files: lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp Index: lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp === --- lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp +++ lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp @@ -1388,7 +1388,15 @@ { lldb_private::ArchSpec arch; if (m_thread.GetProcess()->GetArchitecture(arch)) -value.SetBytes((void *)(((unsigned char *)) + offset + 4 * (arch.GetMachine() == llvm::Triple::mips)), arch.GetFlags() & lldb_private::ArchSpec::eMIPSABI_O32 ? 4 : 8, arch.GetByteOrder()); +{ +void* target_address = ((uint8_t*)) + offset + 4 * (arch.GetMachine() == llvm::Triple::mips; +uint32_t target_size; +if ((::strcmp(reg_name, "sr") == 0) || (::strcmp(reg_name, "cause") == 0) || (::strcmp(reg_name, "config5") == 0)) +target_size = 4; +else +target_size = arch.GetFlags() & lldb_private::ArchSpec::eMIPSABI_O32 ? 4 : 8; +value.SetBytes(target_address, target_size, arch.GetByteOrder()); +} else error.SetErrorString("failed to get architecture"); } Index: lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp === --- lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp +++ lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp @@ -1388,7 +1388,15 @@ { lldb_private::ArchSpec arch; if (m_thread.GetProcess()->GetArchitecture(arch)) -value.SetBytes((void *)(((unsigned char *)) + offset + 4 * (arch.GetMachine() == llvm::Triple::mips)), arch.GetFlags() & lldb_private::ArchSpec::eMIPSABI_O32 ? 4 : 8, arch.GetByteOrder()); +{ +void* target_address = ((uint8_t*)) + offset + 4 * (arch.GetMachine() == llvm::Triple::mips; +uint32_t target_size; +if ((::strcmp(reg_name, "sr") == 0) || (::strcmp(reg_name, "cause") == 0) || (::strcmp(reg_name, "config5") == 0)) +target_size = 4; +else +target_size = arch.GetFlags() & lldb_private::ArchSpec::eMIPSABI_O32 ? 4 : 8; +value.SetBytes(target_address, target_size, arch.GetByteOrder()); +} else error.SetErrorString("failed to get architecture"); } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15738: [LLDB] Fix Read/Write memory to be compatible with both endians
mohit.bhakkad updated this revision to Diff 43520. mohit.bhakkad added a comment. Addressed comment. Repository: rL LLVM http://reviews.llvm.org/D15738 Files: source/Plugins/Process/Linux/NativeProcessLinux.cpp Index: source/Plugins/Process/Linux/NativeProcessLinux.cpp === --- source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ source/Plugins/Process/Linux/NativeProcessLinux.cpp @@ -2547,8 +2547,7 @@ remainder = remainder > k_ptrace_word_size ? k_ptrace_word_size : remainder; // Copy the data into our buffer -for (unsigned i = 0; i < remainder; ++i) -dst[i] = ((data >> i*8) & 0xFF); +memcpy(dst, , remainder); if (log && ProcessPOSIXLog::AtTopNestLevel() && (log->GetMask().Test(POSIX_LOG_MEMORY_DATA_LONG) || @@ -2600,8 +2599,7 @@ if (remainder == k_ptrace_word_size) { unsigned long data = 0; -for (unsigned i = 0; i < k_ptrace_word_size; ++i) -data |= (unsigned long)src[i] << i*8; +memcpy(, src, k_ptrace_word_size); if (log && ProcessPOSIXLog::AtTopNestLevel() && (log->GetMask().Test(POSIX_LOG_MEMORY_DATA_LONG) || Index: source/Plugins/Process/Linux/NativeProcessLinux.cpp === --- source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ source/Plugins/Process/Linux/NativeProcessLinux.cpp @@ -2547,8 +2547,7 @@ remainder = remainder > k_ptrace_word_size ? k_ptrace_word_size : remainder; // Copy the data into our buffer -for (unsigned i = 0; i < remainder; ++i) -dst[i] = ((data >> i*8) & 0xFF); +memcpy(dst, , remainder); if (log && ProcessPOSIXLog::AtTopNestLevel() && (log->GetMask().Test(POSIX_LOG_MEMORY_DATA_LONG) || @@ -2600,8 +2599,7 @@ if (remainder == k_ptrace_word_size) { unsigned long data = 0; -for (unsigned i = 0; i < k_ptrace_word_size; ++i) -data |= (unsigned long)src[i] << i*8; +memcpy(, src, k_ptrace_word_size); if (log && ProcessPOSIXLog::AtTopNestLevel() && (log->GetMask().Test(POSIX_LOG_MEMORY_DATA_LONG) || ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15738: [LLDB] Fix Read/Write memory to be compatible with both endians
This revision was automatically updated to reflect the committed changes. Closed by commit rL256331: [LLDB] Fix Read/Write memory to be compatible with both endians (authored by mohit.bhakkad). Changed prior to commit: http://reviews.llvm.org/D15738?vs=43520=43522#toc Repository: rL LLVM http://reviews.llvm.org/D15738 Files: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp Index: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp === --- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp @@ -2547,8 +2547,7 @@ remainder = remainder > k_ptrace_word_size ? k_ptrace_word_size : remainder; // Copy the data into our buffer -for (unsigned i = 0; i < remainder; ++i) -dst[i] = ((data >> i*8) & 0xFF); +memcpy(dst, , remainder); if (log && ProcessPOSIXLog::AtTopNestLevel() && (log->GetMask().Test(POSIX_LOG_MEMORY_DATA_LONG) || @@ -2600,8 +2599,7 @@ if (remainder == k_ptrace_word_size) { unsigned long data = 0; -for (unsigned i = 0; i < k_ptrace_word_size; ++i) -data |= (unsigned long)src[i] << i*8; +memcpy(, src, k_ptrace_word_size); if (log && ProcessPOSIXLog::AtTopNestLevel() && (log->GetMask().Test(POSIX_LOG_MEMORY_DATA_LONG) || Index: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp === --- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp @@ -2547,8 +2547,7 @@ remainder = remainder > k_ptrace_word_size ? k_ptrace_word_size : remainder; // Copy the data into our buffer -for (unsigned i = 0; i < remainder; ++i) -dst[i] = ((data >> i*8) & 0xFF); +memcpy(dst, , remainder); if (log && ProcessPOSIXLog::AtTopNestLevel() && (log->GetMask().Test(POSIX_LOG_MEMORY_DATA_LONG) || @@ -2600,8 +2599,7 @@ if (remainder == k_ptrace_word_size) { unsigned long data = 0; -for (unsigned i = 0; i < k_ptrace_word_size; ++i) -data |= (unsigned long)src[i] << i*8; +memcpy(, src, k_ptrace_word_size); if (log && ProcessPOSIXLog::AtTopNestLevel() && (log->GetMask().Test(POSIX_LOG_MEMORY_DATA_LONG) || ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D15738: [LLDB] Fix Read/Write memory to be compatible with both endians
mohit.bhakkad created this revision. mohit.bhakkad added a reviewer: clayborg. mohit.bhakkad added subscribers: jaydeep, bhushan, sagar, nitesh.jain, lldb-commits. mohit.bhakkad set the repository for this revision to rL LLVM. While copying a byte, copy a whole byte chunk instead of each bit, to make it compatible with both endians. Repository: rL LLVM http://reviews.llvm.org/D15738 Files: source/Plugins/Process/Linux/NativeProcessLinux.cpp Index: source/Plugins/Process/Linux/NativeProcessLinux.cpp === --- source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ source/Plugins/Process/Linux/NativeProcessLinux.cpp @@ -2547,9 +2547,7 @@ remainder = remainder > k_ptrace_word_size ? k_ptrace_word_size : remainder; // Copy the data into our buffer -for (unsigned i = 0; i < remainder; ++i) -dst[i] = ((data >> i*8) & 0xFF); - +*((long*)(dst)) = data; if (log && ProcessPOSIXLog::AtTopNestLevel() && (log->GetMask().Test(POSIX_LOG_MEMORY_DATA_LONG) || (log->GetMask().Test(POSIX_LOG_MEMORY_DATA_SHORT) && @@ -2600,8 +2598,7 @@ if (remainder == k_ptrace_word_size) { unsigned long data = 0; -for (unsigned i = 0; i < k_ptrace_word_size; ++i) -data |= (unsigned long)src[i] << i*8; +data = *((unsigned long*)src); if (log && ProcessPOSIXLog::AtTopNestLevel() && (log->GetMask().Test(POSIX_LOG_MEMORY_DATA_LONG) || Index: source/Plugins/Process/Linux/NativeProcessLinux.cpp === --- source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ source/Plugins/Process/Linux/NativeProcessLinux.cpp @@ -2547,9 +2547,7 @@ remainder = remainder > k_ptrace_word_size ? k_ptrace_word_size : remainder; // Copy the data into our buffer -for (unsigned i = 0; i < remainder; ++i) -dst[i] = ((data >> i*8) & 0xFF); - +*((long*)(dst)) = data; if (log && ProcessPOSIXLog::AtTopNestLevel() && (log->GetMask().Test(POSIX_LOG_MEMORY_DATA_LONG) || (log->GetMask().Test(POSIX_LOG_MEMORY_DATA_SHORT) && @@ -2600,8 +2598,7 @@ if (remainder == k_ptrace_word_size) { unsigned long data = 0; -for (unsigned i = 0; i < k_ptrace_word_size; ++i) -data |= (unsigned long)src[i] << i*8; +data = *((unsigned long*)src); if (log && ProcessPOSIXLog::AtTopNestLevel() && (log->GetMask().Test(POSIX_LOG_MEMORY_DATA_LONG) || ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D14944: [LLDB][MIPS] Marking some expected failures
mohit.bhakkad updated this revision to Diff 41843. mohit.bhakkad added a comment. Addressed comments Repository: rL LLVM http://reviews.llvm.org/D14944 Files: packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py Index: packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py === --- packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py +++ packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py @@ -54,17 +54,6 @@ error.GetCString()) self.assertTrue(read_watchpoint, "Failed to set read watchpoint.") -write_value = frame.FindValue('g_watch_me_write', - lldb.eValueTypeVariableGlobal) -self.assertTrue(write_value, "Failed to find write value.") - -# resolve_location=True, read=False, write=True -write_watchpoint = write_value.Watch(True, False, True, error) -self.assertTrue(read_watchpoint, "Failed to set write watchpoint.") -self.assertTrue(error.Success(), -"Error while setting watchpoint: %s" % -error.GetCString()) - thread.StepOver() self.assertTrue(thread.GetStopReason() == lldb.eStopReasonWatchpoint, STOPPED_DUE_TO_WATCHPOINT) @@ -77,6 +66,22 @@ self.step_inst_for_watchpoint(1) +write_value = frame.FindValue('g_watch_me_write', + lldb.eValueTypeVariableGlobal) +self.assertTrue(write_value, "Failed to find write value.") + +# Most of the MIPS boards provide only one H/W watchpoints, and S/W watchpoints are not supported yet +arch = self.getArchitecture() +if arch in ['mips', 'mipsel', 'mips64', 'mips64el']: +self.runCmd("watchpoint delete 1") + +# resolve_location=True, read=False, write=True +write_watchpoint = write_value.Watch(True, False, True, error) +self.assertTrue(read_watchpoint, "Failed to set write watchpoint.") +self.assertTrue(error.Success(), +"Error while setting watchpoint: %s" % +error.GetCString()) + thread.StepOver() self.assertTrue(thread.GetStopReason() == lldb.eStopReasonWatchpoint, STOPPED_DUE_TO_WATCHPOINT) Index: packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py === --- packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py +++ packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py @@ -31,6 +31,7 @@ @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported @expectedFailureWindows("llvm.org/pr24446") # WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows +@expectedFailureAll(archs=['mips', 'mipsel', 'mips64', 'mips64el']) # Most of the MIPS boards provide only one H/W watchpoints, and S/W watchpoints are not supported yet def test_hello_watchlocation(self): """Test watching a location with '-s size' option.""" self.build(dictionary=self.d) Index: packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py === --- packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py +++ packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py @@ -54,17 +54,6 @@ error.GetCString()) self.assertTrue(read_watchpoint, "Failed to set read watchpoint.") -write_value = frame.FindValue('g_watch_me_write', - lldb.eValueTypeVariableGlobal) -self.assertTrue(write_value, "Failed to find write value.") - -# resolve_location=True, read=False, write=True -write_watchpoint = write_value.Watch(True, False, True, error) -self.assertTrue(read_watchpoint, "Failed to set write watchpoint.") -self.assertTrue(error.Success(), -"Error while setting watchpoint: %s" % -error.GetCString()) - thread.StepOver() self.assertTrue(thread.GetStopReason() == lldb.eStopReasonWatchpoint, STOPPED_DUE_TO_WATCHPOINT) @@ -77,6 +66,22 @@ self.step_inst_for_watchpoint(1) +write_value = frame.FindValue('g_watch_me_write', +
Re: [Lldb-commits] [PATCH] D15106: [LLDB][MIPS] fix watchpoint searched on client side for same masked variables
This revision was automatically updated to reflect the committed changes. Closed by commit rL254522: [LLDB][MIPS] fix watchpoint searched on client side for same masked variables (authored by mohit.bhakkad). Changed prior to commit: http://reviews.llvm.org/D15106?vs=41486=41644#toc Repository: rL LLVM http://reviews.llvm.org/D15106 Files: lldb/trunk/include/lldb/Core/ArchSpec.h lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Index: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp === --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -2081,9 +2081,12 @@ watch_id_t watch_id = LLDB_INVALID_WATCH_ID; if (wp_addr != LLDB_INVALID_ADDRESS) { -if (wp_hit_addr != LLDB_INVALID_ADDRESS) -wp_addr = wp_hit_addr; -WatchpointSP wp_sp = GetTarget().GetWatchpointList().FindByAddress(wp_addr); +WatchpointSP wp_sp; +ArchSpec::Core core = GetTarget().GetArchitecture().GetCore(); +if (core >= ArchSpec::kCore_mips_first && core <= ArchSpec::kCore_mips_last) +wp_sp = GetTarget().GetWatchpointList().FindByAddress(wp_hit_addr); +if (!wp_sp) +wp_sp = GetTarget().GetWatchpointList().FindByAddress(wp_addr); if (wp_sp) { wp_sp->SetHardwareIndex(wp_index); Index: lldb/trunk/include/lldb/Core/ArchSpec.h === --- lldb/trunk/include/lldb/Core/ArchSpec.h +++ lldb/trunk/include/lldb/Core/ArchSpec.h @@ -212,7 +212,11 @@ kCore_mips64_last = eCore_mips64r6, kCore_mips64el_first = eCore_mips64el, -kCore_mips64el_last = eCore_mips64r6el +kCore_mips64el_last = eCore_mips64r6el, + +kCore_mips_first = eCore_mips32, +kCore_mips_last = eCore_mips64r6el + }; typedef void (* StopInfoOverrideCallbackType)(lldb_private::Thread ); Index: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp === --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -2081,9 +2081,12 @@ watch_id_t watch_id = LLDB_INVALID_WATCH_ID; if (wp_addr != LLDB_INVALID_ADDRESS) { -if (wp_hit_addr != LLDB_INVALID_ADDRESS) -wp_addr = wp_hit_addr; -WatchpointSP wp_sp = GetTarget().GetWatchpointList().FindByAddress(wp_addr); +WatchpointSP wp_sp; +ArchSpec::Core core = GetTarget().GetArchitecture().GetCore(); +if (core >= ArchSpec::kCore_mips_first && core <= ArchSpec::kCore_mips_last) +wp_sp = GetTarget().GetWatchpointList().FindByAddress(wp_hit_addr); +if (!wp_sp) +wp_sp = GetTarget().GetWatchpointList().FindByAddress(wp_addr); if (wp_sp) { wp_sp->SetHardwareIndex(wp_index); Index: lldb/trunk/include/lldb/Core/ArchSpec.h === --- lldb/trunk/include/lldb/Core/ArchSpec.h +++ lldb/trunk/include/lldb/Core/ArchSpec.h @@ -212,7 +212,11 @@ kCore_mips64_last = eCore_mips64r6, kCore_mips64el_first = eCore_mips64el, -kCore_mips64el_last = eCore_mips64r6el +kCore_mips64el_last = eCore_mips64r6el, + +kCore_mips_first = eCore_mips32, +kCore_mips_last = eCore_mips64r6el + }; typedef void (* StopInfoOverrideCallbackType)(lldb_private::Thread ); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D12877: [LLDB] Switch to assembly view if source is moved
This revision was automatically updated to reflect the committed changes. Closed by commit rL254588: [LLDB] Switch to assembly view if source is moved (authored by mohit.bhakkad). Changed prior to commit: http://reviews.llvm.org/D12877?vs=38799=41714#toc Repository: rL LLVM http://reviews.llvm.org/D12877 Files: lldb/trunk/source/Core/Debugger.cpp lldb/trunk/source/Target/StackFrame.cpp Index: lldb/trunk/source/Core/Debugger.cpp === --- lldb/trunk/source/Core/Debugger.cpp +++ lldb/trunk/source/Core/Debugger.cpp @@ -86,9 +86,10 @@ OptionEnumValueElement g_show_disassembly_enum_values[] = { -{ Debugger::eStopDisassemblyTypeNever,"never", "Never show disassembly when displaying a stop context."}, -{ Debugger::eStopDisassemblyTypeNoSource, "no-source", "Show disassembly when there is no source information, or the source file is missing when displaying a stop context."}, -{ Debugger::eStopDisassemblyTypeAlways, "always","Always show disassembly when displaying a stop context."}, +{ Debugger::eStopDisassemblyTypeNever, "never","Never show disassembly when displaying a stop context."}, +{ Debugger::eStopDisassemblyTypeNoDebugInfo,"no-debuginfo", "Show disassembly when there is no debug information."}, +{ Debugger::eStopDisassemblyTypeNoSource, "no-source","Show disassembly when there is no source information, or the source file is missing when displaying a stop context."}, +{ Debugger::eStopDisassemblyTypeAlways, "always", "Always show disassembly when displaying a stop context."}, { 0, NULL, NULL } }; @@ -150,7 +151,7 @@ { "prompt", OptionValue::eTypeString , true, OptionValueString::eOptionEncodeCharacterEscapeSequences, "(lldb) ", NULL, "The debugger command line prompt displayed for the user." }, { "script-lang", OptionValue::eTypeEnum, true, eScriptLanguagePython, NULL, g_language_enumerators, "The script language to be used for evaluating user-written scripts." }, { "stop-disassembly-count", OptionValue::eTypeSInt64 , true, 4, NULL, NULL, "The number of disassembly lines to show when displaying a stopped context." }, -{ "stop-disassembly-display", OptionValue::eTypeEnum, true, Debugger::eStopDisassemblyTypeNoSource, NULL, g_show_disassembly_enum_values, "Control when to display disassembly when displaying a stopped context." }, +{ "stop-disassembly-display", OptionValue::eTypeEnum, true, Debugger::eStopDisassemblyTypeNoDebugInfo, NULL, g_show_disassembly_enum_values, "Control when to display disassembly when displaying a stopped context." }, { "stop-line-count-after",OptionValue::eTypeSInt64 , true, 3, NULL, NULL, "The number of sources lines to display that come after the current source line when displaying a stopped context." }, { "stop-line-count-before", OptionValue::eTypeSInt64 , true, 3, NULL, NULL, "The number of sources lines to display that come before the current source line when displaying a stopped context." }, { "term-width", OptionValue::eTypeSInt64 , true, 80 , NULL, NULL, "The maximum number of columns to use for displaying text." }, Index: lldb/trunk/source/Target/StackFrame.cpp === --- lldb/trunk/source/Target/StackFrame.cpp +++ lldb/trunk/source/Target/StackFrame.cpp @@ -1519,7 +1519,7 @@ if (show_source) { ExecutionContext exe_ctx (shared_from_this()); -bool have_source = false; +bool have_source = false, have_debuginfo = false; Debugger::StopDisassemblyType disasm_display = Debugger::eStopDisassemblyTypeNever; Target *target = exe_ctx.GetTargetPtr(); if (target) @@ -1532,26 +1532,35 @@ GetSymbolContext(eSymbolContextCompUnit | eSymbolContextLineEntry); if (m_sc.comp_unit && m_sc.line_entry.IsValid()) { -have_source = true; +have_debuginfo = true; if (source_lines_before > 0 || source_lines_after > 0) { - target->GetSourceManager().DisplaySourceLinesWithLineNumbers (m_sc.line_entry.file, +size_t num_lines = target->GetSourceManager().DisplaySourceLinesWithLineNumbers (m_sc.line_entry.file, m_sc.line_entry.line, source_lines_before, source_lines_after, "->",
[Lldb-commits] [PATCH] D15106: [LLDB][MIPS] fix watchpoint searched on client side for same masked variables
mohit.bhakkad created this revision. mohit.bhakkad added a reviewer: clayborg. mohit.bhakkad added subscribers: jaydeep, bhushan, nitesh.jain, sagar, lldb-commits. mohit.bhakkad set the repository for this revision to rL LLVM. rL249837 doesn't solves all the issues with MIPS false positives, some of the cases are not working. so need to replace it with this logic. Repository: rL LLVM http://reviews.llvm.org/D15106 Files: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp === --- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -2110,9 +2110,12 @@ watch_id_t watch_id = LLDB_INVALID_WATCH_ID; if (wp_addr != LLDB_INVALID_ADDRESS) { -if (wp_hit_addr != LLDB_INVALID_ADDRESS) -wp_addr = wp_hit_addr; -WatchpointSP wp_sp = GetTarget().GetWatchpointList().FindByAddress(wp_addr); +WatchpointSP wp_sp; +ArchSpec::Core core = GetTarget().GetArchitecture().GetCore(); +if (core >= ArchSpec::kCore_mips_first && core <= ArchSpec::kCore_mips_last) +wp_sp = GetTarget().GetWatchpointList().FindByAddress(wp_hit_addr); +if (!wp_sp) +wp_sp = GetTarget().GetWatchpointList().FindByAddress(wp_addr); if (wp_sp) { wp_sp->SetHardwareIndex(wp_index); Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp === --- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -2110,9 +2110,12 @@ watch_id_t watch_id = LLDB_INVALID_WATCH_ID; if (wp_addr != LLDB_INVALID_ADDRESS) { -if (wp_hit_addr != LLDB_INVALID_ADDRESS) -wp_addr = wp_hit_addr; -WatchpointSP wp_sp = GetTarget().GetWatchpointList().FindByAddress(wp_addr); +WatchpointSP wp_sp; +ArchSpec::Core core = GetTarget().GetArchitecture().GetCore(); +if (core >= ArchSpec::kCore_mips_first && core <= ArchSpec::kCore_mips_last) +wp_sp = GetTarget().GetWatchpointList().FindByAddress(wp_hit_addr); +if (!wp_sp) +wp_sp = GetTarget().GetWatchpointList().FindByAddress(wp_addr); if (wp_sp) { wp_sp->SetHardwareIndex(wp_index); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D14920: [LLDB][MIPS] Provide actual number of watchpoints supported
mohit.bhakkad updated this revision to Diff 41014. Repository: rL LLVM http://reviews.llvm.org/D14920 Files: source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.h Index: source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.h === --- source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.h +++ source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.h @@ -89,6 +89,9 @@ uint32_t NumSupportedHardwareWatchpoints () override; +uint32_t +NumHardwareWatchRegisters (); + protected: Error DoReadRegisterValue(uint32_t offset, Index: source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp === --- source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp +++ source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp @@ -76,6 +76,7 @@ #define I (1 << 2) #define IRW (I | R | W) +#define RW (R | W) struct pt_watch_regs default_watch_regs; @@ -1117,7 +1118,7 @@ Error NativeRegisterContextLinux_mips64::IsWatchpointHit (uint32_t wp_index, bool _hit) { -if (wp_index >= NumSupportedHardwareWatchpoints()) +if (wp_index >= NumHardwareWatchRegisters()) return Error("Watchpoint index out of range"); // reading the current state of watch regs @@ -1139,7 +1140,7 @@ Error NativeRegisterContextLinux_mips64::GetWatchpointHitIndex(uint32_t _index, lldb::addr_t trap_addr) { -uint32_t num_hw_wps = NumSupportedHardwareWatchpoints(); +uint32_t num_hw_wps = NumHardwareWatchRegisters(); for (wp_index = 0; wp_index < num_hw_wps; ++wp_index) { bool is_hit; @@ -1164,7 +1165,7 @@ bool NativeRegisterContextLinux_mips64::ClearHardwareWatchpoint(uint32_t wp_index) { -if (wp_index >= NumSupportedHardwareWatchpoints()) +if (wp_index >= NumHardwareWatchRegisters()) return false; struct pt_watch_regs regs; @@ -1218,7 +1219,7 @@ DoReadWatchPointRegisterValue(m_thread.GetID(), static_cast()); // Try if a new watch point fits in this state -int index = GetVacantWatchIndex (, addr, size, watch_flags, NumSupportedHardwareWatchpoints()); +int index = GetVacantWatchIndex (, addr, size, watch_flags, NumHardwareWatchRegisters()); // New watchpoint doesn't fit if (index == LLDB_INVALID_INDEX32) @@ -1236,7 +1237,7 @@ lldb::addr_t NativeRegisterContextLinux_mips64::GetWatchpointAddress (uint32_t wp_index) { -if (wp_index >= NumSupportedHardwareWatchpoints()) +if (wp_index >= NumHardwareWatchRegisters()) return LLDB_INVALID_ADDRESS; return hw_addr_map[wp_index]; @@ -1315,7 +1316,7 @@ lldb::addr_t NativeRegisterContextLinux_mips64::GetWatchpointHitAddress (uint32_t wp_index) { -if (wp_index >= NumSupportedHardwareWatchpoints()) +if (wp_index >= NumHardwareWatchRegisters()) return LLDB_INVALID_ADDRESS; lldb_private::ArchSpec arch; @@ -1343,6 +1344,32 @@ } uint32_t +NativeRegisterContextLinux_mips64::NumHardwareWatchRegisters () +{ +Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); +struct pt_watch_regs regs; +static int num_valid = 0; +if (!num_valid) +{ +DoReadWatchPointRegisterValue(m_thread.GetID(), static_cast()); +switch (regs.style) +{ +case pt_watch_style_mips32: +num_valid = regs.mips32.num_valid; // Using num_valid as cache +return num_valid; +case pt_watch_style_mips64: +num_valid = regs.mips64.num_valid; +return num_valid; +default: +if(log) +log->Printf("NativeRegisterContextLinux_mips64::%s Error: Unrecognized watch register style", __FUNCTION__); +} +return 0; +} +return num_valid; +} + +uint32_t NativeRegisterContextLinux_mips64::NumSupportedHardwareWatchpoints () { Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); @@ -1356,9 +1383,19 @@ { case pt_watch_style_mips32: num_valid = regs.mips32.num_valid; // Using num_valid as cache +for (int index = 0; index < num_valid; index++) +{ +if ((regs.mips32.watch_masks[index] & RW)== 0) // check last 2 bits of mask(read, write) +num_valid--; +} return num_valid; case pt_watch_style_mips64: num_valid = regs.mips64.num_valid; +for (int index = 0; index < num_valid; index++) +{ +if ((regs.mips64.watch_masks[index] & RW) == 0) +num_valid--; +} return num_valid; default:
[Lldb-commits] [PATCH] D14944: [LLDB][MIPS] Marking some expected failures
mohit.bhakkad created this revision. mohit.bhakkad added reviewers: clayborg, zturner. mohit.bhakkad added subscribers: jaydeep, bhushan, sagar, nitesh.jain, lldb-commits. mohit.bhakkad set the repository for this revision to rL LLVM. Herald added subscribers: srhines, danalbert, tberghammer. Most of the MIPS boards provide only one watchpoint register, so tests with more than one watchpoints will fail, as software watchpoints are not supported for MIPS yet. Providing an alternate test for TestStepOverWatchpoint.py, in which checking one watchpoint, deleting it, then testing another watchpoint. Repository: rL LLVM http://reviews.llvm.org/D14944 Files: packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpointMips.py Index: packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpointMips.py === --- /dev/null +++ packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpointMips.py @@ -0,0 +1,110 @@ +"""Test stepping over watchpoints.""" + +from __future__ import print_function + + + +import lldb +import lldbsuite.test.lldbutil as lldbutil +from lldbsuite.test.lldbtest import * + + +class TestStepOverWatchpoint(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +def getCategories(self): +return ['basic_process'] + +@expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported +@expectedFailureWindows("llvm.org/pr24446") +def test(self): +"""Test stepping over watchpoints.""" +self.build() +exe = os.path.join(os.getcwd(), 'a.out') + +target = self.dbg.CreateTarget(exe) +self.assertTrue(self.target, VALID_TARGET) + +lldbutil.run_break_set_by_symbol(self, 'main') + +process = target.LaunchSimple(None, None, + self.get_process_working_directory()) +self.assertTrue(process.IsValid(), PROCESS_IS_VALID) +self.assertTrue(process.GetState() == lldb.eStateStopped, +PROCESS_STOPPED) + +thread = lldbutil.get_stopped_thread(process, + lldb.eStopReasonBreakpoint) +self.assertTrue(thread.IsValid(), "Failed to get thread.") + +frame = thread.GetFrameAtIndex(0) +self.assertTrue(frame.IsValid(), "Failed to get frame.") + +read_value = frame.FindValue('g_watch_me_read', + lldb.eValueTypeVariableGlobal) +self.assertTrue(read_value.IsValid(), "Failed to find read value.") + +error = lldb.SBError() + +# resolve_location=True, read=True, write=False +read_watchpoint = read_value.Watch(True, True, False, error) +self.assertTrue(error.Success(), +"Error while setting watchpoint: %s" % +error.GetCString()) +self.assertTrue(read_watchpoint, "Failed to set read watchpoint.") + +thread.StepOver() +self.assertTrue(thread.GetStopReason() == lldb.eStopReasonWatchpoint, +STOPPED_DUE_TO_WATCHPOINT) +self.assertTrue(thread.GetStopDescription(20) == 'watchpoint 1') + +process.Continue() +self.assertTrue(process.GetState() == lldb.eStateStopped, +PROCESS_STOPPED) +self.assertTrue(thread.GetStopDescription(20) == 'step over') + +self.step_inst_for_watchpoint(1) + +write_value = frame.FindValue('g_watch_me_write', + lldb.eValueTypeVariableGlobal) +self.assertTrue(write_value, "Failed to find write value.") + +self.runCmd("watchpoint delete 1") + +# resolve_location=True, read=False, write=True +write_watchpoint = write_value.Watch(True, False, True, error) +self.assertTrue(read_watchpoint, "Failed to set write watchpoint.") +self.assertTrue(error.Success(), +"Error while setting watchpoint: %s" % +error.GetCString()) + +thread.StepOver() +self.assertTrue(thread.GetStopReason() == lldb.eStopReasonWatchpoint, +STOPPED_DUE_TO_WATCHPOINT) +self.assertTrue(thread.GetStopDescription(20) == 'watchpoint 2') + +process.Continue() +self.assertTrue(process.GetState() == lldb.eStateStopped, +PROCESS_STOPPED) +self.assertTrue(thread.GetStopDescription(20) == 'step over') + +self.step_inst_for_watchpoint(2) + +def step_inst_for_watchpoint(self, wp_id): +watchpoint_hit = False +current_line =
[Lldb-commits] [PATCH] D14860: [LLDB][MIPS] Getting 0 index for h/w watchpoint is not necessarily an error
mohit.bhakkad created this revision. mohit.bhakkad added reviewers: bhushan, jaydeep. mohit.bhakkad added subscribers: lldb-commits, sagar, nitesh.jain. mohit.bhakkad set the repository for this revision to rL LLVM. Index for H/W watchpoint regsisters starts from 0, so considering 0 as failure is wrong. Repository: rL LLVM http://reviews.llvm.org/D14860 Files: source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp Index: source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp === --- source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp +++ source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp @@ -1092,7 +1092,7 @@ } } } -return 0; +return LLDB_INVALID_INDEX32; } bool @@ -1221,7 +1221,7 @@ int index = GetVacantWatchIndex (, addr, size, watch_flags, NumSupportedHardwareWatchpoints()); // New watchpoint doesn't fit -if (!index) +if (index == LLDB_INVALID_INDEX32) return LLDB_INVALID_INDEX32; Index: source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp === --- source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp +++ source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp @@ -1092,7 +1092,7 @@ } } } -return 0; +return LLDB_INVALID_INDEX32; } bool @@ -1221,7 +1221,7 @@ int index = GetVacantWatchIndex (, addr, size, watch_flags, NumSupportedHardwareWatchpoints()); // New watchpoint doesn't fit -if (!index) +if (index == LLDB_INVALID_INDEX32) return LLDB_INVALID_INDEX32; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13859: [LLDB][LLGS Test] Check length of register, only when its available
This revision was automatically updated to reflect the committed changes. Closed by commit rL251906: [LLDB][MIPS] Fix GetUserRegisterInfoCount to count no of regs which are… (authored by mohit.bhakkad). Changed prior to commit: http://reviews.llvm.org/D13859?vs=38785=39037#toc Repository: rL LLVM http://reviews.llvm.org/D13859 Files: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips.cpp lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips.h lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips64.cpp lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips64.h Index: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips64.cpp === --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips64.cpp +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips64.cpp @@ -75,27 +75,31 @@ } uint32_t -GetUserRegisterInfoCount (const ArchSpec _arch) +GetUserRegisterInfoCount (const ArchSpec _arch, bool msa_present) { switch (target_arch.GetMachine()) { case llvm::Triple::mips: case llvm::Triple::mipsel: -return static_cast (k_num_user_registers_mips); +if (msa_present) +return static_cast (k_num_user_registers_mips); +return static_cast (k_num_user_registers_mips - k_num_msa_registers_mips); case llvm::Triple::mips64el: case llvm::Triple::mips64: -return static_cast (k_num_user_registers_mips64); +if (msa_present) +return static_cast (k_num_user_registers_mips64); +return static_cast (k_num_user_registers_mips64 - k_num_msa_registers_mips64); default: assert(false && "Unhandled target architecture."); return 0; } } -RegisterContextLinux_mips64::RegisterContextLinux_mips64(const ArchSpec _arch) : +RegisterContextLinux_mips64::RegisterContextLinux_mips64(const ArchSpec _arch, bool msa_present) : lldb_private::RegisterInfoInterface(target_arch), m_register_info_p (GetRegisterInfoPtr (target_arch)), m_register_info_count (GetRegisterInfoCount (target_arch)), -m_user_register_count (GetUserRegisterInfoCount (target_arch)) +m_user_register_count (GetUserRegisterInfoCount (target_arch, msa_present)) { } Index: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips64.h === --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips64.h +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips64.h @@ -19,7 +19,7 @@ : public lldb_private::RegisterInfoInterface { public: -RegisterContextLinux_mips64(const lldb_private::ArchSpec _arch); +RegisterContextLinux_mips64(const lldb_private::ArchSpec _arch, bool msa_present = true); size_t GetGPRSize() const override; Index: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips.cpp === --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips.cpp +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips.cpp @@ -29,8 +29,17 @@ #include "RegisterInfos_mips.h" #undef DECLARE_REGISTER_INFOS_MIPS_STRUCT -RegisterContextLinux_mips::RegisterContextLinux_mips(const ArchSpec _arch) : -RegisterInfoInterface(target_arch) +uint32_t +GetUserRegisterInfoCount (bool msa_present) +{ +if (msa_present) +return static_cast (k_num_user_registers_mips); +return static_cast (k_num_user_registers_mips - k_num_msa_registers_mips); +} + +RegisterContextLinux_mips::RegisterContextLinux_mips(const ArchSpec _arch, bool msa_present) : +RegisterInfoInterface(target_arch), +m_user_register_count (GetUserRegisterInfoCount (msa_present)) { } @@ -63,5 +72,5 @@ uint32_t RegisterContextLinux_mips::GetUserRegisterCount () const { -return static_cast (k_num_user_registers_mips); +return static_cast (m_user_register_count); } Index: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips.h === --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips.h +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips.h @@ -17,7 +17,7 @@ : public lldb_private::RegisterInfoInterface { public: -RegisterContextLinux_mips(const lldb_private::ArchSpec _arch); +RegisterContextLinux_mips(const lldb_private::ArchSpec _arch, bool msa_present = true); size_t GetGPRSize() const override; @@ -30,6 +30,9 @@ uint32_t GetUserRegisterCount () const override; + +private: +uint32_t m_user_register_count; }; #endif ___ lldb-commits mailing list lldb-commits@lists.llvm.org
Re: [Lldb-commits] [PATCH] D13296: [LLDB] Fix watchpoint ignore feature for architectures with watchpoint_exceptions_received=before
This revision was automatically updated to reflect the committed changes. Closed by commit rL251905: [LLDB][Watchpoint] Change ignore_count condition location to fix watchpoint… (authored by mohit.bhakkad). Changed prior to commit: http://reviews.llvm.org/D13296?vs=36119=39035#toc Repository: rL LLVM http://reviews.llvm.org/D13296 Files: lldb/trunk/source/Breakpoint/Watchpoint.cpp lldb/trunk/source/Target/StopInfo.cpp Index: lldb/trunk/source/Breakpoint/Watchpoint.cpp === --- lldb/trunk/source/Breakpoint/Watchpoint.cpp +++ lldb/trunk/source/Breakpoint/Watchpoint.cpp @@ -183,9 +183,6 @@ if (!IsEnabled()) return false; -if (GetHitCount() <= GetIgnoreCount()) -return false; - return true; } Index: lldb/trunk/source/Target/StopInfo.cpp === --- lldb/trunk/source/Target/StopInfo.cpp +++ lldb/trunk/source/Target/StopInfo.cpp @@ -759,6 +759,16 @@ } } +// TODO: This condition should be checked in the synchronous part of the watchpoint code +// (Watchpoint::ShouldStop), so that we avoid pulling an event even if the watchpoint fails +// the ignore count condition. It is moved here temporarily, because for archs with +// watchpoint_exceptions_received=before, the code in the previous lines takes care of moving +// the inferior to next PC. We have to check the ignore count condition after this is done, +// otherwise we will hit same watchpoint multiple times until we pass ignore condition, but we +// won't actually be ignoring them. +if (wp_sp->GetHitCount() <= wp_sp->GetIgnoreCount()) +m_should_stop = false; + if (m_should_stop && wp_sp->GetConditionText() != NULL) { // We need to make sure the user sees any parse errors in their condition, so we'll hook the Index: lldb/trunk/source/Breakpoint/Watchpoint.cpp === --- lldb/trunk/source/Breakpoint/Watchpoint.cpp +++ lldb/trunk/source/Breakpoint/Watchpoint.cpp @@ -183,9 +183,6 @@ if (!IsEnabled()) return false; -if (GetHitCount() <= GetIgnoreCount()) -return false; - return true; } Index: lldb/trunk/source/Target/StopInfo.cpp === --- lldb/trunk/source/Target/StopInfo.cpp +++ lldb/trunk/source/Target/StopInfo.cpp @@ -759,6 +759,16 @@ } } +// TODO: This condition should be checked in the synchronous part of the watchpoint code +// (Watchpoint::ShouldStop), so that we avoid pulling an event even if the watchpoint fails +// the ignore count condition. It is moved here temporarily, because for archs with +// watchpoint_exceptions_received=before, the code in the previous lines takes care of moving +// the inferior to next PC. We have to check the ignore count condition after this is done, +// otherwise we will hit same watchpoint multiple times until we pass ignore condition, but we +// won't actually be ignoring them. +if (wp_sp->GetHitCount() <= wp_sp->GetIgnoreCount()) +m_should_stop = false; + if (m_should_stop && wp_sp->GetConditionText() != NULL) { // We need to make sure the user sees any parse errors in their condition, so we'll hook the ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13859: [LLDB][LLGS Test] Check length of register, only when its available
mohit.bhakkad updated this revision to Diff 38785. mohit.bhakkad added a comment. Changes in this revision: - Fixed GetUserRegisterCount () to get count registers which are actually present. This will make llgs send E45 when reg_index is of some unavailable reg. Repository: rL LLVM http://reviews.llvm.org/D13859 Files: source/Plugins/Process/Utility/RegisterContextLinux_mips.cpp source/Plugins/Process/Utility/RegisterContextLinux_mips.h source/Plugins/Process/Utility/RegisterContextLinux_mips64.cpp source/Plugins/Process/Utility/RegisterContextLinux_mips64.h Index: source/Plugins/Process/Utility/RegisterContextLinux_mips64.h === --- source/Plugins/Process/Utility/RegisterContextLinux_mips64.h +++ source/Plugins/Process/Utility/RegisterContextLinux_mips64.h @@ -19,7 +19,7 @@ : public lldb_private::RegisterInfoInterface { public: -RegisterContextLinux_mips64(const lldb_private::ArchSpec _arch); +RegisterContextLinux_mips64(const lldb_private::ArchSpec _arch, bool msa_present = true); size_t GetGPRSize() const override; Index: source/Plugins/Process/Utility/RegisterContextLinux_mips64.cpp === --- source/Plugins/Process/Utility/RegisterContextLinux_mips64.cpp +++ source/Plugins/Process/Utility/RegisterContextLinux_mips64.cpp @@ -75,27 +75,31 @@ } uint32_t -GetUserRegisterInfoCount (const ArchSpec _arch) +GetUserRegisterInfoCount (const ArchSpec _arch, bool msa_present) { switch (target_arch.GetMachine()) { case llvm::Triple::mips: case llvm::Triple::mipsel: -return static_cast (k_num_user_registers_mips); +if (msa_present) +return static_cast (k_num_user_registers_mips); +return static_cast (k_num_user_registers_mips - k_num_msa_registers_mips); case llvm::Triple::mips64el: case llvm::Triple::mips64: -return static_cast (k_num_user_registers_mips64); +if (msa_present) +return static_cast (k_num_user_registers_mips64); +return static_cast (k_num_user_registers_mips64 - k_num_msa_registers_mips64); default: assert(false && "Unhandled target architecture."); return 0; } } -RegisterContextLinux_mips64::RegisterContextLinux_mips64(const ArchSpec _arch) : +RegisterContextLinux_mips64::RegisterContextLinux_mips64(const ArchSpec _arch, bool msa_present) : lldb_private::RegisterInfoInterface(target_arch), m_register_info_p (GetRegisterInfoPtr (target_arch)), m_register_info_count (GetRegisterInfoCount (target_arch)), -m_user_register_count (GetUserRegisterInfoCount (target_arch)) +m_user_register_count (GetUserRegisterInfoCount (target_arch, msa_present)) { } Index: source/Plugins/Process/Utility/RegisterContextLinux_mips.h === --- source/Plugins/Process/Utility/RegisterContextLinux_mips.h +++ source/Plugins/Process/Utility/RegisterContextLinux_mips.h @@ -17,7 +17,7 @@ : public lldb_private::RegisterInfoInterface { public: -RegisterContextLinux_mips(const lldb_private::ArchSpec _arch); +RegisterContextLinux_mips(const lldb_private::ArchSpec _arch, bool msa_present = true); size_t GetGPRSize() const override; @@ -30,6 +30,9 @@ uint32_t GetUserRegisterCount () const override; + +private: +uint32_t m_user_register_count; }; #endif Index: source/Plugins/Process/Utility/RegisterContextLinux_mips.cpp === --- source/Plugins/Process/Utility/RegisterContextLinux_mips.cpp +++ source/Plugins/Process/Utility/RegisterContextLinux_mips.cpp @@ -29,8 +29,17 @@ #include "RegisterInfos_mips.h" #undef DECLARE_REGISTER_INFOS_MIPS_STRUCT -RegisterContextLinux_mips::RegisterContextLinux_mips(const ArchSpec _arch) : -RegisterInfoInterface(target_arch) +uint32_t +GetUserRegisterInfoCount (bool msa_present) +{ +if (msa_present) +return static_cast (k_num_user_registers_mips); +return static_cast (k_num_user_registers_mips - k_num_msa_registers_mips); +} + +RegisterContextLinux_mips::RegisterContextLinux_mips(const ArchSpec _arch, bool msa_present) : +RegisterInfoInterface(target_arch), +m_user_register_count (GetUserRegisterInfoCount (msa_present)) { } @@ -63,5 +72,5 @@ uint32_t RegisterContextLinux_mips::GetUserRegisterCount () const { -return static_cast (k_num_user_registers_mips); +return static_cast (m_user_register_count); } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13296: [LLDB] Fix watchpoint ignore feature for architectures with watchpoint_exceptions_received=before
mohit.bhakkad requested a review of this revision. mohit.bhakkad added a comment. > Note, if you end up going with the current patch, isn't quite right, however. > You need to move the check for the watchpoint ignore count up before > printing out the old & new values. An ignored watchpoint shouldn't print > anything, it should be as if it never stopped. Where you have the check, the > old & new values will get printed even if the watchpoint is ignored. Hi @jingham, I re-checked it today, we are not printing anything when we ignore a watchpoint. Repository: rL LLVM http://reviews.llvm.org/D13296 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D12877: [LLDB] Switch to assembly view if source is moved
mohit.bhakkad updated this revision to Diff 38799. mohit.bhakkad added a comment. Changes in this revision: - changed no-source to no-debuginfo and made it default - now no-source means display assembly if source file is missing, even if debug-info is present. Repository: rL LLVM http://reviews.llvm.org/D12877 Files: source/Core/Debugger.cpp source/Target/StackFrame.cpp Index: source/Target/StackFrame.cpp === --- source/Target/StackFrame.cpp +++ source/Target/StackFrame.cpp @@ -1487,7 +1487,7 @@ if (show_source) { ExecutionContext exe_ctx (shared_from_this()); -bool have_source = false; +bool have_source = false, have_debuginfo = false; Debugger::StopDisassemblyType disasm_display = Debugger::eStopDisassemblyTypeNever; Target *target = exe_ctx.GetTargetPtr(); if (target) @@ -1500,26 +1500,35 @@ GetSymbolContext(eSymbolContextCompUnit | eSymbolContextLineEntry); if (m_sc.comp_unit && m_sc.line_entry.IsValid()) { -have_source = true; +have_debuginfo = true; if (source_lines_before > 0 || source_lines_after > 0) { - target->GetSourceManager().DisplaySourceLinesWithLineNumbers (m_sc.line_entry.file, +size_t num_lines = target->GetSourceManager().DisplaySourceLinesWithLineNumbers (m_sc.line_entry.file, m_sc.line_entry.line, source_lines_before, source_lines_after, "->", ); +if (num_lines != 0) +have_source = true; +// TODO: Give here a one time warning if source file is missing. } } switch (disasm_display) { case Debugger::eStopDisassemblyTypeNever: break; - + +case Debugger::eStopDisassemblyTypeNoDebugInfo: +if (have_debuginfo) +break; +// Fall through to next case + case Debugger::eStopDisassemblyTypeNoSource: if (have_source) break; // Fall through to next case + case Debugger::eStopDisassemblyTypeAlways: if (target) { Index: source/Core/Debugger.cpp === --- source/Core/Debugger.cpp +++ source/Core/Debugger.cpp @@ -86,9 +86,10 @@ OptionEnumValueElement g_show_disassembly_enum_values[] = { -{ Debugger::eStopDisassemblyTypeNever,"never", "Never show disassembly when displaying a stop context."}, -{ Debugger::eStopDisassemblyTypeNoSource, "no-source", "Show disassembly when there is no source information, or the source file is missing when displaying a stop context."}, -{ Debugger::eStopDisassemblyTypeAlways, "always","Always show disassembly when displaying a stop context."}, +{ Debugger::eStopDisassemblyTypeNever, "never","Never show disassembly when displaying a stop context."}, +{ Debugger::eStopDisassemblyTypeNoDebugInfo,"no-debuginfo", "Show disassembly when there is no debug information."}, +{ Debugger::eStopDisassemblyTypeNoSource, "no-source","Show disassembly when there is no source information, or the source file is missing when displaying a stop context."}, +{ Debugger::eStopDisassemblyTypeAlways, "always", "Always show disassembly when displaying a stop context."}, { 0, NULL, NULL } }; @@ -150,7 +151,7 @@ { "prompt", OptionValue::eTypeString , true, OptionValueString::eOptionEncodeCharacterEscapeSequences, "(lldb) ", NULL, "The debugger command line prompt displayed for the user." }, { "script-lang", OptionValue::eTypeEnum, true, eScriptLanguagePython, NULL, g_language_enumerators, "The script language to be used for evaluating user-written scripts." }, { "stop-disassembly-count", OptionValue::eTypeSInt64 , true, 4, NULL, NULL, "The number of disassembly lines to show when displaying a stopped context." }, -{ "stop-disassembly-display", OptionValue::eTypeEnum, true, Debugger::eStopDisassemblyTypeNoSource, NULL, g_show_disassembly_enum_values, "Control when to display disassembly when displaying a stopped context." }, +{ "stop-disassembly-display", OptionValue::eTypeEnum
Re: [Lldb-commits] [PATCH] D13296: [LLDB] Fix watchpoint ignore feature for architectures with watchpoint_exceptions_received=before
mohit.bhakkad added a comment. In http://reviews.llvm.org/D13296#265608, @jingham wrote: > This change alters the timing for the handling of ignore counts for > watchpoints. The original implementation (and the way ignore counts work for > breakpoints) is that the breakpoint's ignore count gets checked during the > "synchronous" phase of breakpoint stop evaluation. So it happens when the > private stop event is received, and if the ignore count is not satisfied then > a public event is not generated. > > Your version will move the decision making to the async ShouldStop, i.e. when > an event is getting pulled from the public event queue. If these were > breakpoints it would mean that the synchronous callbacks would still fire > even if they fail their ignore count test. Watchpoints don't currently have > synchronous callbacks - and I'm not sure we would ever need to support that. > If you moved the adjustment code you do in PerformAction to the synchronous > callback (Watchpoint::ShouldStop) that would keep breakpoints & watchpoints > behaving symmetrically. It's worth trying that, I am pretty sure that will > be a safe place to do your little dance. But if it isn't, then I don't mind > having it in PerformAction provided you put a note to that effect somewhere > obvious in Watchpoint.h. Hi @jingham, I tried to move adjustment code to ShouldStopSynchronous before we call ShouldStop, but its not getting stepped to next PC. Looks like threadplan are not active in that phase of code. Could you suggest anything wrong I may be doing or should I resubmit this patch by putting condition code before we print anything. > Note, if you end up going with the current patch, isn't quite right, however. > You need to move the check for the watchpoint ignore count up before > printing out the old & new values. An ignored watchpoint shouldn't print > anything, it should be as if it never stopped. Where you have the check, the > old & new values will get printed even if the watchpoint is ignored. Repository: rL LLVM http://reviews.llvm.org/D13296 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13646: [LLDB] Don't use signo as key in Signals DenseMap, as signo are not unique
This revision was automatically updated to reflect the committed changes. Closed by commit rL250801: [LLDB] Insert names with same signo as alias instead of a new entry (authored by mohit.bhakkad). Changed prior to commit: http://reviews.llvm.org/D13646?vs=37469=37828#toc Repository: rL LLVM http://reviews.llvm.org/D13646 Files: lldb/trunk/include/lldb/Target/UnixSignals.h lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp lldb/trunk/source/Plugins/Process/Utility/FreeBSDSignals.cpp lldb/trunk/source/Plugins/Process/Utility/LinuxSignals.cpp lldb/trunk/source/Plugins/Process/Utility/MipsLinuxSignals.cpp lldb/trunk/source/Target/UnixSignals.cpp Index: lldb/trunk/include/lldb/Target/UnixSignals.h === --- lldb/trunk/include/lldb/Target/UnixSignals.h +++ lldb/trunk/include/lldb/Target/UnixSignals.h @@ -98,19 +98,22 @@ int32_t GetSignalAtIndex(int32_t index) const; +ConstString +GetShortName(ConstString name) const; + // We assume that the elements of this object are constant once it is constructed, // since a process should never need to add or remove symbols as it runs. So don't // call these functions anywhere but the constructor of your subclass of UnixSignals or in // your Process Plugin's GetUnixSignals method before you return the UnixSignal object. void AddSignal (int signo, const char *name, - const char *short_name, bool default_suppress, bool default_stop, bool default_notify, - const char *description); + const char *description, + const char *alias = nullptr); void RemoveSignal (int signo); @@ -123,18 +126,18 @@ struct Signal { ConstString m_name; -ConstString m_short_name; +ConstString m_alias; std::string m_description; bool m_suppress:1, m_stop:1, m_notify:1; Signal (const char *name, -const char *short_name, bool default_suppress, bool default_stop, bool default_notify, -const char *description); +const char *description, +const char *alias); ~Signal () {} }; Index: lldb/trunk/source/Target/UnixSignals.cpp === --- lldb/trunk/source/Target/UnixSignals.cpp +++ lldb/trunk/source/Target/UnixSignals.cpp @@ -25,18 +25,18 @@ UnixSignals::Signal::Signal ( const char *name, -const char *short_name, bool default_suppress, bool default_stop, bool default_notify, -const char *description +const char *description, +const char *alias ) : m_name (name), -m_short_name (short_name), m_description (), m_suppress (default_suppress), m_stop (default_stop), -m_notify (default_notify) +m_notify (default_notify), +m_alias (alias) { if (description) m_description.assign (description); @@ -97,54 +97,54 @@ // order, you can either subclass this class, and use Add & Remove to change them // or you can subclass and build them afresh in your constructor; m_signals.clear(); -//SIGNO NAME SHORT NAME SUPPRESS STOP NOTIFY DESCRIPTION -//== == == == === -AddSignal (1,"SIGHUP","HUP", false, true , true , "hangup"); -AddSignal (2,"SIGINT","INT", true , true , true , "interrupt"); -AddSignal (3,"SIGQUIT", "QUIT",false, true , true , "quit"); -AddSignal (4,"SIGILL","ILL", false, true , true , "illegal instruction"); -AddSignal (5,"SIGTRAP", "TRAP",true , true , true , "trace trap (not reset when caught)"); -AddSignal (6,"SIGABRT", "ABRT",false, true , true , "abort()"); -AddSignal (7,"SIGEMT","EMT", false, true , true , "pollable event"); -AddSignal (8,"SIGFPE","FPE", false, true , true , "floating point exception"); -AddSignal (9,"SIGKILL", "KILL",false, true , true , "kill"); -AddSignal (10, "SIGBUS","BUS", false, true , true , "bus error"); -AddSignal (11, "SIGSEGV", "SEGV",false, true , true , "segmentation violation"); -AddSignal (12, "SIGSYS","SYS", false, true , true , "bad argument to system call"); -AddSignal (13, "SIGPIPE", "PIPE",false, true , true , "write on a pipe with no one to read it"); -AddSignal (14, "SIGALRM", "ALRM",false, false, false, "alarm clock"); -AddSignal (15, "SIGTERM", "TERM",false, true , true , "software termination signal from kill"); -AddSignal (16, "SIGURG",
Re: [Lldb-commits] [PATCH] D13859: [LLDB][LLGS Test] Check length of register, only when its available
mohit.bhakkad updated this revision to Diff 37843. mohit.bhakkad added a comment. This patch makes server send an End of register(E45) response if a register present in reginfo is not available on actual machine. Repository: rL LLVM http://reviews.llvm.org/D13859 Files: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp === --- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp +++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp @@ -1518,6 +1518,12 @@ if (!reg_info) return SendErrorResponse (69); +// Try reading the register, return end of registers response if failed to read. +RegisterValue reg_value; +Error error = reg_context_sp->ReadRegister (reg_info, reg_value); +if (error.Fail()) +return SendErrorResponse (69); + // Build the reginfos response. StreamGDBRemote response; Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp === --- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp +++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp @@ -1518,6 +1518,12 @@ if (!reg_info) return SendErrorResponse (69); +// Try reading the register, return end of registers response if failed to read. +RegisterValue reg_value; +Error error = reg_context_sp->ReadRegister (reg_info, reg_value); +if (error.Fail()) +return SendErrorResponse (69); + // Build the reginfos response. StreamGDBRemote response; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13646: [LLDB] Don't use signo as key in Signals DenseMap, as signo are not unique
mohit.bhakkad added a comment. In http://reviews.llvm.org/D13646#267953, @labath wrote: > This looks much better, I just have a couple of small remarks. @labath addressed these while committing. Repository: rL LLVM http://reviews.llvm.org/D13646 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D13859: [LLDB][LLGS Test] Check length of register, only when its available
mohit.bhakkad created this revision. mohit.bhakkad added reviewers: clayborg, zturner. mohit.bhakkad added subscribers: jaydeep, bhushan, sagar, nitesh.jain, lldb-commits. mohit.bhakkad set the repository for this revision to rL LLVM. Some machines of an arch may not have all the regs listed for it in RegInfo, and we get 'E15' as error while reading from such register, i.e. its not available. For example MSA registers listed for MIPS are not present in all MIPS boards. Repository: rL LLVM http://reviews.llvm.org/D13859 Files: test/tools/lldb-server/TestLldbGdbServer.py Index: test/tools/lldb-server/TestLldbGdbServer.py === --- test/tools/lldb-server/TestLldbGdbServer.py +++ test/tools/lldb-server/TestLldbGdbServer.py @@ -667,7 +667,8 @@ # Verify the response length. p_response = context.get("p_response") self.assertIsNotNone(p_response) -self.assertEquals(len(p_response), 2 * int(reg_info["bitsize"]) / 8) +if (p_response != 'E15'): # Check if register is available +self.assertEquals(len(p_response), 2 * int(reg_info["bitsize"]) / 8) # Increment loop reg_index += 1 Index: test/tools/lldb-server/TestLldbGdbServer.py === --- test/tools/lldb-server/TestLldbGdbServer.py +++ test/tools/lldb-server/TestLldbGdbServer.py @@ -667,7 +667,8 @@ # Verify the response length. p_response = context.get("p_response") self.assertIsNotNone(p_response) -self.assertEquals(len(p_response), 2 * int(reg_info["bitsize"]) / 8) +if (p_response != 'E15'): # Check if register is available +self.assertEquals(len(p_response), 2 * int(reg_info["bitsize"]) / 8) # Increment loop reg_index += 1 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13646: [LLDB] Don't use signo as key in Signals DenseMap, as signo are not unique
mohit.bhakkad added inline comments. Comment at: include/lldb/Target/UnixSignals.h:101-102 @@ -100,1 +100,4 @@ +ConstString +GetShortName(ConstString name) const; + clayborg wrote: > Why are we doing this by name? shouldn't we do this with the signal number? > And shouldn't this be named GetSignalAlias()? Hi @clayborg, sorry, I didn't write proper description while submitting this patch. Here alias and short_name are two different things. As eg. for signal SIGCHLD, SIGCLD is an alias and CHLD is the short_name. For providing alias, I have added a default argument called "alias" in function AddSignal, which will be stored in variable m_alias. Now for short_name, we have another variable short_name. But for signals with alias, like SIGCHLD, we will have 2 short_names, i.e. CHLD and CLD. But if we observe, we can see that short_name is just signal_name with first 3 letters removed, which can solve our problem. So instead of hardcoding short_names inmap, we can use this function to get it at run time. Repository: rL LLVM http://reviews.llvm.org/D13646 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13296: [LLDB] Fix watchpoint ignore feature for architectures with watchpoint_exceptions_received=before
mohit.bhakkad added a subscriber: clayborg. mohit.bhakkad added a comment. In http://reviews.llvm.org/D13296#260030, @clayborg wrote: > I will defer to Jim Ingham on this one. @jingham could you please review this. Repository: rL LLVM http://reviews.llvm.org/D13296 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13202: [LLDB] Fix display of value of a vector variables in watchpoint operations
mohit.bhakkad added a comment. @loladiro @zturner Thanks for pointing this out, fixed it in http://reviews.llvm.org/rL249897 Repository: rL LLVM http://reviews.llvm.org/D13202 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13202: [LLDB] Fix display of value of a vector variables in watchpoint operations
This revision was automatically updated to reflect the committed changes. Closed by commit rL249838: [LLDB] Fix display of value of a vector variables in watchpoint operations (authored by mohit.bhakkad). Changed prior to commit: http://reviews.llvm.org/D13202?vs=36837=36952#toc Repository: rL LLVM http://reviews.llvm.org/D13202 Files: lldb/trunk/source/Breakpoint/Watchpoint.cpp lldb/trunk/watchpoint/watchpoint_on_vectors/Makefile lldb/trunk/watchpoint/watchpoint_on_vectors/TestValueOfVectorVariable.py lldb/trunk/watchpoint/watchpoint_on_vectors/main.c Index: lldb/trunk/watchpoint/watchpoint_on_vectors/main.c === --- lldb/trunk/watchpoint/watchpoint_on_vectors/main.c +++ lldb/trunk/watchpoint/watchpoint_on_vectors/main.c @@ -0,0 +1,14 @@ +//===-- main.c --*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// +typedef short v8i16 __attribute__ ((vector_size(16))); +v8i16 global_vector = {1, 2, 3, 4, 5, 6, 7, 8}; + +int main() +{ +} Index: lldb/trunk/watchpoint/watchpoint_on_vectors/TestValueOfVectorVariable.py === --- lldb/trunk/watchpoint/watchpoint_on_vectors/TestValueOfVectorVariable.py +++ lldb/trunk/watchpoint/watchpoint_on_vectors/TestValueOfVectorVariable.py @@ -0,0 +1,56 @@ +""" +Test displayed value of a vector variable while doing watchpoint operations +""" + +import os, time +import unittest2 +import lldb +from lldbtest import * +import lldbutil + +class TestValueOfVectorVariableTestCase(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +@dsym_test +def test_value_of_vector_variable_with_dsym_using_watchpoint_set(self): +"""Test verify displayed value of vector variable.""" +self.buildDsym(dictionary=self.d) +self.setTearDownCleanup(dictionary=self.d) +self.value_of_vector_variable_with_watchpoint_set() + +@dwarf_test +def test_value_of_vector_variable_with_dwarf_using_watchpoint_set(self): +"""Test verify displayed value of vector variable.""" +self.buildDwarf(dictionary=self.d) +self.setTearDownCleanup(dictionary=self.d) +self.value_of_vector_variable_with_watchpoint_set() + +def setUp(self): +# Call super's setUp(). +TestBase.setUp(self) +# Our simple source filename. +self.source = 'main.c' +self.exe_name = 'a.out' +self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name} + +def value_of_vector_variable_with_watchpoint_set(self): +"""Test verify displayed value of vector variable""" +exe = os.path.join(os.getcwd(), 'a.out') +self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) + +# Set break to get a frame +self.runCmd("b main") + +# Run the program. +self.runCmd("run", RUN_SUCCEEDED) + +# Value of a vector variable should be displayed correctly +self.expect("watchpoint set variable global_vector", WATCHPOINT_CREATED, +substrs = ['new value: (1, 2, 3, 4, 5, 6, 7, 8)']) + +if __name__ == '__main__': +import atexit +lldb.SBDebugger.Initialize() +atexit.register(lambda: lldb.SBDebugger.Terminate()) +unittest2.main() Index: lldb/trunk/watchpoint/watchpoint_on_vectors/Makefile === --- lldb/trunk/watchpoint/watchpoint_on_vectors/Makefile +++ lldb/trunk/watchpoint/watchpoint_on_vectors/Makefile @@ -0,0 +1,5 @@ +LEVEL = ../../../make + +C_SOURCES := main.c + +include $(LEVEL)/Makefile.rules Index: lldb/trunk/source/Breakpoint/Watchpoint.cpp === --- lldb/trunk/source/Breakpoint/Watchpoint.cpp +++ lldb/trunk/source/Breakpoint/Watchpoint.cpp @@ -218,14 +218,31 @@ s->Printf("\nWatchpoint %u hit:", GetID()); prefix = ""; } - + if (m_old_value_sp) { -s->Printf("\n%sold value: %s", prefix, m_old_value_sp->GetValueAsCString()); +const char *old_value_cstr = m_old_value_sp->GetValueAsCString(); +if (old_value_cstr && old_value_cstr[0]) +s->Printf("\n%sold value: %s", prefix, old_value_cstr); +else +{ +const char *old_summary_cstr = m_old_value_sp-> GetSummaryAsCString(); +if (old_summary_cstr && old_summary_cstr[0]) +s->Printf("\n%sold value: %s", prefix, old_summary_cstr); +} } + if (m_new_value_sp) { -s->Printf("\n%snew value: %s", prefix, m_new_value_sp->GetValueAsCString()); +const char *new_value_cstr =
[Lldb-commits] [PATCH] D13548: [LLDB][MIPS] fix watchpoint searched on client side for same masked variables
mohit.bhakkad created this revision. mohit.bhakkad added reviewers: clayborg, jingham. mohit.bhakkad added subscribers: jaydeep, bhushan, sagar, nitesh.jain, lldb-commits. mohit.bhakkad set the repository for this revision to rL LLVM. On MIPS architecture, it is possible to use same hardware register for 2 different variables with same watch mask(address & ~7). wp_addr passed by server is sometime of other same masked variable, so we always rely on wp_hit_addr to search the correct watchpoint. Repository: rL LLVM http://reviews.llvm.org/D13548 Files: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp === --- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -2105,6 +2105,8 @@ watch_id_t watch_id = LLDB_INVALID_WATCH_ID; if (wp_addr != LLDB_INVALID_ADDRESS) { +if(wp_hit_addr != LLDB_INVALID_ADDRESS) +wp_addr = wp_hit_addr; WatchpointSP wp_sp = GetTarget().GetWatchpointList().FindByAddress(wp_addr); if (wp_sp) { Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp === --- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -2105,6 +2105,8 @@ watch_id_t watch_id = LLDB_INVALID_WATCH_ID; if (wp_addr != LLDB_INVALID_ADDRESS) { +if(wp_hit_addr != LLDB_INVALID_ADDRESS) +wp_addr = wp_hit_addr; WatchpointSP wp_sp = GetTarget().GetWatchpointList().FindByAddress(wp_addr); if (wp_sp) { ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13241: [LLDB][MIPS] Fix hit_count for mips watchpoints
This revision was automatically updated to reflect the committed changes. Closed by commit rL249377: [LLDB][MIPS] Fix hit_count for mips watchpoints (authored by mohit.bhakkad). Changed prior to commit: http://reviews.llvm.org/D13241?vs=35958=36583#toc Repository: rL LLVM http://reviews.llvm.org/D13241 Files: lldb/trunk/source/Target/StopInfo.cpp Index: lldb/trunk/source/Target/StopInfo.cpp === --- lldb/trunk/source/Target/StopInfo.cpp +++ lldb/trunk/source/Target/StopInfo.cpp @@ -757,9 +757,12 @@ { WatchpointSP wp_hit_sp = thread_sp->CalculateTarget()->GetWatchpointList().FindByAddress(m_watch_hit_addr); if (!wp_hit_sp) +{ m_should_stop = false; +wp_sp->IncrementFalseAlarmsAndReviseHitCount(); +} } - + if (m_should_stop && wp_sp->GetConditionText() != NULL) { // We need to make sure the user sees any parse errors in their condition, so we'll hook the Index: lldb/trunk/source/Target/StopInfo.cpp === --- lldb/trunk/source/Target/StopInfo.cpp +++ lldb/trunk/source/Target/StopInfo.cpp @@ -757,9 +757,12 @@ { WatchpointSP wp_hit_sp = thread_sp->CalculateTarget()->GetWatchpointList().FindByAddress(m_watch_hit_addr); if (!wp_hit_sp) +{ m_should_stop = false; +wp_sp->IncrementFalseAlarmsAndReviseHitCount(); +} } - + if (m_should_stop && wp_sp->GetConditionText() != NULL) { // We need to make sure the user sees any parse errors in their condition, so we'll hook the ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13335: [LLDB][MIPS] Skip invalid size watchpoint testcase for MIPS
This revision was automatically updated to reflect the committed changes. Closed by commit rL249299: [LLDB][MIPS] Skip invalid size watchpoint testcase for MIPS (authored by mohit.bhakkad). Changed prior to commit: http://reviews.llvm.org/D13335?vs=36212=36498#toc Repository: rL LLVM http://reviews.llvm.org/D13335 Files: lldb/trunk/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py Index: lldb/trunk/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py === --- lldb/trunk/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py +++ lldb/trunk/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py @@ -87,6 +87,7 @@ @python_api_test @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported +@skipIf(archs=['mips', 'mipsel', 'mips64', 'mips64el']) # No size constraint on MIPS for watches def test_watch_address_with_invalid_watch_size(self): """Exercise SBTarget.WatchAddress() API but pass an invalid watch_size.""" self.build() Index: lldb/trunk/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py === --- lldb/trunk/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py +++ lldb/trunk/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py @@ -87,6 +87,7 @@ @python_api_test @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported +@skipIf(archs=['mips', 'mipsel', 'mips64', 'mips64el']) # No size constraint on MIPS for watches def test_watch_address_with_invalid_watch_size(self): """Exercise SBTarget.WatchAddress() API but pass an invalid watch_size.""" self.build() ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D13335: [LLDB][MIPS] Skip invalid size watchpoint testcase for MIPS
mohit.bhakkad created this revision. mohit.bhakkad added a reviewer: jaydeep. mohit.bhakkad added a subscriber: lldb-commits. mohit.bhakkad set the repository for this revision to rL LLVM. There is no hard constraint on MIPS hardware watches, so skipping this test. Repository: rL LLVM http://reviews.llvm.org/D13335 Files: test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py Index: test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py === --- test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py +++ test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py @@ -87,6 +87,7 @@ @python_api_test @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported +@skipIf(archs=['mips', 'mipsel', 'mips64', 'mips64el']) # No size constraint on MIPS for watches def test_watch_address_with_invalid_watch_size(self): """Exercise SBTarget.WatchAddress() API but pass an invalid watch_size.""" self.build() Index: test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py === --- test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py +++ test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py @@ -87,6 +87,7 @@ @python_api_test @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported +@skipIf(archs=['mips', 'mipsel', 'mips64', 'mips64el']) # No size constraint on MIPS for watches def test_watch_address_with_invalid_watch_size(self): """Exercise SBTarget.WatchAddress() API but pass an invalid watch_size.""" self.build() ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13241: [LLDB][MIPS] Fix hit_count for mips watchpoints
mohit.bhakkad added a comment. Jason, in MIPS watch registers, last 3 bits of watchpoint addresses are masked by IRW(instruction, read, write types) flags, so machine gives exception for any address having other bits same to the actual watch address execept last 3 bits. Comment at line number 749 in below code gives an such example. Zachary, TestMyFirstWatchpoint.py already covers this case. Repository: rL LLVM http://reviews.llvm.org/D13241 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13202: [LLDB] Fix display of value of a vector variables in watchpoint operations
mohit.bhakkad updated this revision to Diff 35879. mohit.bhakkad added a comment. Adding a simple test to check displayed value of vector Repository: rL LLVM http://reviews.llvm.org/D13202 Files: source/Breakpoint/Watchpoint.cpp test/functionalities/watchpoint/watchpoint_on_vectors/Makefile test/functionalities/watchpoint/watchpoint_on_vectors/TestValueOfVectorVariable.py test/functionalities/watchpoint/watchpoint_on_vectors/main.c Index: test/functionalities/watchpoint/watchpoint_on_vectors/main.c === --- /dev/null +++ test/functionalities/watchpoint/watchpoint_on_vectors/main.c @@ -0,0 +1,14 @@ +//===-- main.c --*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// +typedef short v8i16 __attribute__ ((vector_size(16))); +v8i16 global_vector = {1, 2, 3, 4, 5, 6, 7, 8}; + +int main() +{ +} Index: test/functionalities/watchpoint/watchpoint_on_vectors/TestValueOfVectorVariable.py === --- /dev/null +++ test/functionalities/watchpoint/watchpoint_on_vectors/TestValueOfVectorVariable.py @@ -0,0 +1,56 @@ +""" +Test displayed value of a vector variable while doing watchpoint operations +""" + +import os, time +import unittest2 +import lldb +from lldbtest import * +import lldbutil + +class TestValueOfVectorVariableTestCase(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +@dsym_test +def test_value_of_vector_variable_with_dsym_using_watchpoint_set(self): +"""Test verify displayed value of vector variable.""" +self.buildDsym(dictionary=self.d) +self.setTearDownCleanup(dictionary=self.d) +self.value_of_vector_variable_with_watchpoint_set() + +@dwarf_test +def test_value_of_vector_variable_with_dwarf_using_watchpoint_set(self): +"""Test verify displayed value of vector variable.""" +self.buildDwarf(dictionary=self.d) +self.setTearDownCleanup(dictionary=self.d) +self.value_of_vector_variable_with_watchpoint_set() + +def setUp(self): +# Call super's setUp(). +TestBase.setUp(self) +# Our simple source filename. +self.source = 'main.c' +self.exe_name = 'a.out' +self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name} + +def value_of_vector_variable_with_watchpoint_set(self): +"""Test verify displayed value of vector variable""" +exe = os.path.join(os.getcwd(), 'a.out') +self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) + +# Set break to get a frame +self.runCmd("b main") + +# Run the program. +self.runCmd("run", RUN_SUCCEEDED) + +# Value of a vector variable should be displayed correctly +self.expect("watchpoint set variable global_vector", WATCHPOINT_CREATED, +substrs = ['new value: (1, 2, 3, 4, 5, 6, 7, 8)']) + +if __name__ == '__main__': +import atexit +lldb.SBDebugger.Initialize() +atexit.register(lambda: lldb.SBDebugger.Terminate()) +unittest2.main() Index: test/functionalities/watchpoint/watchpoint_on_vectors/Makefile === --- /dev/null +++ test/functionalities/watchpoint/watchpoint_on_vectors/Makefile @@ -0,0 +1,5 @@ +LEVEL = ../../../make + +C_SOURCES := main.c + +include $(LEVEL)/Makefile.rules Index: source/Breakpoint/Watchpoint.cpp === --- source/Breakpoint/Watchpoint.cpp +++ source/Breakpoint/Watchpoint.cpp @@ -218,14 +218,21 @@ s->Printf("\nWatchpoint %u hit:", GetID()); prefix = ""; } - + if (m_old_value_sp) { -s->Printf("\n%sold value: %s", prefix, m_old_value_sp->GetValueAsCString()); +if (m_old_value_sp->GetValueAsCString()) +s->Printf("\n%sold value: %s", prefix, m_old_value_sp->GetValueAsCString()); +else +s->Printf("\n%sold value: %s", prefix, m_old_value_sp->GetSummaryAsCString()); } + if (m_new_value_sp) { -s->Printf("\n%snew value: %s", prefix, m_new_value_sp->GetValueAsCString()); +if (m_new_value_sp->GetValueAsCString()) +s->Printf("\n%snew value: %s", prefix, m_new_value_sp->GetValueAsCString()); +else +s->Printf("\n%snew value: %s", prefix, m_new_value_sp->GetSummaryAsCString()); } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D13202: [LLDB] Fix display of value of a vector variables in watchpoint operations
mohit.bhakkad created this revision. mohit.bhakkad added reviewers: clayborg, granata.enrico. mohit.bhakkad added subscribers: jaydeep, bhushan, sagar, nitesh.jain, lldb-commits. mohit.bhakkad set the repository for this revision to rL LLVM. Consider a vector variable 'v8i16 s0' Right now if we print value of s0, it gives us proper value: (lldb) print s0 (v8i16) $0 = (member 1, member 2, ,member 8) But if we try to set a watchpoint on it, it shows null for its value: (lldb) watchpoint set variable s0 Watchpoint created: Watchpoint 1: addr = size = 16 state = enabled type = w declare @ 'file_name:line_no' watchpoint spec = 's0' new value: (null) Approach used in patch is already used in in function ValueObjectPrinter::GetValueSummaryError, which is called for command 'print s0'. Repository: rL LLVM http://reviews.llvm.org/D13202 Files: source/Breakpoint/Watchpoint.cpp Index: source/Breakpoint/Watchpoint.cpp === --- source/Breakpoint/Watchpoint.cpp +++ source/Breakpoint/Watchpoint.cpp @@ -218,14 +218,21 @@ s->Printf("\nWatchpoint %u hit:", GetID()); prefix = ""; } - + if (m_old_value_sp) { -s->Printf("\n%sold value: %s", prefix, m_old_value_sp->GetValueAsCString()); +if (m_old_value_sp->GetValueAsCString()) +s->Printf("\n%sold value: %s", prefix, m_old_value_sp->GetValueAsCString()); +else +s->Printf("\n%sold value: %s", prefix, m_old_value_sp->GetSummaryAsCString()); } + if (m_new_value_sp) { -s->Printf("\n%snew value: %s", prefix, m_new_value_sp->GetValueAsCString()); +if (m_new_value_sp->GetValueAsCString()) +s->Printf("\n%snew value: %s", prefix, m_new_value_sp->GetValueAsCString()); +else +s->Printf("\n%snew value: %s", prefix, m_new_value_sp->GetSummaryAsCString()); } } Index: source/Breakpoint/Watchpoint.cpp === --- source/Breakpoint/Watchpoint.cpp +++ source/Breakpoint/Watchpoint.cpp @@ -218,14 +218,21 @@ s->Printf("\nWatchpoint %u hit:", GetID()); prefix = ""; } - + if (m_old_value_sp) { -s->Printf("\n%sold value: %s", prefix, m_old_value_sp->GetValueAsCString()); +if (m_old_value_sp->GetValueAsCString()) +s->Printf("\n%sold value: %s", prefix, m_old_value_sp->GetValueAsCString()); +else +s->Printf("\n%sold value: %s", prefix, m_old_value_sp->GetSummaryAsCString()); } + if (m_new_value_sp) { -s->Printf("\n%snew value: %s", prefix, m_new_value_sp->GetValueAsCString()); +if (m_new_value_sp->GetValueAsCString()) +s->Printf("\n%snew value: %s", prefix, m_new_value_sp->GetValueAsCString()); +else +s->Printf("\n%snew value: %s", prefix, m_new_value_sp->GetSummaryAsCString()); } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D12877: [LLDB] Switch to assembly view if source is moved
mohit.bhakkad added a comment. Hi Jason, thanks for your suggestions. Yes, this approach looks good and one time warning should be helpful from users view, I will implement it get back with a patch soon. Repository: rL LLVM http://reviews.llvm.org/D12877 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D12670: [LLDB][MIPS] MIPS load/store instruction emulation for hardware watchpoints
This revision was automatically updated to reflect the committed changes. Closed by commit rL247129: [LLDB][MIPS] MIPS load/store instruction emulation for hardware watchpoints (authored by mohit.bhakkad). Changed prior to commit: http://reviews.llvm.org/D12670?vs=34132=34308#toc Repository: rL LLVM http://reviews.llvm.org/D12670 Files: lldb/trunk/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp lldb/trunk/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.h lldb/trunk/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp lldb/trunk/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h Index: lldb/trunk/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.h === --- lldb/trunk/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.h +++ lldb/trunk/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.h @@ -131,6 +131,12 @@ Emulate_LW (llvm::MCInst& insn); bool +Emulate_LDST_Imm (llvm::MCInst& insn); + +bool +Emulate_LDST_Reg (llvm::MCInst& insn); + +bool Emulate_BEQ (llvm::MCInst& insn); bool Index: lldb/trunk/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp === --- lldb/trunk/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp +++ lldb/trunk/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp @@ -411,6 +411,64 @@ { "LW", ::Emulate_LW, "LW rt,offset(base)" }, //-- +// Load/Store instructions +//-- +/* Following list of emulated instructions are required by implementation of hardware watchpoint + for MIPS in lldb. As we just need the address accessed by instructions, we have generalised + all these instructions in 2 functions depending on their addressing modes */ + +{ "LB", ::Emulate_LDST_Imm, "LBrt, offset(base)" }, +{ "LBE",::Emulate_LDST_Imm, "LBE rt, offset(base)" }, +{ "LBU",::Emulate_LDST_Imm, "LBU rt, offset(base)" }, +{ "LBUE", ::Emulate_LDST_Imm, "LBUE rt, offset(base)" }, +{ "LDC1", ::Emulate_LDST_Imm, "LDC1 ft, offset(base)" }, +{ "LD", ::Emulate_LDST_Imm, "LDrt, offset(base)" }, +{ "LDL",::Emulate_LDST_Imm, "LDL rt, offset(base)" }, +{ "LDR",::Emulate_LDST_Imm, "LDR rt, offset(base)" }, +{ "LLD",::Emulate_LDST_Imm, "LLD rt, offset(base)" }, +{ "LDC2", ::Emulate_LDST_Imm, "LDC2 rt, offset(base)" }, +{ "LDXC1", ::Emulate_LDST_Reg, "LDXC1 fd, index (base)" }, +{ "LH", ::Emulate_LDST_Imm, "LHrt, offset(base)" }, +{ "LHE",::Emulate_LDST_Imm, "LHE rt, offset(base)" }, +{ "LHU",::Emulate_LDST_Imm, "LHU rt, offset(base)" }, +{ "LHUE", ::Emulate_LDST_Imm, "LHUE rt, offset(base)" }, +{ "LL", ::Emulate_LDST_Imm, "LLrt, offset(base)" }, +{ "LLE",::Emulate_LDST_Imm, "LLE rt, offset(base)" }, +{ "LUXC1", ::Emulate_LDST_Reg, "LUXC1 fd, index (base)" }, +{ "LW", ::Emulate_LDST_Imm, "LWrt, offset(base)" }, +{ "LWC1", ::Emulate_LDST_Imm, "LWC1 ft, offset(base)" }, +{ "LWC2", ::Emulate_LDST_Imm, "LWC2 rt, offset(base)" }, +{ "LWE",::Emulate_LDST_Imm, "LWE rt, offset(base)" }, +{ "LWL",::Emulate_LDST_Imm, "LWL rt, offset(base)" }, +{ "LWLE", ::Emulate_LDST_Imm, "LWLE rt, offset(base)" }, +{ "LWR",::Emulate_LDST_Imm, "LWR rt, offset(base)" }, +{ "LWRE", ::Emulate_LDST_Imm, "LWRE rt, offset(base)" }, +{ "LWXC1", ::Emulate_LDST_Reg, "LWXC1 fd, index (base)" }, + +{ "SB", ::Emulate_LDST_Imm, "SBrt, offset(base)" }, +{ "SBE",::Emulate_LDST_Imm, "SBE rt, offset(base)" }, +{ "SC", ::Emulate_LDST_Imm, "SCrt, offset(base)" }, +{ "SCE",::Emulate_LDST_Imm, "SCE rt, offset(base)" }, +{ "SCD",::Emulate_LDST_Imm, "SCD rt, offset(base)" }, +{ "SD", ::Emulate_LDST_Imm, "SDrt, offset(base)" }, +{ "SDL",::Emulate_LDST_Imm, "SDL rt, offset(base)" }, +{ "SDR",::Emulate_LDST_Imm, "SDR rt, offset(base)" }, +{ "SDC1", ::Emulate_LDST_Imm, "SDC1 ft,
Re: [Lldb-commits] [PATCH] D12671: [LLDB][MIPS] Added support for the debugging of N32/O32 applications on MIPS64 target.
This revision was automatically updated to reflect the committed changes. Closed by commit rL247134: [LLDB][MIPS] Added support for the debugging of N32/O32 applications on… (authored by mohit.bhakkad). Changed prior to commit: http://reviews.llvm.org/D12671?vs=34146=34314#toc Repository: rL LLVM http://reviews.llvm.org/D12671 Files: lldb/trunk/include/lldb/Core/ArchSpec.h lldb/trunk/source/Core/ArchSpec.cpp lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Index: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp === --- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -1517,32 +1517,42 @@ I != section_headers.end(); ++I) { static ConstString g_sect_name_gnu_debuglink (".gnu_debuglink"); -const ELFSectionHeaderInfo = *I; -const uint64_t section_size = header.sh_type == SHT_NOBITS ? 0 : header.sh_size; +const ELFSectionHeaderInfo = *I; +const uint64_t section_size = sheader.sh_type == SHT_NOBITS ? 0 : sheader.sh_size; ConstString name(shstr_data.PeekCStr(I->sh_name)); I->section_name = name; if (arch_spec.GetMachine() == llvm::Triple::mips || arch_spec.GetMachine() == llvm::Triple::mipsel || arch_spec.GetMachine() == llvm::Triple::mips64 || arch_spec.GetMachine() == llvm::Triple::mips64el) { -if (header.sh_type == SHT_MIPS_ABIFLAGS) +uint32_t arch_flags = arch_spec.GetFlags (); +DataExtractor data; +if (sheader.sh_type == SHT_MIPS_ABIFLAGS) { -DataExtractor data; -if (section_size && (data.SetData (object_data, header.sh_offset, section_size) == section_size)) + +if (section_size && (data.SetData (object_data, sheader.sh_offset, section_size) == section_size)) { lldb::offset_t ase_offset = 12; // MIPS ABI Flags Version: 0 -uint32_t arch_flags = arch_spec.GetFlags (); arch_flags |= data.GetU32 (_offset); -arch_spec.SetFlags (arch_flags); } } +// Settings appropriate ArchSpec ABI Flags +if (header.e_flags & llvm::ELF::EF_MIPS_ABI2) +{ +arch_flags |= lldb_private::ArchSpec::eMIPSABI_N32; +} +else if (header.e_flags & llvm::ELF::EF_MIPS_ABI_O32) +{ + arch_flags |= lldb_private::ArchSpec::eMIPSABI_O32; +} +arch_spec.SetFlags (arch_flags); } if (name == g_sect_name_gnu_debuglink) { DataExtractor data; -if (section_size && (data.SetData (object_data, header.sh_offset, section_size) == section_size)) +if (section_size && (data.SetData (object_data, sheader.sh_offset, section_size) == section_size)) { lldb::offset_t gnu_debuglink_offset = 0; gnu_debuglink_file = data.GetCStr (_debuglink_offset); @@ -1552,7 +1562,7 @@ } // Process ELF note section entries. -bool is_note_header = (header.sh_type == SHT_NOTE); +bool is_note_header = (sheader.sh_type == SHT_NOTE); // The section header ".note.android.ident" is stored as a // PROGBITS type header but it is actually a note header. @@ -1564,7 +1574,7 @@ { // Allow notes to refine module info. DataExtractor data; -if (section_size && (data.SetData (object_data, header.sh_offset, section_size) == section_size)) +if (section_size && (data.SetData (object_data, sheader.sh_offset, section_size) == section_size)) { Error error = RefineModuleDetailsFromNote (data, arch_spec, uuid); if (error.Fail ()) Index: lldb/trunk/source/Core/ArchSpec.cpp === --- lldb/trunk/source/Core/ArchSpec.cpp +++ lldb/trunk/source/Core/ArchSpec.cpp @@ -602,7 +602,15 @@ { const CoreDefinition *core_def = FindCoreDefinition (m_core); if (core_def) -return core_def->addr_byte_size; +{ + if (core_def->machine == llvm::Triple::mips64 || core_def->machine == llvm::Triple::mips64el) + { +
[Lldb-commits] [PATCH] D12670: [LLDB][MIPS] MIPS load/store instruction emulation for hardware watchpoints
mohit.bhakkad created this revision. mohit.bhakkad added a reviewer: clayborg. mohit.bhakkad added subscribers: jaydeep, bhushan, sagar, nitesh.jain, lldb-commits. mohit.bhakkad set the repository for this revision to rL LLVM. Emulate MIPS32/64 load and store instructions for HW watchpoints. Repository: rL LLVM http://reviews.llvm.org/D12670 Files: source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.h source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h Index: source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h === --- source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h +++ source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h @@ -128,13 +128,13 @@ Emulate_SD (llvm::MCInst& insn); bool -Emulate_SW (llvm::MCInst& insn); +Emulate_LD (llvm::MCInst& insn); bool -Emulate_LW (llvm::MCInst& insn); +Emulate_LDST_Imm (llvm::MCInst& insn); bool -Emulate_LD (llvm::MCInst& insn); +Emulate_LDST_Reg (llvm::MCInst& insn); bool Emulate_BEQ (llvm::MCInst& insn); Index: source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp === --- source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp +++ source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp @@ -486,8 +486,65 @@ { "SD", ::Emulate_SD, "SD rt,offset(rs)" }, { "LD", ::Emulate_LD, "LD rt,offset(base)"}, -{ "SW", ::Emulate_SW, "SW rt,offset(rs)" }, -{ "LW", ::Emulate_LW, "LW rt,offset(rs)" }, + + + +//-- +// Load/Store instructions +//-- +/* Following list of emulated instructions are required by implementation of hardware watchpoint + for MIPS in lldb. As we just need the address accessed by instructions, we have generalised + all these instructions in 2 functions depending on their addressing modes */ + +{ "LB", ::Emulate_LDST_Imm, "LBrt, offset(base)" }, +{ "LBE",::Emulate_LDST_Imm, "LBE rt, offset(base)" }, +{ "LBU",::Emulate_LDST_Imm, "LBU rt, offset(base)" }, +{ "LBUE", ::Emulate_LDST_Imm, "LBUE rt, offset(base)" }, +{ "LDC1", ::Emulate_LDST_Imm, "LDC1 ft, offset(base)" }, +{ "LDL",::Emulate_LDST_Imm, "LDL rt, offset(base)" }, +{ "LDR",::Emulate_LDST_Imm, "LDR rt, offset(base)" }, +{ "LLD",::Emulate_LDST_Imm, "LLD rt, offset(base)" }, +{ "LDC2", ::Emulate_LDST_Imm, "LDC2 rt, offset(base)" }, +{ "LDXC1", ::Emulate_LDST_Reg, "LDXC1 fd, index (base)" }, +{ "LH", ::Emulate_LDST_Imm, "LHrt, offset(base)" }, +{ "LHE",::Emulate_LDST_Imm, "LHE rt, offset(base)" }, +{ "LHU",::Emulate_LDST_Imm, "LHU rt, offset(base)" }, +{ "LHUE", ::Emulate_LDST_Imm, "LHUE rt, offset(base)" }, +{ "LL", ::Emulate_LDST_Imm, "LLrt, offset(base)" }, +{ "LLE",::Emulate_LDST_Imm, "LLE rt, offset(base)" }, +{ "LUXC1", ::Emulate_LDST_Reg, "LUXC1 fd, index (base)" }, +{ "LW", ::Emulate_LDST_Imm, "LWrt, offset(rs)" }, +{ "LWC1", ::Emulate_LDST_Imm, "LWC1 ft, offset(base)" }, +{ "LWC2", ::Emulate_LDST_Imm, "LWC2 rt, offset(base)" }, +{ "LWE",::Emulate_LDST_Imm, "LWE rt, offset(base)" }, +{ "LWL",::Emulate_LDST_Imm, "LWL rt, offset(base)" }, +{ "LWLE", ::Emulate_LDST_Imm, "LWLE rt, offset(base)" }, +{ "LWR",::Emulate_LDST_Imm, "LWR rt, offset(base)" }, +{ "LWRE", ::Emulate_LDST_Imm, "LWRE rt, offset(base)" }, +{ "LWXC1", ::Emulate_LDST_Reg, "LWXC1 fd, index (base)" }, + +{ "SB", ::Emulate_LDST_Imm, "SBrt, offset(base)" }, +{ "SBE",::Emulate_LDST_Imm, "SBE rt, offset(base)" }, +{ "SC", ::Emulate_LDST_Imm, "SCrt, offset(base)" }, +{ "SCE",::Emulate_LDST_Imm, "SCE rt, offset(base)" }, +{ "SCD",::Emulate_LDST_Imm, "SCD rt, offset(base)" }, +{ "SDL",::Emulate_LDST_Imm, "SDL rt,