Re: [Lldb-commits] [PATCH] D16049: [LLDB][MIPS] A small fix in GetBreakableLoadAddress() for MIPS
bhushan closed this revision. bhushan added a comment. Closed by commit http://reviews.llvm.org/rL258919 Repository: rL LLVM http://reviews.llvm.org/D16049 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D16049: [LLDB][MIPS] A small fix in GetBreakableLoadAddress() for MIPS
bhushan updated this revision to Diff 45364. bhushan added a comment. As suggested by Greg, added new function `matchArchitectures(archs)` which handles "archs". This function can be used by other decorator functions for testing "archs". Repository: rL LLVM http://reviews.llvm.org/D16049 Files: include/lldb/API/SBInstruction.h packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/Makefile packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/TestAvoidBreakpointInDelaySlot.py packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/main.c packages/Python/lldbsuite/test/lldbtest.py scripts/interface/SBInstruction.i source/API/SBInstruction.cpp source/Target/Target.cpp Index: packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/main.c === --- /dev/null +++ packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/main.c @@ -0,0 +1,21 @@ +#include + +foo (int a, int b) +{ +int c; +if (a<=b) +c=b-a; +else +c=b+a; +return c; +} + +int main() +{ +int a=7, b=8, c; + +c = foo(a, b); + +return 0; +} + Index: packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/TestAvoidBreakpointInDelaySlot.py === --- /dev/null +++ packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/TestAvoidBreakpointInDelaySlot.py @@ -0,0 +1,82 @@ +""" +Test specific to MIPS +""" + +import os, time +import re +import unittest2 +import lldb +import lldbsuite.test.lldbutil as lldbutil +from lldbsuite.test.lldbtest import * + +class AvoidBreakpointInDelaySlotAPITestCase(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +@skipUnlessArch(archs=re.compile('mips*')) +def test(self): +self.build() +exe = os.path.join(os.getcwd(), "a.out") +self.expect("file " + exe, +patterns = [ "Current executable set to .*a.out.*" ]) + +# Create a target by the debugger. +target = self.dbg.CreateTarget(exe) +self.assertTrue(target, VALID_TARGET) + +breakpoint = target.BreakpointCreateByName('main', 'a.out') +self.assertTrue(breakpoint and +breakpoint.GetNumLocations() == 1, +VALID_BREAKPOINT) + +# Now launch the process, and do not stop at entry point. +process = target.LaunchSimple (None, None, self.get_process_working_directory()) +self.assertTrue(process, PROCESS_IS_VALID) + +list = target.FindFunctions('foo', lldb.eFunctionNameTypeAuto) +self.assertTrue(list.GetSize() == 1) +sc = list.GetContextAtIndex(0) +self.assertTrue(sc.GetSymbol().GetName() == "foo") +function = sc.GetFunction() +self.assertTrue(function) +self.function(function, target) + +def function (self, function, target): +"""Iterate over instructions in function and place a breakpoint on delay slot instruction""" +# Get the list of all instructions in the function +insts = function.GetInstructions(target) +print insts +i = 0 +for inst in insts: +if (inst.HasDelaySlot()): +# Remember the address of branch instruction. +branchinstaddress = inst.GetAddress().GetLoadAddress(target) + +# Get next instruction i.e delay slot instruction. +delayinst = insts.GetInstructionAtIndex(i+1) +delayinstaddr = delayinst.GetAddress().GetLoadAddress(target) + +# Set breakpoint on delay slot instruction +breakpoint = target.BreakpointCreateByAddress(delayinstaddr) + +# Verify the breakpoint. +self.assertTrue(breakpoint and +breakpoint.GetNumLocations() == 1, +VALID_BREAKPOINT) +# Get the location from breakpoint +location = breakpoint.GetLocationAtIndex(0) + +# Get the address where breakpoint is actually set. +bpaddr = location.GetLoadAddress() + +# Breakpoint address should be adjusted to the address of branch instruction. +self.assertTrue(branchinstaddress == bpaddr) +i += 1 +else: +i += 1 + +if __name__ == '__main__': +import atexit +lldb.SBDebugger.Initialize() +atexit.register(lambda: lldb.SBDebugger.Terminate()) +unittest2.main() Index: packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/Makefile === --- /dev/null +++
Re: [Lldb-commits] [PATCH] D16049: [LLDB][MIPS] A small fix in GetBreakableLoadAddress() for MIPS
bhushan updated the summary for this revision. bhushan updated this revision to Diff 45237. bhushan added a comment. Addressed review comments. Instead of adding new decorator, this patch modifies existing `skipUnlessArch` to detect the type of the "archs" variable and do the things according to the type. This handles regular expressions as well. The python test file then uses this decorator as `@skipUnlessArch(archs=re.compile('mips*'))` to skip any architectures other than mips. Repository: rL LLVM http://reviews.llvm.org/D16049 Files: include/lldb/API/SBInstruction.h packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/Makefile packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/TestAvoidBreakpointInDelaySlot.py packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/main.c packages/Python/lldbsuite/test/lldbtest.py scripts/interface/SBInstruction.i source/API/SBInstruction.cpp source/Target/Target.cpp Index: packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/main.c === --- /dev/null +++ packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/main.c @@ -0,0 +1,21 @@ +#include + +foo (int a, int b) +{ +int c; +if (a<=b) +c=b-a; +else +c=b+a; +return c; +} + +int main() +{ +int a=7, b=8, c; + +c = foo(a, b); + +return 0; +} + Index: packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/TestAvoidBreakpointInDelaySlot.py === --- /dev/null +++ packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/TestAvoidBreakpointInDelaySlot.py @@ -0,0 +1,82 @@ +""" +Test specific to MIPS +""" + +import os, time +import re +import unittest2 +import lldb +import lldbsuite.test.lldbutil as lldbutil +from lldbsuite.test.lldbtest import * + +class AvoidBreakpointInDelaySlotAPITestCase(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +@skipUnlessArch(archs=re.compile('mips*')) +def test(self): +self.build() +exe = os.path.join(os.getcwd(), "a.out") +self.expect("file " + exe, +patterns = [ "Current executable set to .*a.out.*" ]) + +# Create a target by the debugger. +target = self.dbg.CreateTarget(exe) +self.assertTrue(target, VALID_TARGET) + +breakpoint = target.BreakpointCreateByName('main', 'a.out') +self.assertTrue(breakpoint and +breakpoint.GetNumLocations() == 1, +VALID_BREAKPOINT) + +# Now launch the process, and do not stop at entry point. +process = target.LaunchSimple (None, None, self.get_process_working_directory()) +self.assertTrue(process, PROCESS_IS_VALID) + +list = target.FindFunctions('foo', lldb.eFunctionNameTypeAuto) +self.assertTrue(list.GetSize() == 1) +sc = list.GetContextAtIndex(0) +self.assertTrue(sc.GetSymbol().GetName() == "foo") +function = sc.GetFunction() +self.assertTrue(function) +self.function(function, target) + +def function (self, function, target): +"""Iterate over instructions in function and place a breakpoint on delay slot instruction""" +# Get the list of all instructions in the function +insts = function.GetInstructions(target) +print insts +i = 0 +for inst in insts: +if (inst.HasDelaySlot()): +# Remember the address of branch instruction. +branchinstaddress = inst.GetAddress().GetLoadAddress(target) + +# Get next instruction i.e delay slot instruction. +delayinst = insts.GetInstructionAtIndex(i+1) +delayinstaddr = delayinst.GetAddress().GetLoadAddress(target) + +# Set breakpoint on delay slot instruction +breakpoint = target.BreakpointCreateByAddress(delayinstaddr) + +# Verify the breakpoint. +self.assertTrue(breakpoint and +breakpoint.GetNumLocations() == 1, +VALID_BREAKPOINT) +# Get the location from breakpoint +location = breakpoint.GetLocationAtIndex(0) + +# Get the address where breakpoint is actually set. +bpaddr = location.GetLoadAddress() + +# Breakpoint address should be adjusted to the address of branch instruction. +self.assertTrue(branchinstaddress == bpaddr) +i += 1 +else: +i += 1 + +if __name__ == '__main__': +import atexit +lldb.SBDebugger.Initialize() +atexit.register(lambda: lldb.SBDebugger.Terminate()) +
Re: [Lldb-commits] [PATCH] D16049: [LLDB][MIPS] A small fix in GetBreakableLoadAddress() for MIPS
zturner added a comment. In http://reviews.llvm.org/D16049#326634, @labath wrote: > In http://reviews.llvm.org/D16049#326631, @bhushan wrote: > > > Hi Zachary, > > > > If we use @skipIf then the list would require to contain all possible MIPS > > variations and the list will grow long. > > for ex: @skipIf(archs=not_in(['mips32','mips32r2', 'mips32r3', > > 'mips64','mips64r2', 'mips64r3', 'mips64r6' ..])) > > > > @skipUnlessMips covers all these possible values using regular expression > > matching. > > > I agree with Zachary that we have too many decorators and we shouldn't be > expanding their number, it's simply not sustainable. I see two options here: > > - add a `getMipsArchitectures()` function and then write > `archs=not_in(getMipsArchitectures())` > - add a `not_regex()` function and write `archs=not_regex('mips.*')` How does > that sound? Another idea is to change the implementation of `not_in` to do the same thing that `check_list_or_lambda` does. i.e. Return a lambda that iterates each item of the argument and uses substring match instead of exact match. This way `@skipIf(archs=not_in('mips'))` would actually work. Any of these 3 options sounds fine though. Repository: rL LLVM http://reviews.llvm.org/D16049 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D16049: [LLDB][MIPS] A small fix in GetBreakableLoadAddress() for MIPS
clayborg added a comment. We could just teach the standard decorators to detect the type of the "archs" variable and do the right thing based off of the type. In the handler code you could have: retype = type(re.compile('hello, world')) if isinstance(archs, list): # Do what we do now and check if the arch is in the list elif isinstance(arg, basestring): # "archs" is a single architecture, just check it elif (isinstance(archs, retype): # Handle regex correctly We could also add support for passing a function in "archs" that takes a single argument that is the architecture name so we can do things with lambdas, etc. This should be detectable in the above check. The basestring check might need to be modified for python 3. Then the decorator usage can be: @skipIf(archs=re.compile('mips.*')) or @skipIf(archs='mips64r2')) I like the idea of adding a getMipsArchitectures() function as previously suggested: > add a getMipsArchitectures() function and then write > archs=not_in(getMipsArchitectures()) Repository: rL LLVM http://reviews.llvm.org/D16049 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D16049: [LLDB][MIPS] A small fix in GetBreakableLoadAddress() for MIPS
labath added a subscriber: labath. labath added a comment. In http://reviews.llvm.org/D16049#326631, @bhushan wrote: > Hi Zachary, > > If we use @skipIf then the list would require to contain all possible MIPS > variations and the list will grow long. > for ex: @skipIf(archs=not_in(['mips32','mips32r2', 'mips32r3', > 'mips64','mips64r2', 'mips64r3', 'mips64r6' ..])) > > @skipUnlessMips covers all these possible values using regular expression > matching. I agree with Zachary that we have too many decorators and we shouldn't be expanding their number, it's simply not sustainable. I see two options here: - add a `getMipsArchitectures()` function and then write `archs=not_in(getMipsArchitectures())` - add a `not_regex()` function and write `archs=not_regex('mips.*')` How does that sound? Repository: rL LLVM http://reviews.llvm.org/D16049 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D16049: [LLDB][MIPS] A small fix in GetBreakableLoadAddress() for MIPS
bhushan updated the summary for this revision. bhushan added a reviewer: zturner. bhushan updated this revision to Diff 44841. bhushan added a comment. Hi Zachary, If we use @skipIf then the list would require to contain all possible MIPS variations and the list will grow long. for ex: @skipIf(archs=not_in(['mips32','mips32r2', 'mips32r3', 'mips64','mips64r2', 'mips64r3', 'mips64r6' ..])) @skipUnlessMips covers all these possible values using regular expression matching. Repository: rL LLVM http://reviews.llvm.org/D16049 Files: include/lldb/API/SBInstruction.h packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/Makefile packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/TestAvoidBreakpointInDelaySlot.py packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/main.c packages/Python/lldbsuite/test/lldbtest.py scripts/interface/SBInstruction.i source/API/SBInstruction.cpp source/Target/Target.cpp Index: packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/main.c === --- /dev/null +++ packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/main.c @@ -0,0 +1,21 @@ +#include + +foo (int a, int b) +{ +int c; +if (a<=b) +c=b-a; +else +c=b+a; +return c; +} + +int main() +{ +int a=7, b=8, c; + +c = foo(a, b); + +return 0; +} + Index: packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/TestAvoidBreakpointInDelaySlot.py === --- /dev/null +++ packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/TestAvoidBreakpointInDelaySlot.py @@ -0,0 +1,82 @@ +""" +Test specific to MIPS +""" + +import os, time +import re +import unittest2 +import lldb +import lldbsuite.test.lldbutil as lldbutil +from lldbsuite.test.lldbtest import * + +class AvoidBreakpointInDelaySlotAPITestCase(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +@skipUnlessMips +def test(self): +self.build() +exe = os.path.join(os.getcwd(), "a.out") +self.expect("file " + exe, +patterns = [ "Current executable set to .*a.out.*" ]) + +# Create a target by the debugger. +target = self.dbg.CreateTarget(exe) +self.assertTrue(target, VALID_TARGET) + +breakpoint = target.BreakpointCreateByName('main', 'a.out') +self.assertTrue(breakpoint and +breakpoint.GetNumLocations() == 1, +VALID_BREAKPOINT) + +# Now launch the process, and do not stop at entry point. +process = target.LaunchSimple (None, None, self.get_process_working_directory()) +self.assertTrue(process, PROCESS_IS_VALID) + +list = target.FindFunctions('foo', lldb.eFunctionNameTypeAuto) +self.assertTrue(list.GetSize() == 1) +sc = list.GetContextAtIndex(0) +self.assertTrue(sc.GetSymbol().GetName() == "foo") +function = sc.GetFunction() +self.assertTrue(function) +self.function(function, target) + +def function (self, function, target): +"""Iterate over instructions in function and place a breakpoint on delay slot instruction""" +# Get the list of all instructions in the function +insts = function.GetInstructions(target) +print insts +i = 0 +for inst in insts: +if (inst.HasDelaySlot()): +# Remember the address of branch instruction. +branchinstaddress = inst.GetAddress().GetLoadAddress(target) + +# Get next instruction i.e delay slot instruction. +delayinst = insts.GetInstructionAtIndex(i+1) +delayinstaddr = delayinst.GetAddress().GetLoadAddress(target) + +# Set breakpoint on delay slot instruction +breakpoint = target.BreakpointCreateByAddress(delayinstaddr) + +# Verify the breakpoint. +self.assertTrue(breakpoint and +breakpoint.GetNumLocations() == 1, +VALID_BREAKPOINT) +# Get the location from breakpoint +location = breakpoint.GetLocationAtIndex(0) + +# Get the address where breakpoint is actually set. +bpaddr = location.GetLoadAddress() + +# Breakpoint address should be adjusted to the address of branch instruction. +self.assertTrue(branchinstaddress == bpaddr) +i += 1 +else: +i += 1 + +if __name__ == '__main__': +import atexit +lldb.SBDebugger.Initialize() +atexit.register(lambda: lldb.SBDebugger.Terminate()) +unittest2.main() Index:
Re: [Lldb-commits] [PATCH] D16049: [LLDB][MIPS] A small fix in GetBreakableLoadAddress() for MIPS
bhushan added a comment. In http://reviews.llvm.org/D16049#326634, @labath wrote: > In http://reviews.llvm.org/D16049#326631, @bhushan wrote: > > > Hi Zachary, > > > > If we use @skipIf then the list would require to contain all possible MIPS > > variations and the list will grow long. > > for ex: @skipIf(archs=not_in(['mips32','mips32r2', 'mips32r3', > > 'mips64','mips64r2', 'mips64r3', 'mips64r6' ..])) > > > > @skipUnlessMips covers all these possible values using regular expression > > matching. > > > I agree with Zachary that we have too many decorators and we shouldn't be > expanding their number, it's simply not sustainable. I see two options here: > > - add a `getMipsArchitectures()` function and then write > `archs=not_in(getMipsArchitectures())` > - add a `not_regex()` function and write `archs=not_regex('mips.*')` How does > that sound? I think adding `not_ regex()` sounds better option to me just because in future if MIPS adds another architecture variation then `getMipsArchitectures()` would require an update. `not_regex` will look like this: def not_regex(pattern): return lambda x : not re.match(pattern, x)` and python test file will use it as: `@skipIf(archs=not_regex('mips*'))` If Greg and Zachary also agrees then I will submit a patch for this. Repository: rL LLVM http://reviews.llvm.org/D16049 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D16049: [LLDB][MIPS] A small fix in GetBreakableLoadAddress() for MIPS
bhushan updated this revision to Diff 44723. bhushan added a comment. This diff adds a testcase to test this patch. The test gets all assembly instructions from the function and finds out the address of instruction in delay slot. Then it tries to place a breakpoint on that address and verifies if breakpoint has been adjusted correctly. The breakpoint should get placed on branch instruction instead of delay slot instruction. Repository: rL LLVM http://reviews.llvm.org/D16049 Files: include/lldb/API/SBInstruction.h packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/Makefile packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/TestAvoidBreakpointInDelaySlot.py packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/main.c packages/Python/lldbsuite/test/lldbtest.py scripts/interface/SBInstruction.i source/API/SBInstruction.cpp Index: packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/main.c === --- /dev/null +++ packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/main.c @@ -0,0 +1,21 @@ +#include + +foo (int a, int b) +{ +int c; +if (a<=b) +c=b-a; +else +c=b+a; +return c; +} + +int main() +{ +int a=7, b=8, c; + +c = foo(a, b); + +return 0; +} + Index: packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/TestAvoidBreakpointInDelaySlot.py === --- /dev/null +++ packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/TestAvoidBreakpointInDelaySlot.py @@ -0,0 +1,82 @@ +""" +Test specific to MIPS +""" + +import os, time +import re +import unittest2 +import lldb +import lldbsuite.test.lldbutil as lldbutil +from lldbsuite.test.lldbtest import * + +class AvoidBreakpointInDelaySlotAPITestCase(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +@skipUnlessMips +def test(self): +self.build() +exe = os.path.join(os.getcwd(), "a.out") +self.expect("file " + exe, +patterns = [ "Current executable set to .*a.out.*" ]) + +# Create a target by the debugger. +target = self.dbg.CreateTarget(exe) +self.assertTrue(target, VALID_TARGET) + +breakpoint = target.BreakpointCreateByName('main', 'a.out') +self.assertTrue(breakpoint and +breakpoint.GetNumLocations() == 1, +VALID_BREAKPOINT) + +# Now launch the process, and do not stop at entry point. +process = target.LaunchSimple (None, None, self.get_process_working_directory()) +self.assertTrue(process, PROCESS_IS_VALID) + +list = target.FindFunctions('foo', lldb.eFunctionNameTypeAuto) +self.assertTrue(list.GetSize() == 1) +sc = list.GetContextAtIndex(0) +self.assertTrue(sc.GetSymbol().GetName() == "foo") +function = sc.GetFunction() +self.assertTrue(function) +self.function(function, target) + +def function (self, function, target): +"""Iterate over instructions in function and place a breakpoint on delay slot instruction""" +# Get the list of all instructions in the function +insts = function.GetInstructions(target) +print insts +i = 0 +for inst in insts: +if (inst.HasDelaySlot()): +# Remember the address of branch instruction. +branchinstaddress = inst.GetAddress().GetLoadAddress(target) + +# Get next instruction i.e delay slot instruction. +delayinst = insts.GetInstructionAtIndex(i+1) +delayinstaddr = delayinst.GetAddress().GetLoadAddress(target) + +# Set breakpoint on delay slot instruction +breakpoint = target.BreakpointCreateByAddress(delayinstaddr) + +# Verify the breakpoint. +self.assertTrue(breakpoint and +breakpoint.GetNumLocations() == 1, +VALID_BREAKPOINT) +# Get the location from breakpoint +location = breakpoint.GetLocationAtIndex(0) + +# Get the address where breakpoint is actually set. +bpaddr = location.GetLoadAddress() + +# Breakpoint address should be adjusted to the address of branch instruction. +self.assertTrue(branchinstaddress == bpaddr) +i += 1 +else: +i += 1 + +if __name__ == '__main__': +import atexit +lldb.SBDebugger.Initialize() +atexit.register(lambda: lldb.SBDebugger.Terminate()) +unittest2.main() Index: packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/Makefile
Re: [Lldb-commits] [PATCH] D16049: [LLDB][MIPS] A small fix in GetBreakableLoadAddress() for MIPS
zturner added a comment. In the future when you update the diff of a review, you need to base the diff against the original code, not against your first diff. So the new diff should be a superset of your old diff. Comment at: packages/Python/lldbsuite/test/lldbtest.py:1221-1234 @@ -1220,1 +1220,16 @@ +def skipUnlessMips(func): +"""Decorate the item to skip tests that should be skipped only if not building for any of the mips targets.""" +if isinstance(func, type) and issubclass(func, unittest2.TestCase): +raise Exception("@skipIfNotMips can only be used to decorate a test method") +@wraps(func) +def wrapper(*args, **kwargs): +from unittest2 import case +self = args[0] +arch = self.getArchitecture() +if not re.match('mips', arch): +self.skipTest("skipping because this is a mips specific test") +else: +func(*args, **kwargs) +return wrapper + You don't really need this, you can just use `@skipIf(archs=not_in(['mips']))` Repository: rL LLVM http://reviews.llvm.org/D16049 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D16049: [LLDB][MIPS] A small fix in GetBreakableLoadAddress() for MIPS
bhushan created this revision. bhushan added a reviewer: clayborg. bhushan added subscribers: lldb-commits, nitesh.jain, mohit.bhakkad, sagar, jaydeep. bhushan set the repository for this revision to rL LLVM. Repository: rL LLVM http://reviews.llvm.org/D16049 Files: source/Target/Target.cpp Index: source/Target/Target.cpp === --- source/Target/Target.cpp +++ source/Target/Target.cpp @@ -2442,18 +2442,18 @@ SymbolContext sc; uint32_t resolve_scope = eSymbolContextFunction | eSymbolContextSymbol; temp_addr_module_sp->ResolveSymbolContextForAddress(resolved_addr, resolve_scope, sc); +Address sym_addr; if (sc.function) -{ -function_start = sc.function->GetAddressRange().GetBaseAddress().GetLoadAddress(this); -if (function_start == LLDB_INVALID_ADDRESS) -function_start = sc.function->GetAddressRange().GetBaseAddress().GetFileAddress(); -} +sym_addr = sc.function->GetAddressRange().GetBaseAddress(); else if (sc.symbol) -{ -Address sym_addr = sc.symbol->GetAddress(); +sym_addr = sc.symbol->GetAddress(); + +function_start = sym_addr.GetLoadAddress(this); +if (function_start == LLDB_INVALID_ADDRESS) function_start = sym_addr.GetFileAddress(); -} -current_offset = addr - function_start; + +if (function_start) +current_offset = addr - function_start; } // If breakpoint address is start of function then we dont have to do anything. Index: source/Target/Target.cpp === --- source/Target/Target.cpp +++ source/Target/Target.cpp @@ -2442,18 +2442,18 @@ SymbolContext sc; uint32_t resolve_scope = eSymbolContextFunction | eSymbolContextSymbol; temp_addr_module_sp->ResolveSymbolContextForAddress(resolved_addr, resolve_scope, sc); +Address sym_addr; if (sc.function) -{ -function_start = sc.function->GetAddressRange().GetBaseAddress().GetLoadAddress(this); -if (function_start == LLDB_INVALID_ADDRESS) -function_start = sc.function->GetAddressRange().GetBaseAddress().GetFileAddress(); -} +sym_addr = sc.function->GetAddressRange().GetBaseAddress(); else if (sc.symbol) -{ -Address sym_addr = sc.symbol->GetAddress(); +sym_addr = sc.symbol->GetAddress(); + +function_start = sym_addr.GetLoadAddress(this); +if (function_start == LLDB_INVALID_ADDRESS) function_start = sym_addr.GetFileAddress(); -} -current_offset = addr - function_start; + +if (function_start) +current_offset = addr - function_start; } // If breakpoint address is start of function then we dont have to do anything. ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D16049: [LLDB][MIPS] A small fix in GetBreakableLoadAddress() for MIPS
bhushan added a comment. Summary: Get the load address for the address given by 'symbol' and 'function'. Earlier, this was done for 'function' only, this patch does it for 'symbol' too. Repository: rL LLVM http://reviews.llvm.org/D16049 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D16049: [LLDB][MIPS] A small fix in GetBreakableLoadAddress() for MIPS
There's no test here. On Mon, Jan 11, 2016 at 1:22 AM Bhushan Attarde via lldb-commits < lldb-commits@lists.llvm.org> wrote: > bhushan added a comment. > > Summary: > > Get the load address for the address given by 'symbol' and 'function'. > Earlier, this was done for 'function' only, this patch does it for > 'symbol' too. > > > Repository: > rL LLVM > > http://reviews.llvm.org/D16049 > > > > ___ > lldb-commits mailing list > lldb-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits > ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D16049: [LLDB][MIPS] A small fix in GetBreakableLoadAddress() for MIPS
zturner added a subscriber: zturner. zturner added a comment. There's no test here. Repository: rL LLVM http://reviews.llvm.org/D16049 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D16049: [LLDB][MIPS] A small fix in GetBreakableLoadAddress() for MIPS
clayborg requested changes to this revision. clayborg added a comment. This revision now requires changes to proceed. Actually, can you add a test? Repository: rL LLVM http://reviews.llvm.org/D16049 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits