[Lldb-commits] [lldb] [lldb] Fix ThreadPlanStepOverRange name in log message (PR #94611)
https://github.com/mariannems created https://github.com/llvm/llvm-project/pull/94611 None >From b17a12f78f19e59bce7ee52308502f2eeea4e8cd Mon Sep 17 00:00:00 2001 From: Marianne Mailhot-Sarrasin Date: Wed, 5 Jun 2024 15:56:12 -0400 Subject: [PATCH] [lldb] Fix ThreadPlanStepOverRange name in log message --- lldb/source/Target/ThreadPlanStepOverRange.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/source/Target/ThreadPlanStepOverRange.cpp b/lldb/source/Target/ThreadPlanStepOverRange.cpp index 84f282f1de520..3fe02e0bf4faf 100644 --- a/lldb/source/Target/ThreadPlanStepOverRange.cpp +++ b/lldb/source/Target/ThreadPlanStepOverRange.cpp @@ -355,7 +355,7 @@ bool ThreadPlanStepOverRange::DoPlanExplainsStop(Event *event_ptr) { return_value = NextRangeBreakpointExplainsStop(stop_info_sp); } else { if (log) -log->PutCString("ThreadPlanStepInRange got asked if it explains the " +log->PutCString("ThreadPlanStepOverRange got asked if it explains the " "stop for some reason other than step."); return_value = false; } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r269340 - [LLDB] Added support for PHI nodes to IR interpreter
Author: mamai Date: Thu May 12 15:00:53 2016 New Revision: 269340 URL: http://llvm.org/viewvc/llvm-project?rev=269340=rev Log: [LLDB] Added support for PHI nodes to IR interpreter This allows expressions such as 'i == 1 || i == 2` to be executed using the IR interpreter, instead of relying on JIT code injection (which may not be available on some platforms). Patch by cameron314 Differential Revision: http://reviews.llvm.org/D19124 Added: lldb/trunk/packages/Python/lldbsuite/test/expression_command/ir-interpreter-phi-nodes/ lldb/trunk/packages/Python/lldbsuite/test/expression_command/ir-interpreter-phi-nodes/TestIRInterpreterPHINodes.py lldb/trunk/packages/Python/lldbsuite/test/expression_command/ir-interpreter-phi-nodes/main.cpp Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp lldb/trunk/source/Commands/CommandObjectExpression.h lldb/trunk/source/Expression/IRInterpreter.cpp Added: lldb/trunk/packages/Python/lldbsuite/test/expression_command/ir-interpreter-phi-nodes/TestIRInterpreterPHINodes.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/ir-interpreter-phi-nodes/TestIRInterpreterPHINodes.py?rev=269340=auto == --- lldb/trunk/packages/Python/lldbsuite/test/expression_command/ir-interpreter-phi-nodes/TestIRInterpreterPHINodes.py (added) +++ lldb/trunk/packages/Python/lldbsuite/test/expression_command/ir-interpreter-phi-nodes/TestIRInterpreterPHINodes.py Thu May 12 15:00:53 2016 @@ -0,0 +1,40 @@ +""" +Test PHI nodes work in the IR interpreter. +""" + +import os, os.path + +import lldb +from lldbsuite.test.lldbtest import * +import lldbsuite.test.lldbutil as lldbutil + +class IRInterpreterPHINodesTestCase(TestBase): +mydir = TestBase.compute_mydir(__file__) + +def test_phi_node_support(self): +"""Test support for PHI nodes in the IR interpreter.""" + +self.build() +exe = os.path.join(os.getcwd(), 'a.out') +self.runCmd('file ' + exe, CURRENT_EXECUTABLE_SET) + +# Break on the first assignment to i +line = line_number('main.cpp', 'i = 5') +lldbutil.run_break_set_by_file_and_line(self, 'main.cpp', line, num_expected_locations=1, loc_exact=True) + +self.runCmd('run', RUN_SUCCEEDED) + +# The stop reason of the thread should be breakpoint +self.expect('thread list', STOPPED_DUE_TO_BREAKPOINT, +substrs = ['stopped', 'stop reason = breakpoint']) + +self.runCmd('s') + +# The logical 'or' causes a PHI node to be generated. Execute without JIT +# to test that the interpreter can handle this +self.expect('expr -j 0 -- i == 3 || i == 5', substrs=['true']) + +self.runCmd('s') +self.expect('expr -j 0 -- i == 3 || i == 5', substrs=['false']) +self.runCmd('s') +self.expect('expr -j 0 -- i == 3 || i == 5', substrs=['true']) Added: lldb/trunk/packages/Python/lldbsuite/test/expression_command/ir-interpreter-phi-nodes/main.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/ir-interpreter-phi-nodes/main.cpp?rev=269340=auto == --- lldb/trunk/packages/Python/lldbsuite/test/expression_command/ir-interpreter-phi-nodes/main.cpp (added) +++ lldb/trunk/packages/Python/lldbsuite/test/expression_command/ir-interpreter-phi-nodes/main.cpp Thu May 12 15:00:53 2016 @@ -0,0 +1,17 @@ +//===-- main.cpp *- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +int main() +{ +int i; +i = 5; +i = 2; +i = 3; +return 0; +} Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.cpp?rev=269340=269339=269340=diff == --- lldb/trunk/source/Commands/CommandObjectExpression.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectExpression.cpp Thu May 12 15:00:53 2016 @@ -63,7 +63,8 @@ CommandObjectExpression::CommandOptions: { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "language", 'l', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLanguage, "Specifies the Language to use when parsing the expression. If not set the target.language setting is used." }, { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "apply-fixits", 'X', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLanguage, "If true, simple
Re: [Lldb-commits] [PATCH] D19122: LLDB: Fixed race condition on timeout when stopping private state thread
This revision was automatically updated to reflect the committed changes. Closed by commit rL266733: LLDB: Fixed two race conditions when stopping private state thread (authored by mamai). Changed prior to commit: http://reviews.llvm.org/D19122?vs=54098=54185#toc Repository: rL LLVM http://reviews.llvm.org/D19122 Files: lldb/trunk/include/lldb/Target/Process.h lldb/trunk/source/Target/Process.cpp Index: lldb/trunk/source/Target/Process.cpp === --- lldb/trunk/source/Target/Process.cpp +++ lldb/trunk/source/Target/Process.cpp @@ -4112,11 +4112,8 @@ if (log) log->Printf ("Process::%s (signal = %d)", __FUNCTION__, signal); -// Signal the private state thread. First we should copy this is case the -// thread starts exiting since the private state thread will NULL this out -// when it exits -HostThread private_state_thread(m_private_state_thread); -if (private_state_thread.IsJoinable()) +// Signal the private state thread +if (PrivateStateThreadIsValid()) { TimeValue timeout_time; bool timed_out; @@ -4134,7 +4131,7 @@ { if (timed_out) { -Error error = private_state_thread.Cancel(); +Error error = m_private_state_thread.Cancel(); if (log) log->Printf ("Timed out responding to the control event, cancel got error: \"%s\".", error.AsCString()); } @@ -4145,7 +4142,7 @@ } thread_result_t result = NULL; -private_state_thread.Join(); +m_private_state_thread.Join(); m_private_state_thread.Reset(); } } @@ -4449,7 +4446,6 @@ if (!is_secondary_thread) m_public_run_lock.SetStopped(); m_private_state_control_wait.SetValue (true, eBroadcastAlways); -m_private_state_thread.Reset(); return NULL; } Index: lldb/trunk/include/lldb/Target/Process.h === --- lldb/trunk/include/lldb/Target/Process.h +++ lldb/trunk/include/lldb/Target/Process.h @@ -3310,7 +3310,10 @@ bool PrivateStateThreadIsValid () const { -return m_private_state_thread.IsJoinable(); +lldb::StateType state = m_private_state.GetValue(); +return state != lldb::eStateDetached && + state != lldb::eStateExited && + m_private_state_thread.IsJoinable(); } void Index: lldb/trunk/source/Target/Process.cpp === --- lldb/trunk/source/Target/Process.cpp +++ lldb/trunk/source/Target/Process.cpp @@ -4112,11 +4112,8 @@ if (log) log->Printf ("Process::%s (signal = %d)", __FUNCTION__, signal); -// Signal the private state thread. First we should copy this is case the -// thread starts exiting since the private state thread will NULL this out -// when it exits -HostThread private_state_thread(m_private_state_thread); -if (private_state_thread.IsJoinable()) +// Signal the private state thread +if (PrivateStateThreadIsValid()) { TimeValue timeout_time; bool timed_out; @@ -4134,7 +4131,7 @@ { if (timed_out) { -Error error = private_state_thread.Cancel(); +Error error = m_private_state_thread.Cancel(); if (log) log->Printf ("Timed out responding to the control event, cancel got error: \"%s\".", error.AsCString()); } @@ -4145,7 +4142,7 @@ } thread_result_t result = NULL; -private_state_thread.Join(); +m_private_state_thread.Join(); m_private_state_thread.Reset(); } } @@ -4449,7 +4446,6 @@ if (!is_secondary_thread) m_public_run_lock.SetStopped(); m_private_state_control_wait.SetValue (true, eBroadcastAlways); -m_private_state_thread.Reset(); return NULL; } Index: lldb/trunk/include/lldb/Target/Process.h === --- lldb/trunk/include/lldb/Target/Process.h +++ lldb/trunk/include/lldb/Target/Process.h @@ -3310,7 +3310,10 @@ bool PrivateStateThreadIsValid () const { -return m_private_state_thread.IsJoinable(); +lldb::StateType state = m_private_state.GetValue(); +return state != lldb::eStateDetached && + state != lldb::eStateExited && + m_private_state_thread.IsJoinable(); } void ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r266733 - LLDB: Fixed two race conditions when stopping private state thread
Author: mamai Date: Tue Apr 19 08:21:46 2016 New Revision: 266733 URL: http://llvm.org/viewvc/llvm-project?rev=266733=rev Log: LLDB: Fixed two race conditions when stopping private state thread When stopping the private state thread, there was a race condition between the time the thread exits (resetting the HostThread object) and the time a Join was attempted, especially in the case of a timeout. The previous workaround of copying the HostThread object is not enough, since on a Reset the internal thread stuff gets nulled out regardless of which HostThread object actually has Reset called on it, resulting in an attempt to dereference a null pointer on the subsequent call to Join from the copy as well. Additionally, there was a race between the detach (called when stopping the process) and the stop itself, causing the stop to time out because it was waiting for the private state thread to see the stop state, but it had exited immediately after entering the detached state. Patch by cameron314 Differential Revision: http://reviews.llvm.org/D19122 Modified: lldb/trunk/include/lldb/Target/Process.h lldb/trunk/source/Target/Process.cpp Modified: lldb/trunk/include/lldb/Target/Process.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=266733=266732=266733=diff == --- lldb/trunk/include/lldb/Target/Process.h (original) +++ lldb/trunk/include/lldb/Target/Process.h Tue Apr 19 08:21:46 2016 @@ -3310,7 +3310,10 @@ protected: bool PrivateStateThreadIsValid () const { -return m_private_state_thread.IsJoinable(); +lldb::StateType state = m_private_state.GetValue(); +return state != lldb::eStateDetached && + state != lldb::eStateExited && + m_private_state_thread.IsJoinable(); } void Modified: lldb/trunk/source/Target/Process.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=266733=266732=266733=diff == --- lldb/trunk/source/Target/Process.cpp (original) +++ lldb/trunk/source/Target/Process.cpp Tue Apr 19 08:21:46 2016 @@ -4112,11 +4112,8 @@ Process::ControlPrivateStateThread (uint if (log) log->Printf ("Process::%s (signal = %d)", __FUNCTION__, signal); -// Signal the private state thread. First we should copy this is case the -// thread starts exiting since the private state thread will NULL this out -// when it exits -HostThread private_state_thread(m_private_state_thread); -if (private_state_thread.IsJoinable()) +// Signal the private state thread +if (PrivateStateThreadIsValid()) { TimeValue timeout_time; bool timed_out; @@ -4134,7 +4131,7 @@ Process::ControlPrivateStateThread (uint { if (timed_out) { -Error error = private_state_thread.Cancel(); +Error error = m_private_state_thread.Cancel(); if (log) log->Printf ("Timed out responding to the control event, cancel got error: \"%s\".", error.AsCString()); } @@ -4145,7 +4142,7 @@ Process::ControlPrivateStateThread (uint } thread_result_t result = NULL; -private_state_thread.Join(); +m_private_state_thread.Join(); m_private_state_thread.Reset(); } } @@ -4449,7 +4446,6 @@ Process::RunPrivateStateThread (bool is_ if (!is_secondary_thread) m_public_run_lock.SetStopped(); m_private_state_control_wait.SetValue (true, eBroadcastAlways); -m_private_state_thread.Reset(); return NULL; } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r263233 - Fixed MemoryCache L1 cache flush
Author: mamai Date: Fri Mar 11 07:50:10 2016 New Revision: 263233 URL: http://llvm.org/viewvc/llvm-project?rev=263233=rev Log: Fixed MemoryCache L1 cache flush Use the same method to find the cache line as in Read(). Differential Revision: http://reviews.llvm.org/D18050 Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/ lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/Makefile lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/main.cpp Modified: lldb/trunk/source/Target/Memory.cpp Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/Makefile?rev=263233=auto == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/Makefile (added) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/Makefile Fri Mar 11 07:50:10 2016 @@ -0,0 +1,5 @@ +LEVEL = ../../../make + +CXX_SOURCES := main.cpp + +include $(LEVEL)/Makefile.rules Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py?rev=263233=auto == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py (added) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py Fri Mar 11 07:50:10 2016 @@ -0,0 +1,62 @@ +""" +Test the MemoryCache L1 flush. +""" + +from __future__ import print_function + + + +import os, time +import re +import lldb +from lldbsuite.test.lldbtest import * +import lldbsuite.test.lldbutil as lldbutil + +class MemoryCacheTestCase(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +def setUp(self): +# Call super's setUp(). +TestBase.setUp(self) +# Find the line number to break inside main(). +self.line = line_number('main.cpp', '// Set break point at this line.') + +def test_memory_cache(self): +"""Test the MemoryCache class with a sequence of 'memory read' and 'memory write' operations.""" +self.build() +exe = os.path.join(os.getcwd(), "a.out") +self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) + +# Break in main() after the variables are assigned values. +lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True) + +self.runCmd("run", RUN_SUCCEEDED) + +# The stop reason of the thread should be breakpoint. +self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, +substrs = ['stopped', 'stop reason = breakpoint']) + +# The breakpoint should have a hit count of 1. +self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE, +substrs = [' resolved, hit count = 1']) + +# Read a chunk of memory containing _ints[0]. The number of bytes read +# must be greater than m_L2_cache_line_byte_size to make sure the L1 +# cache is used. +self.runCmd('memory read -f d -c 201 `_ints - 100`') + +# Check the value of my_ints[0] is the same as set in main.cpp. +line = self.res.GetOutput().splitlines()[100] +self.assertTrue(0x0042 == int(line.split(':')[1], 0)) + +# Change the value of my_ints[0] in memory. +self.runCmd("memory write `_ints` AA") + +# Re-read the chunk of memory. The cache line should have been +# flushed because of the 'memory write'. +self.runCmd('memory read -f d -c 201 `_ints - 100`') + +# Check the value of my_ints[0] have been updated correctly. +line = self.res.GetOutput().splitlines()[100] +self.assertTrue(0x00AA == int(line.split(':')[1], 0)) Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/main.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/main.cpp?rev=263233=auto == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/main.cpp (added) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/main.cpp Fri Mar 11 07:50:10 2016 @@ -0,0 +1,14 @@ +//===-- main.cpp *- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +//
Re: [Lldb-commits] [PATCH] D18050: Fixed MemoryCache L1 cache flush
This revision was automatically updated to reflect the committed changes. Closed by commit rL263233: Fixed MemoryCache L1 cache flush (authored by mamai). Changed prior to commit: http://reviews.llvm.org/D18050?vs=50297=50422#toc Repository: rL LLVM http://reviews.llvm.org/D18050 Files: lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/Makefile lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/main.cpp lldb/trunk/source/Target/Memory.cpp Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py === --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py @@ -0,0 +1,62 @@ +""" +Test the MemoryCache L1 flush. +""" + +from __future__ import print_function + + + +import os, time +import re +import lldb +from lldbsuite.test.lldbtest import * +import lldbsuite.test.lldbutil as lldbutil + +class MemoryCacheTestCase(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +def setUp(self): +# Call super's setUp(). +TestBase.setUp(self) +# Find the line number to break inside main(). +self.line = line_number('main.cpp', '// Set break point at this line.') + +def test_memory_cache(self): +"""Test the MemoryCache class with a sequence of 'memory read' and 'memory write' operations.""" +self.build() +exe = os.path.join(os.getcwd(), "a.out") +self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) + +# Break in main() after the variables are assigned values. +lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True) + +self.runCmd("run", RUN_SUCCEEDED) + +# The stop reason of the thread should be breakpoint. +self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, +substrs = ['stopped', 'stop reason = breakpoint']) + +# The breakpoint should have a hit count of 1. +self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE, +substrs = [' resolved, hit count = 1']) + +# Read a chunk of memory containing _ints[0]. The number of bytes read +# must be greater than m_L2_cache_line_byte_size to make sure the L1 +# cache is used. +self.runCmd('memory read -f d -c 201 `_ints - 100`') + +# Check the value of my_ints[0] is the same as set in main.cpp. +line = self.res.GetOutput().splitlines()[100] +self.assertTrue(0x0042 == int(line.split(':')[1], 0)) + +# Change the value of my_ints[0] in memory. +self.runCmd("memory write `_ints` AA") + +# Re-read the chunk of memory. The cache line should have been +# flushed because of the 'memory write'. +self.runCmd('memory read -f d -c 201 `_ints - 100`') + +# Check the value of my_ints[0] have been updated correctly. +line = self.res.GetOutput().splitlines()[100] +self.assertTrue(0x00AA == int(line.split(':')[1], 0)) Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/Makefile === --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/Makefile @@ -0,0 +1,5 @@ +LEVEL = ../../../make + +CXX_SOURCES := main.cpp + +include $(LEVEL)/Makefile.rules Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/main.cpp === --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/main.cpp +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/main.cpp @@ -0,0 +1,14 @@ +//===-- main.cpp *- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +int main () +{ +int my_ints[] = {0x42}; +return 0; // Set break point at this line. +} Index: lldb/trunk/source/Target/Memory.cpp === --- lldb/trunk/source/Target/Memory.cpp +++ lldb/trunk/source/Target/Memory.cpp @@ -78,7 +78,11 @@ if (!m_L1_cache.empty()) { AddrRange flush_range(addr, size); -BlockMap::iterator pos = m_L1_cache.lower_bound(addr); +BlockMap::iterator pos = m_L1_cache.upper_bound(addr); +if (pos != m_L1_cache.begin()) +{ +--pos; +
Re: [Lldb-commits] [PATCH] D18005: Fixed ValueObject::GetExpressionPath() for paths including anonymous struct/union
This revision was automatically updated to reflect the committed changes. Closed by commit rL263166: Fixed ValueObject::GetExpressionPath() for paths including anonymous… (authored by mamai). Changed prior to commit: http://reviews.llvm.org/D18005?vs=50192=50353#toc Repository: rL LLVM http://reviews.llvm.org/D18005 Files: lldb/trunk/packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py lldb/trunk/source/Core/ValueObject.cpp Index: lldb/trunk/source/Core/ValueObject.cpp === --- lldb/trunk/source/Core/ValueObject.cpp +++ lldb/trunk/source/Core/ValueObject.cpp @@ -2536,7 +2536,7 @@ if (!is_deref_of_parent) { ValueObject *non_base_class_parent = GetNonBaseClassParent(); -if (non_base_class_parent) +if (non_base_class_parent && !non_base_class_parent->GetName().IsEmpty()) { CompilerType non_base_class_parent_compiler_type = non_base_class_parent->GetCompilerType(); if (non_base_class_parent_compiler_type) Index: lldb/trunk/packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py === --- lldb/trunk/packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py +++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py @@ -112,6 +112,17 @@ if not error.Success() or value != 0: self.fail ("failed to get the correct value for element a in n") +def test_nest_flat(self): +self.build() +self.common_setup(self.line2) + +# These should display correctly. +self.expect('frame variable n --flat', +substrs = ['n.a = 0', + 'n.b = 2', + 'n.foo.c = 0', + 'n.foo.d = 4']) + def setUp(self): # Call super's setUp(). TestBase.setUp(self) Index: lldb/trunk/source/Core/ValueObject.cpp === --- lldb/trunk/source/Core/ValueObject.cpp +++ lldb/trunk/source/Core/ValueObject.cpp @@ -2536,7 +2536,7 @@ if (!is_deref_of_parent) { ValueObject *non_base_class_parent = GetNonBaseClassParent(); -if (non_base_class_parent) +if (non_base_class_parent && !non_base_class_parent->GetName().IsEmpty()) { CompilerType non_base_class_parent_compiler_type = non_base_class_parent->GetCompilerType(); if (non_base_class_parent_compiler_type) Index: lldb/trunk/packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py === --- lldb/trunk/packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py +++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py @@ -112,6 +112,17 @@ if not error.Success() or value != 0: self.fail ("failed to get the correct value for element a in n") +def test_nest_flat(self): +self.build() +self.common_setup(self.line2) + +# These should display correctly. +self.expect('frame variable n --flat', +substrs = ['n.a = 0', + 'n.b = 2', + 'n.foo.c = 0', + 'n.foo.d = 4']) + def setUp(self): # Call super's setUp(). TestBase.setUp(self) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r263166 - Fixed ValueObject::GetExpressionPath() for paths including anonymous struct/union
Author: mamai Date: Thu Mar 10 16:10:59 2016 New Revision: 263166 URL: http://llvm.org/viewvc/llvm-project?rev=263166=rev Log: Fixed ValueObject::GetExpressionPath() for paths including anonymous struct/union When the parent of an expression is anonymous, skip adding '.' or '->' before the expression name. Differential Revision: http://reviews.llvm.org/D18005 Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py lldb/trunk/source/Core/ValueObject.cpp Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py?rev=263166=263165=263166=diff == --- lldb/trunk/packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py Thu Mar 10 16:10:59 2016 @@ -112,6 +112,17 @@ class AnonymousTestCase(TestBase): if not error.Success() or value != 0: self.fail ("failed to get the correct value for element a in n") +def test_nest_flat(self): +self.build() +self.common_setup(self.line2) + +# These should display correctly. +self.expect('frame variable n --flat', +substrs = ['n.a = 0', + 'n.b = 2', + 'n.foo.c = 0', + 'n.foo.d = 4']) + def setUp(self): # Call super's setUp(). TestBase.setUp(self) Modified: lldb/trunk/source/Core/ValueObject.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=263166=263165=263166=diff == --- lldb/trunk/source/Core/ValueObject.cpp (original) +++ lldb/trunk/source/Core/ValueObject.cpp Thu Mar 10 16:10:59 2016 @@ -2536,7 +2536,7 @@ ValueObject::GetExpressionPath (Stream & if (!is_deref_of_parent) { ValueObject *non_base_class_parent = GetNonBaseClassParent(); -if (non_base_class_parent) +if (non_base_class_parent && !non_base_class_parent->GetName().IsEmpty()) { CompilerType non_base_class_parent_compiler_type = non_base_class_parent->GetCompilerType(); if (non_base_class_parent_compiler_type) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D18050: Fixed MemoryCache L1 cache flush
mamai added a comment. Could someone commit it for me please? I don't have commit access. Repository: rL LLVM http://reviews.llvm.org/D18050 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D18050: Fixed MemoryCache L1 cache flush
mamai created this revision. mamai added a reviewer: clayborg. mamai added a subscriber: lldb-commits. mamai set the repository for this revision to rL LLVM. Use the same method to find the cache line as in Read(). Repository: rL LLVM http://reviews.llvm.org/D18050 Files: packages/Python/lldbsuite/test/functionalities/memory/cache/Makefile packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py packages/Python/lldbsuite/test/functionalities/memory/cache/main.cpp source/Target/Memory.cpp Index: source/Target/Memory.cpp === --- source/Target/Memory.cpp +++ source/Target/Memory.cpp @@ -78,7 +78,11 @@ if (!m_L1_cache.empty()) { AddrRange flush_range(addr, size); -BlockMap::iterator pos = m_L1_cache.lower_bound(addr); +BlockMap::iterator pos = m_L1_cache.upper_bound(addr); +if (pos != m_L1_cache.begin()) +{ +--pos; +} while (pos != m_L1_cache.end()) { AddrRange chunk_range(pos->first, pos->second->GetByteSize()); Index: packages/Python/lldbsuite/test/functionalities/memory/cache/main.cpp === --- /dev/null +++ packages/Python/lldbsuite/test/functionalities/memory/cache/main.cpp @@ -0,0 +1,14 @@ +//===-- main.cpp *- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +int main () +{ +int my_ints[] = {0x42}; +return 0; // Set break point at this line. +} Index: packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py === --- /dev/null +++ packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py @@ -0,0 +1,62 @@ +""" +Test the MemoryCache L1 flush. +""" + +from __future__ import print_function + + + +import os, time +import re +import lldb +from lldbsuite.test.lldbtest import * +import lldbsuite.test.lldbutil as lldbutil + +class MemoryCacheTestCase(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +def setUp(self): +# Call super's setUp(). +TestBase.setUp(self) +# Find the line number to break inside main(). +self.line = line_number('main.cpp', '// Set break point at this line.') + +def test_memory_cache(self): +"""Test the MemoryCache class with a sequence of 'memory read' and 'memory write' operations.""" +self.build() +exe = os.path.join(os.getcwd(), "a.out") +self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) + +# Break in main() after the variables are assigned values. +lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True) + +self.runCmd("run", RUN_SUCCEEDED) + +# The stop reason of the thread should be breakpoint. +self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, +substrs = ['stopped', 'stop reason = breakpoint']) + +# The breakpoint should have a hit count of 1. +self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE, +substrs = [' resolved, hit count = 1']) + +# Read a chunk of memory containing _ints[0]. The number of bytes read +# must be greater than m_L2_cache_line_byte_size to make sure the L1 +# cache is used. +self.runCmd('memory read -f d -c 201 `_ints - 100`') + +# Check the value of my_ints[0] is the same as set in main.cpp. +line = self.res.GetOutput().splitlines()[100] +self.assertTrue(0x0042 == int(line.split(':')[1], 0)) + +# Change the value of my_ints[0] in memory. +self.runCmd("memory write `_ints` AA") + +# Re-read the chunk of memory. The cache line should have been +# flushed because of the 'memory write'. +self.runCmd('memory read -f d -c 201 `_ints - 100`') + +# Check the value of my_ints[0] have been updated correctly. +line = self.res.GetOutput().splitlines()[100] +self.assertTrue(0x00AA == int(line.split(':')[1], 0)) Index: packages/Python/lldbsuite/test/functionalities/memory/cache/Makefile === --- /dev/null +++ packages/Python/lldbsuite/test/functionalities/memory/cache/Makefile @@ -0,0 +1,5 @@ +LEVEL = ../../../make + +CXX_SOURCES := main.cpp + +include $(LEVEL)/Makefile.rules ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D18005: Fixed ValueObject::GetExpressionPath() for paths including anonymous struct/union
mamai added a comment. Thanks! Could someone commit it for me? I don't have commit access. Repository: rL LLVM http://reviews.llvm.org/D18005 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D18005: Fixed ValueObject::GetExpressionPath() for paths including anonymous struct/union
mamai updated this revision to Diff 50192. mamai added a comment. Replaced the test by a new case in lang/c/anonymous test, as suggested by Jim. Is this correct? Repository: rL LLVM http://reviews.llvm.org/D18005 Files: packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py source/Core/ValueObject.cpp Index: source/Core/ValueObject.cpp === --- source/Core/ValueObject.cpp +++ source/Core/ValueObject.cpp @@ -2536,7 +2536,7 @@ if (!is_deref_of_parent) { ValueObject *non_base_class_parent = GetNonBaseClassParent(); -if (non_base_class_parent) +if (non_base_class_parent && !non_base_class_parent->GetName().IsEmpty()) { CompilerType non_base_class_parent_compiler_type = non_base_class_parent->GetCompilerType(); if (non_base_class_parent_compiler_type) Index: packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py === --- packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py +++ packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py @@ -112,6 +112,17 @@ if not error.Success() or value != 0: self.fail ("failed to get the correct value for element a in n") +def test_nest_flat(self): +self.build() +self.common_setup(self.line2) + +# These should display correctly. +self.expect('frame variable n --flat', +substrs = ['n.a = 0', + 'n.b = 2', + 'n.foo.c = 0', + 'n.foo.d = 4']) + def setUp(self): # Call super's setUp(). TestBase.setUp(self) Index: source/Core/ValueObject.cpp === --- source/Core/ValueObject.cpp +++ source/Core/ValueObject.cpp @@ -2536,7 +2536,7 @@ if (!is_deref_of_parent) { ValueObject *non_base_class_parent = GetNonBaseClassParent(); -if (non_base_class_parent) +if (non_base_class_parent && !non_base_class_parent->GetName().IsEmpty()) { CompilerType non_base_class_parent_compiler_type = non_base_class_parent->GetCompilerType(); if (non_base_class_parent_compiler_type) Index: packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py === --- packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py +++ packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py @@ -112,6 +112,17 @@ if not error.Success() or value != 0: self.fail ("failed to get the correct value for element a in n") +def test_nest_flat(self): +self.build() +self.common_setup(self.line2) + +# These should display correctly. +self.expect('frame variable n --flat', +substrs = ['n.a = 0', + 'n.b = 2', + 'n.foo.c = 0', + 'n.foo.d = 4']) + def setUp(self): # Call super's setUp(). TestBase.setUp(self) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D18005: Fixed ValueObject::GetExpressionPath() for paths including anonymous struct/union
mamai added a comment. Sure. Would you have a suggestion of how to call it? Maybe something like variable_flat since it is the command used? Also, is it the right place to add it in functionalities or should it be elsewhere? Repository: rL LLVM http://reviews.llvm.org/D18005 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D18005: Fixed ValueObject::GetExpressionPath() for paths including anonymous struct/union
mamai updated this revision to Diff 50172. mamai added a comment. Fixed test header, removed useless include. Repository: rL LLVM http://reviews.llvm.org/D18005 Files: packages/Python/lldbsuite/test/functionalities/expression_path/Makefile packages/Python/lldbsuite/test/functionalities/expression_path/TestExpressionPath.py packages/Python/lldbsuite/test/functionalities/expression_path/main.cpp source/Core/ValueObject.cpp Index: source/Core/ValueObject.cpp === --- source/Core/ValueObject.cpp +++ source/Core/ValueObject.cpp @@ -2536,7 +2536,7 @@ if (!is_deref_of_parent) { ValueObject *non_base_class_parent = GetNonBaseClassParent(); -if (non_base_class_parent) +if (non_base_class_parent && !non_base_class_parent->GetName().IsEmpty()) { CompilerType non_base_class_parent_compiler_type = non_base_class_parent->GetCompilerType(); if (non_base_class_parent_compiler_type) Index: packages/Python/lldbsuite/test/functionalities/expression_path/main.cpp === --- /dev/null +++ packages/Python/lldbsuite/test/functionalities/expression_path/main.cpp @@ -0,0 +1,26 @@ +//===-- main.cpp *- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +struct S +{ + union + { + unsigned r[2]; + struct { + int x; + int y; + }; + }; +}; + +int main() +{ + struct S s = { 1, 2 }; + return 0; // Set break point at this line. +} \ No newline at end of file Index: packages/Python/lldbsuite/test/functionalities/expression_path/TestExpressionPath.py === --- /dev/null +++ packages/Python/lldbsuite/test/functionalities/expression_path/TestExpressionPath.py @@ -0,0 +1,46 @@ +""" +Test the Expression Path. +""" + +from __future__ import print_function + + + +import os, time +import re +import lldb +from lldbsuite.test.lldbtest import * +import lldbsuite.test.lldbutil as lldbutil + +class ExpressionPathTestCase(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +def setUp(self): +# Call super's setUp(). +TestBase.setUp(self) +# Find the line number to break inside main(). +self.line = line_number('main.cpp', '// Set break point at this line.') + +def test_expression_path(self): +"""Test the GetExpressionPath() function of ValueObject using 'frame variable --flat' command.""" +self.build() +exe = os.path.join(os.getcwd(), "a.out") +self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) + +# Break in main() after the variables are assigned values. +lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True) + +self.runCmd("run", RUN_SUCCEEDED) + +# The stop reason of the thread should be breakpoint. +self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, +substrs = ['stopped', 'stop reason = breakpoint']) + +# The breakpoint should have a hit count of 1. +self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE, +substrs = [' resolved, hit count = 1']) + +self.expect('frame variable s --flat', +substrs = ['s.x = 1', + 's.y = 2']) \ No newline at end of file Index: packages/Python/lldbsuite/test/functionalities/expression_path/Makefile === --- /dev/null +++ packages/Python/lldbsuite/test/functionalities/expression_path/Makefile @@ -0,0 +1,5 @@ +LEVEL = ../../make + +CXX_SOURCES := main.cpp + +include $(LEVEL)/Makefile.rules ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D18005: Fixed ValueObject::GetExpressionPath() for paths including anonymous struct/union
mamai created this revision. mamai added a reviewer: clayborg. mamai added a subscriber: lldb-commits. mamai set the repository for this revision to rL LLVM. When the parent of an expression is anonymous, skip adding '.' or '->' before the expression name. Repository: rL LLVM http://reviews.llvm.org/D18005 Files: packages/Python/lldbsuite/test/functionalities/expression_path/Makefile packages/Python/lldbsuite/test/functionalities/expression_path/TestExpressionPath.py packages/Python/lldbsuite/test/functionalities/expression_path/main.cpp source/Core/ValueObject.cpp Index: source/Core/ValueObject.cpp === --- source/Core/ValueObject.cpp +++ source/Core/ValueObject.cpp @@ -2536,7 +2536,7 @@ if (!is_deref_of_parent) { ValueObject *non_base_class_parent = GetNonBaseClassParent(); -if (non_base_class_parent) +if (non_base_class_parent && !non_base_class_parent->GetName().IsEmpty()) { CompilerType non_base_class_parent_compiler_type = non_base_class_parent->GetCompilerType(); if (non_base_class_parent_compiler_type) Index: packages/Python/lldbsuite/test/functionalities/expression_path/main.cpp === --- /dev/null +++ packages/Python/lldbsuite/test/functionalities/expression_path/main.cpp @@ -0,0 +1,27 @@ +//===-- main.c *- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// +#include + +struct S +{ + union + { + unsigned r[2]; + struct { + int x; + int y; + }; + }; +}; + +int main() +{ + struct S s = { 1, 2 }; + return 0; // Set break point at this line. +} \ No newline at end of file Index: packages/Python/lldbsuite/test/functionalities/expression_path/TestExpressionPath.py === --- /dev/null +++ packages/Python/lldbsuite/test/functionalities/expression_path/TestExpressionPath.py @@ -0,0 +1,46 @@ +""" +Test the Expression Path. +""" + +from __future__ import print_function + + + +import os, time +import re +import lldb +from lldbsuite.test.lldbtest import * +import lldbsuite.test.lldbutil as lldbutil + +class ExpressionPathTestCase(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +def setUp(self): +# Call super's setUp(). +TestBase.setUp(self) +# Find the line number to break inside main(). +self.line = line_number('main.cpp', '// Set break point at this line.') + +def test_expression_path(self): +"""Test the GetExpressionPath() function of ValueObject using 'frame variable --flat' command.""" +self.build() +exe = os.path.join(os.getcwd(), "a.out") +self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) + +# Break in main() after the variables are assigned values. +lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True) + +self.runCmd("run", RUN_SUCCEEDED) + +# The stop reason of the thread should be breakpoint. +self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, +substrs = ['stopped', 'stop reason = breakpoint']) + +# The breakpoint should have a hit count of 1. +self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE, +substrs = [' resolved, hit count = 1']) + +self.expect('frame variable s --flat', +substrs = ['s.x = 1', + 's.y = 2']) \ No newline at end of file Index: packages/Python/lldbsuite/test/functionalities/expression_path/Makefile === --- /dev/null +++ packages/Python/lldbsuite/test/functionalities/expression_path/Makefile @@ -0,0 +1,5 @@ +LEVEL = ../../make + +CXX_SOURCES := main.cpp + +include $(LEVEL)/Makefile.rules ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D17167: Fix bug with register values byte order in expression evaluation
mamai added a comment. Are the changes correct? And if so, could someone commit it for me? I don't have commit access. Repository: rL LLVM http://reviews.llvm.org/D17167 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D17167: Fix bug with register values byte order in expression evaluation
mamai created this revision. mamai added a reviewer: spyffe. mamai added subscribers: phlav, lldb-commits. mamai set the repository for this revision to rL LLVM. The evaluation of expressions containing register values was broken for targets for which endianness differs from host. This patch fixes issues like: (lldb) reg read pc pc = 0x00400020 arithmetic.elf`main + 32 at main.c:12 (lldb) expr -f hex -- $pc (unsigned int) $2 = 0x20004000 Where the second command will now give the right value (0x00400020). Repository: rL LLVM http://reviews.llvm.org/D17167 Files: source/Expression/Materializer.cpp Index: source/Expression/Materializer.cpp === --- source/Expression/Materializer.cpp +++ source/Expression/Materializer.cpp @@ -1275,9 +1275,12 @@ m_register_contents.reset(new DataBufferHeap(register_data.GetDataStart(), register_data.GetByteSize())); Error write_error; - -map.WriteMemory(load_addr, register_data.GetDataStart(), register_data.GetByteSize(), write_error); - + +Scalar scalar; +reg_value.GetScalarValue(scalar); + +map.WriteScalarToMemory(load_addr, scalar, scalar.GetByteSize(), write_error); + if (!write_error.Success()) { err.SetErrorStringWithFormat("couldn't write the contents of register %s: %s", m_register_info.name, write_error.AsCString()); Index: source/Expression/Materializer.cpp === --- source/Expression/Materializer.cpp +++ source/Expression/Materializer.cpp @@ -1275,9 +1275,12 @@ m_register_contents.reset(new DataBufferHeap(register_data.GetDataStart(), register_data.GetByteSize())); Error write_error; - -map.WriteMemory(load_addr, register_data.GetDataStart(), register_data.GetByteSize(), write_error); - + +Scalar scalar; +reg_value.GetScalarValue(scalar); + +map.WriteScalarToMemory(load_addr, scalar, scalar.GetByteSize(), write_error); + if (!write_error.Success()) { err.SetErrorStringWithFormat("couldn't write the contents of register %s: %s", m_register_info.name, write_error.AsCString()); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D16868: [lldb] Fix invalid shift operator overload in Scalar
mamai added a comment. I don't have commit access. It would be great if you can push it for me. Thanks ! Repository: rL LLVM http://reviews.llvm.org/D16868 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D16868: [lldb] Fix invalid shift operator overload in Scalar
mamai added a comment. Scalar::operator<<= works well as-is because it uses APInt <<=(unsigned shiftAmt), whereas the right shift equivalent is not implemented. Should I add APInt >>=, or should I change Scalar::operator<<= for consistency ? Repository: rL LLVM http://reviews.llvm.org/D16868 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D16868: [lldb] Fix invalid shift operator overload in Scalar
mamai added reviewers: labath, tberghammer. mamai updated this revision to Diff 47190. Repository: rL LLVM http://reviews.llvm.org/D16868 Files: source/Core/Scalar.cpp Index: source/Core/Scalar.cpp === --- source/Core/Scalar.cpp +++ source/Core/Scalar.cpp @@ -1875,7 +1875,7 @@ case e_sint128: case e_uint128: { - m_integer >> *rhs.m_integer.getRawData(); + m_integer = m_integer.ashr(*(const uint_t *)rhs.m_integer.getRawData()); break; } } Index: source/Core/Scalar.cpp === --- source/Core/Scalar.cpp +++ source/Core/Scalar.cpp @@ -1875,7 +1875,7 @@ case e_sint128: case e_uint128: { - m_integer >> *rhs.m_integer.getRawData(); + m_integer = m_integer.ashr(*(const uint_t *)rhs.m_integer.getRawData()); break; } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D16868: [lldb] Fix invalid shift operator overload in Scalar
mamai updated this revision to Diff 47218. mamai added a comment. Added a small unit test for scalar right shift operator, which invokes the >>= operator. Repository: rL LLVM http://reviews.llvm.org/D16868 Files: source/Core/Scalar.cpp unittests/CMakeLists.txt unittests/Core/CMakeLists.txt unittests/Core/ScalarTest.cpp Index: unittests/Core/ScalarTest.cpp === --- /dev/null +++ unittests/Core/ScalarTest.cpp @@ -0,0 +1,32 @@ +//===-- ScalarTest.cpp --*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#if defined(_MSC_VER) && (_HAS_EXCEPTIONS == 0) +// Workaround for MSVC standard library bug, which fails to include when +// exceptions are disabled. +#include +#endif + +#include "gtest/gtest.h" + +#include "lldb/Core/Scalar.h" + +using namespace lldb_private; + +TEST(ScalarTest, RightShiftOperator) +{ +int a = 0x1000; +int b = 0x; +int c = 4; +Scalar a_scalar(a); +Scalar b_scalar(b); +Scalar c_scalar(c); +ASSERT_EQ(a >> c, a_scalar >> c_scalar); +ASSERT_EQ(b >> c, b_scalar >> c_scalar); +} Index: unittests/Core/CMakeLists.txt === --- /dev/null +++ unittests/Core/CMakeLists.txt @@ -0,0 +1,3 @@ +add_lldb_unittest(CoreTests + ScalarTest.cpp + ) Index: unittests/CMakeLists.txt === --- unittests/CMakeLists.txt +++ unittests/CMakeLists.txt @@ -23,6 +23,7 @@ llvm_config(${test_name} ${LLVM_LINK_COMPONENTS}) endfunction() +add_subdirectory(Core) add_subdirectory(Editline) add_subdirectory(Expression) add_subdirectory(Host) Index: source/Core/Scalar.cpp === --- source/Core/Scalar.cpp +++ source/Core/Scalar.cpp @@ -1875,7 +1875,7 @@ case e_sint128: case e_uint128: { - m_integer >> *rhs.m_integer.getRawData(); + m_integer = m_integer.ashr(*(const uint_t *)rhs.m_integer.getRawData()); break; } } Index: unittests/Core/ScalarTest.cpp === --- /dev/null +++ unittests/Core/ScalarTest.cpp @@ -0,0 +1,32 @@ +//===-- ScalarTest.cpp --*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#if defined(_MSC_VER) && (_HAS_EXCEPTIONS == 0) +// Workaround for MSVC standard library bug, which fails to include when +// exceptions are disabled. +#include +#endif + +#include "gtest/gtest.h" + +#include "lldb/Core/Scalar.h" + +using namespace lldb_private; + +TEST(ScalarTest, RightShiftOperator) +{ +int a = 0x1000; +int b = 0x; +int c = 4; +Scalar a_scalar(a); +Scalar b_scalar(b); +Scalar c_scalar(c); +ASSERT_EQ(a >> c, a_scalar >> c_scalar); +ASSERT_EQ(b >> c, b_scalar >> c_scalar); +} Index: unittests/Core/CMakeLists.txt === --- /dev/null +++ unittests/Core/CMakeLists.txt @@ -0,0 +1,3 @@ +add_lldb_unittest(CoreTests + ScalarTest.cpp + ) Index: unittests/CMakeLists.txt === --- unittests/CMakeLists.txt +++ unittests/CMakeLists.txt @@ -23,6 +23,7 @@ llvm_config(${test_name} ${LLVM_LINK_COMPONENTS}) endfunction() +add_subdirectory(Core) add_subdirectory(Editline) add_subdirectory(Expression) add_subdirectory(Host) Index: source/Core/Scalar.cpp === --- source/Core/Scalar.cpp +++ source/Core/Scalar.cpp @@ -1875,7 +1875,7 @@ case e_sint128: case e_uint128: { - m_integer >> *rhs.m_integer.getRawData(); + m_integer = m_integer.ashr(*(const uint_t *)rhs.m_integer.getRawData()); break; } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D16868: [lldb] Fix invalid shift operator overload in Scalar
mamai created this revision. mamai added a reviewer: sagar. mamai added a subscriber: lldb-commits. mamai set the repository for this revision to rL LLVM. This also fixes an infinite recursion between lldb_private::operator>> () and Scalar::operator>>= (). Repository: rL LLVM http://reviews.llvm.org/D16868 Files: source/Core/Scalar.cpp Index: source/Core/Scalar.cpp === --- source/Core/Scalar.cpp +++ source/Core/Scalar.cpp @@ -1875,7 +1875,7 @@ case e_sint128: case e_uint128: { - m_integer >> *rhs.m_integer.getRawData(); + m_integer = m_integer.ashr(*(const uint_t *)rhs.m_integer.getRawData()); break; } } Index: source/Core/Scalar.cpp === --- source/Core/Scalar.cpp +++ source/Core/Scalar.cpp @@ -1875,7 +1875,7 @@ case e_sint128: case e_uint128: { - m_integer >> *rhs.m_integer.getRawData(); + m_integer = m_integer.ashr(*(const uint_t *)rhs.m_integer.getRawData()); break; } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits