Imported Upstream version 6.10.0.49

Former-commit-id: 1d6753294b2993e1fbf92de9366bb9544db4189b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2020-01-16 16:38:04 +00:00
parent d94e79959b
commit 468663ddbb
48518 changed files with 2789335 additions and 61176 deletions

View File

@ -0,0 +1 @@
pyapi

View File

@ -0,0 +1,5 @@
LEVEL = ../../make
C_SOURCES := main.c
include $(LEVEL)/Makefile.rules

View File

@ -0,0 +1,77 @@
"""
Test SBBreakpoint APIs.
"""
from __future__ import print_function
import os
import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class BreakpointAPITestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
NO_DEBUG_INFO_TESTCASE = True
@add_test_categories(['pyapi'])
def test_breakpoint_is_valid(self):
"""Make sure that if an SBBreakpoint gets deleted its IsValid returns false."""
self.build()
exe = os.path.join(os.getcwd(), "a.out")
# Create a target by the debugger.
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
# Now create a breakpoint on main.c by name 'AFunction'.
breakpoint = target.BreakpointCreateByName('AFunction', 'a.out')
#print("breakpoint:", breakpoint)
self.assertTrue(breakpoint and
breakpoint.GetNumLocations() == 1,
VALID_BREAKPOINT)
# Now delete it:
did_delete = target.BreakpointDelete(breakpoint.GetID())
self.assertTrue(
did_delete,
"Did delete the breakpoint we just created.")
# Make sure we can't find it:
del_bkpt = target.FindBreakpointByID(breakpoint.GetID())
self.assertTrue(not del_bkpt, "We did delete the breakpoint.")
# Finally make sure the original breakpoint is no longer valid.
self.assertTrue(
not breakpoint,
"Breakpoint we deleted is no longer valid.")
@add_test_categories(['pyapi'])
def test_target_delete(self):
"""Make sure that if an SBTarget gets deleted the associated
Breakpoint's IsValid returns false."""
self.build()
exe = os.path.join(os.getcwd(), "a.out")
# Create a target by the debugger.
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
# Now create a breakpoint on main.c by name 'AFunction'.
breakpoint = target.BreakpointCreateByName('AFunction', 'a.out')
#print("breakpoint:", breakpoint)
self.assertTrue(breakpoint and
breakpoint.GetNumLocations() == 1,
VALID_BREAKPOINT)
location = breakpoint.GetLocationAtIndex(0)
self.assertTrue(location.IsValid())
self.assertTrue(self.dbg.DeleteTarget(target))
self.assertFalse(breakpoint.IsValid())
self.assertFalse(location.IsValid())

View File

@ -0,0 +1,14 @@
#include <stdio.h>
void
AFunction()
{
printf ("I am a function.\n");
}
int
main ()
{
AFunction();
return 0;
}

View File

@ -0,0 +1,5 @@
LEVEL = ../../make
OBJCXX_SOURCES := main.mm
include $(LEVEL)/Makefile.rules

View File

@ -0,0 +1,107 @@
"""
Test SBType APIs to fetch member function types.
"""
from __future__ import print_function
import os
import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class SBTypeMemberFunctionsTest(TestBase):
mydir = TestBase.compute_mydir(__file__)
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
# We'll use the test method name as the exe_name.
self.exe_name = self.testMethodName
# Find the line number to break at.
self.source = 'main.mm'
self.line = line_number(self.source, '// set breakpoint here')
@skipUnlessDarwin
@add_test_categories(['pyapi'])
def test(self):
"""Test SBType APIs to fetch member function types."""
d = {'EXE': self.exe_name}
self.build(dictionary=d)
self.setTearDownCleanup(dictionary=d)
exe = os.path.join(os.getcwd(), self.exe_name)
# Create a target by the debugger.
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
# Create the breakpoint inside function 'main'.
breakpoint = target.BreakpointCreateByLocation(self.source, self.line)
self.assertTrue(breakpoint, 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)
# Get Frame #0.
self.assertTrue(process.GetState() == lldb.eStateStopped)
thread = lldbutil.get_stopped_thread(
process, lldb.eStopReasonBreakpoint)
self.assertTrue(
thread.IsValid(),
"There should be a thread stopped due to breakpoint condition")
frame0 = thread.GetFrameAtIndex(0)
variable = frame0.FindVariable("d")
Derived = variable.GetType()
Base = Derived.GetDirectBaseClassAtIndex(0).GetType()
self.assertEquals(2,
Derived.GetNumberOfMemberFunctions(),
"Derived declares two methods")
self.assertEquals("int", Derived.GetMemberFunctionAtIndex(0).GetType(
).GetFunctionReturnType().GetName(),
"Derived::dImpl returns int")
self.assertEquals(4,
Base.GetNumberOfMemberFunctions(),
"Base declares three methods")
self.assertEquals(3, Base.GetMemberFunctionAtIndex(3).GetType(
).GetFunctionArgumentTypes().GetSize(),
"Base::sfunc takes three arguments")
self.assertEquals("sfunc", Base.GetMemberFunctionAtIndex(
3).GetName(), "Base::sfunc not found")
self.assertEquals(lldb.eMemberFunctionKindStaticMethod,
Base.GetMemberFunctionAtIndex(3).GetKind(),
"Base::sfunc is a static")
self.assertEquals(0, Base.GetMemberFunctionAtIndex(2).GetType(
).GetFunctionArgumentTypes().GetSize(),
"Base::dat takes no arguments")
self.assertEquals("char",
Base.GetMemberFunctionAtIndex(1).GetType().GetFunctionArgumentTypes(
).GetTypeAtIndex(1).GetName(),
"Base::bar takes a second 'char' argument")
self.assertEquals("bar",
Base.GetMemberFunctionAtIndex(1).GetName(), "Base::bar not found")
variable = frame0.FindVariable("thingy")
Thingy = variable.GetType()
self.assertEquals(
2, Thingy.GetNumberOfMemberFunctions(),
"Thingy declares two methods")
self.assertEquals("id", Thingy.GetMemberFunctionAtIndex(
0).GetReturnType().GetName(), "Thingy::init returns an id")
self.assertEquals(2,
Thingy.GetMemberFunctionAtIndex(1).GetNumberOfArguments(),
"Thingy::foo takes two arguments")
self.assertEquals("int",
Thingy.GetMemberFunctionAtIndex(1).GetArgumentTypeAtIndex(
0).GetName(), "Thingy::foo takes an int")

View File

@ -0,0 +1,47 @@
//===-- main.cpp ------------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#import <Foundation/Foundation.h>
class Base {
public:
int foo(int x, int y) { return 1; }
char bar(int x, char y) { return 2; }
void dat() {}
static int sfunc(char, int, float) { return 3; }
};
class Derived: public Base {
protected:
int dImpl() { return 1; }
public:
float baz(float b) { return b + 1.0; }
};
@interface Thingy: NSObject {
}
- (id)init;
- (id)fooWithBar: (int)bar andBaz:(id)baz;
@end
@implementation Thingy {
}
- (id)init {
return (self = [super init]);
}
- (id)fooWithBar: (int)bar andBaz:(id)baz {
return nil;
}
@end
int main() {
Derived d;
Thingy *thingy = [[Thingy alloc] init];
return 0; // set breakpoint here
}

View File

@ -0,0 +1,43 @@
"""
Test Debugger APIs.
"""
import os
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class DebuggerAPITestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@add_test_categories(['pyapi'])
@no_debug_info_test
def test_debugger_api_boundary_condition(self):
"""Exercise SBDebugger APIs with boundary conditions."""
self.dbg.HandleCommand(None)
self.dbg.SetDefaultArchitecture(None)
self.dbg.GetScriptingLanguage(None)
self.dbg.CreateTarget(None)
self.dbg.CreateTarget(None, None, None, True, lldb.SBError())
self.dbg.CreateTargetWithFileAndTargetTriple(None, None)
self.dbg.CreateTargetWithFileAndArch(None, None)
self.dbg.FindTargetWithFileAndArch(None, None)
self.dbg.SetInternalVariable(None, None, None)
self.dbg.GetInternalVariableValue(None, None)
# FIXME (filcab): We must first allow for the swig bindings to know if
# a Python callback is set. (Check python-typemaps.swig)
# self.dbg.SetLoggingCallback(None)
self.dbg.SetPrompt(None)
self.dbg.SetCurrentPlatform(None)
self.dbg.SetCurrentPlatformSDKRoot(None)
@add_test_categories(['pyapi'])
def test_debugger_delete_invalid_target(self):
"""SBDebugger.DeleteTarget() should not crash LLDB given and invalid target."""
target = lldb.SBTarget()
self.assertFalse(target.IsValid())
self.dbg.DeleteTarget(target)

View File

@ -0,0 +1,421 @@
"""
Test lldb Python API object's default constructor and make sure it is invalid
after initial construction.
There are also some cases of boundary condition testings sprinkled throughout
the tests where None is passed to SB API which expects (const char *) in the
C++ API counterpart. Passing None should not crash lldb!
There are three exceptions to the above general rules, though; API objects
SBCommadnReturnObject, SBStream, and SBSymbolContextList, are all valid objects
after default construction.
"""
from __future__ import print_function
import os
import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class APIDefaultConstructorTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@add_test_categories(['pyapi'])
@no_debug_info_test
def test_SBAddress(self):
obj = lldb.SBAddress()
if self.TraceOn():
print(obj)
self.assertFalse(obj)
# Do fuzz testing on the invalid obj, it should not crash lldb.
import sb_address
sb_address.fuzz_obj(obj)
@add_test_categories(['pyapi'])
@no_debug_info_test
def test_SBBlock(self):
obj = lldb.SBBlock()
if self.TraceOn():
print(obj)
self.assertFalse(obj)
# Do fuzz testing on the invalid obj, it should not crash lldb.
import sb_block
sb_block.fuzz_obj(obj)
@add_test_categories(['pyapi'])
@no_debug_info_test
def test_SBBreakpoint(self):
obj = lldb.SBBreakpoint()
if self.TraceOn():
print(obj)
self.assertFalse(obj)
# Do fuzz testing on the invalid obj, it should not crash lldb.
import sb_breakpoint
sb_breakpoint.fuzz_obj(obj)
@add_test_categories(['pyapi'])
@no_debug_info_test
def test_SBBreakpointLocation(self):
obj = lldb.SBBreakpointLocation()
if self.TraceOn():
print(obj)
self.assertFalse(obj)
# Do fuzz testing on the invalid obj, it should not crash lldb.
import sb_breakpointlocation
sb_breakpointlocation.fuzz_obj(obj)
@add_test_categories(['pyapi'])
@no_debug_info_test
def test_SBBreakpointName(self):
obj = lldb.SBBreakpointName()
if self.TraceOn():
print(obj)
self.assertFalse(obj)
# Do fuzz testing on the invalid obj, it should not crash lldb.
import sb_breakpointname
sb_breakpointname.fuzz_obj(obj)
@add_test_categories(['pyapi'])
@no_debug_info_test
def test_SBBroadcaster(self):
obj = lldb.SBBroadcaster()
if self.TraceOn():
print(obj)
self.assertFalse(obj)
# Do fuzz testing on the invalid obj, it should not crash lldb.
import sb_broadcaster
sb_broadcaster.fuzz_obj(obj)
@add_test_categories(['pyapi'])
@no_debug_info_test
def test_SBCommandReturnObject(self):
"""SBCommandReturnObject object is valid after default construction."""
obj = lldb.SBCommandReturnObject()
if self.TraceOn():
print(obj)
self.assertTrue(obj)
@add_test_categories(['pyapi'])
@no_debug_info_test
def test_SBCommunication(self):
obj = lldb.SBCommunication()
if self.TraceOn():
print(obj)
self.assertFalse(obj)
# Do fuzz testing on the invalid obj, it should not crash lldb.
import sb_communication
sb_communication.fuzz_obj(obj)
@add_test_categories(['pyapi'])
@no_debug_info_test
def test_SBCompileUnit(self):
obj = lldb.SBCompileUnit()
if self.TraceOn():
print(obj)
self.assertFalse(obj)
# Do fuzz testing on the invalid obj, it should not crash lldb.
import sb_compileunit
sb_compileunit.fuzz_obj(obj)
@add_test_categories(['pyapi'])
@no_debug_info_test
def test_SBDebugger(self):
obj = lldb.SBDebugger()
if self.TraceOn():
print(obj)
self.assertFalse(obj)
# Do fuzz testing on the invalid obj, it should not crash lldb.
import sb_debugger
sb_debugger.fuzz_obj(obj)
@add_test_categories(['pyapi'])
@no_debug_info_test
# darwin: This test passes with swig 3.0.2, fails w/3.0.5 other tests fail
# with 2.0.12 http://llvm.org/pr23488
def test_SBError(self):
obj = lldb.SBError()
if self.TraceOn():
print(obj)
self.assertFalse(obj)
# Do fuzz testing on the invalid obj, it should not crash lldb.
import sb_error
sb_error.fuzz_obj(obj)
@add_test_categories(['pyapi'])
@no_debug_info_test
def test_SBEvent(self):
obj = lldb.SBEvent()
# This is just to test that typemap, as defined in lldb.swig, works.
obj2 = lldb.SBEvent(0, "abc")
if self.TraceOn():
print(obj)
self.assertFalse(obj)
# Do fuzz testing on the invalid obj, it should not crash lldb.
import sb_event
sb_event.fuzz_obj(obj)
@add_test_categories(['pyapi'])
def test_SBFileSpec(self):
obj = lldb.SBFileSpec()
# This is just to test that FileSpec(None) does not crash.
obj2 = lldb.SBFileSpec(None, True)
if self.TraceOn():
print(obj)
self.assertFalse(obj)
# Do fuzz testing on the invalid obj, it should not crash lldb.
import sb_filespec
sb_filespec.fuzz_obj(obj)
@add_test_categories(['pyapi'])
@no_debug_info_test
def test_SBFrame(self):
obj = lldb.SBFrame()
if self.TraceOn():
print(obj)
self.assertFalse(obj)
# Do fuzz testing on the invalid obj, it should not crash lldb.
import sb_frame
sb_frame.fuzz_obj(obj)
@add_test_categories(['pyapi'])
@no_debug_info_test
def test_SBFunction(self):
obj = lldb.SBFunction()
if self.TraceOn():
print(obj)
self.assertFalse(obj)
# Do fuzz testing on the invalid obj, it should not crash lldb.
import sb_function
sb_function.fuzz_obj(obj)
@add_test_categories(['pyapi'])
@no_debug_info_test
def test_SBInstruction(self):
obj = lldb.SBInstruction()
if self.TraceOn():
print(obj)
self.assertFalse(obj)
# Do fuzz testing on the invalid obj, it should not crash lldb.
import sb_instruction
sb_instruction.fuzz_obj(obj)
@add_test_categories(['pyapi'])
@no_debug_info_test
def test_SBInstructionList(self):
obj = lldb.SBInstructionList()
if self.TraceOn():
print(obj)
self.assertFalse(obj)
# Do fuzz testing on the invalid obj, it should not crash lldb.
import sb_instructionlist
sb_instructionlist.fuzz_obj(obj)
@add_test_categories(['pyapi'])
@no_debug_info_test
def test_SBLineEntry(self):
obj = lldb.SBLineEntry()
if self.TraceOn():
print(obj)
self.assertFalse(obj)
# Do fuzz testing on the invalid obj, it should not crash lldb.
import sb_lineentry
sb_lineentry.fuzz_obj(obj)
@add_test_categories(['pyapi'])
@no_debug_info_test
def test_SBListener(self):
obj = lldb.SBListener()
if self.TraceOn():
print(obj)
self.assertFalse(obj)
# Do fuzz testing on the invalid obj, it should not crash lldb.
import sb_listener
sb_listener.fuzz_obj(obj)
@add_test_categories(['pyapi'])
@no_debug_info_test
# Py3 asserts due to a bug in SWIG. Trying to upstream a patch to fix
# this in 3.0.8
@skipIf(py_version=['>=', (3, 0)], swig_version=['<', (3, 0, 8)])
def test_SBModule(self):
obj = lldb.SBModule()
if self.TraceOn():
print(obj)
self.assertFalse(obj)
# Do fuzz testing on the invalid obj, it should not crash lldb.
import sb_module
sb_module.fuzz_obj(obj)
@add_test_categories(['pyapi'])
@no_debug_info_test
def test_SBProcess(self):
obj = lldb.SBProcess()
if self.TraceOn():
print(obj)
self.assertFalse(obj)
# Do fuzz testing on the invalid obj, it should not crash lldb.
import sb_process
sb_process.fuzz_obj(obj)
@add_test_categories(['pyapi'])
@no_debug_info_test
def test_SBProcessInfo(self):
obj = lldb.SBProcessInfo()
if self.TraceOn():
print(obj)
self.assertFalse(obj)
# Do fuzz testing on the invalid obj, it should not crash lldb.
import sb_process_info
sb_process_info.fuzz_obj(obj)
@add_test_categories(['pyapi'])
@no_debug_info_test
def test_SBSection(self):
obj = lldb.SBSection()
if self.TraceOn():
print(obj)
self.assertFalse(obj)
# Do fuzz testing on the invalid obj, it should not crash lldb.
import sb_section
sb_section.fuzz_obj(obj)
@add_test_categories(['pyapi'])
@no_debug_info_test
def test_SBStream(self):
"""SBStream object is valid after default construction."""
obj = lldb.SBStream()
if self.TraceOn():
print(obj)
self.assertTrue(obj)
@add_test_categories(['pyapi'])
@no_debug_info_test
def test_SBStringList(self):
obj = lldb.SBStringList()
if self.TraceOn():
print(obj)
self.assertFalse(obj)
# Do fuzz testing on the invalid obj, it should not crash lldb.
import sb_stringlist
sb_stringlist.fuzz_obj(obj)
@add_test_categories(['pyapi'])
@no_debug_info_test
def test_SBSymbol(self):
obj = lldb.SBSymbol()
if self.TraceOn():
print(obj)
self.assertFalse(obj)
# Do fuzz testing on the invalid obj, it should not crash lldb.
import sb_symbol
sb_symbol.fuzz_obj(obj)
@add_test_categories(['pyapi'])
@no_debug_info_test
def test_SBSymbolContext(self):
obj = lldb.SBSymbolContext()
if self.TraceOn():
print(obj)
self.assertFalse(obj)
# Do fuzz testing on the invalid obj, it should not crash lldb.
import sb_symbolcontext
sb_symbolcontext.fuzz_obj(obj)
@add_test_categories(['pyapi'])
@no_debug_info_test
def test_SBSymbolContextList(self):
"""SBSymbolContextList object is valid after default construction."""
obj = lldb.SBSymbolContextList()
if self.TraceOn():
print(obj)
self.assertTrue(obj)
@add_test_categories(['pyapi'])
@no_debug_info_test
def test_SBTarget(self):
obj = lldb.SBTarget()
if self.TraceOn():
print(obj)
self.assertFalse(obj)
# Do fuzz testing on the invalid obj, it should not crash lldb.
import sb_target
sb_target.fuzz_obj(obj)
@add_test_categories(['pyapi'])
@no_debug_info_test
def test_SBThread(self):
obj = lldb.SBThread()
if self.TraceOn():
print(obj)
self.assertFalse(obj)
# Do fuzz testing on the invalid obj, it should not crash lldb.
import sb_thread
sb_thread.fuzz_obj(obj)
@add_test_categories(['pyapi'])
@no_debug_info_test
def test_SBType(self):
try:
obj = lldb.SBType()
if self.TraceOn():
print(obj)
self.assertFalse(obj)
# If we reach here, the test fails.
self.fail("lldb.SBType() should fail, not succeed!")
except:
# Exception is expected.
return
# Unreachable code because lldb.SBType() should fail.
# Do fuzz testing on the invalid obj, it should not crash lldb.
import sb_type
sb_type.fuzz_obj(obj)
@add_test_categories(['pyapi'])
@no_debug_info_test
def test_SBTypeList(self):
"""SBTypeList object is valid after default construction."""
obj = lldb.SBTypeList()
if self.TraceOn():
print(obj)
self.assertTrue(obj)
@add_test_categories(['pyapi'])
@no_debug_info_test
def test_SBValue(self):
obj = lldb.SBValue()
if self.TraceOn():
print(obj)
self.assertFalse(obj)
# Do fuzz testing on the invalid obj, it should not crash lldb.
import sb_value
sb_value.fuzz_obj(obj)
@add_test_categories(['pyapi'])
@no_debug_info_test
def test_SBValueList(self):
obj = lldb.SBValueList()
if self.TraceOn():
print(obj)
self.assertFalse(obj)
# Do fuzz testing on the invalid obj, it should not crash lldb.
import sb_valuelist
sb_valuelist.fuzz_obj(obj)
@add_test_categories(['pyapi'])
@no_debug_info_test
def test_SBWatchpoint(self):
obj = lldb.SBWatchpoint()
if self.TraceOn():
print(obj)
self.assertFalse(obj)
# Do fuzz testing on the invalid obj, it should not crash lldb.
import sb_watchpoint
sb_watchpoint.fuzz_obj(obj)

View File

@ -0,0 +1,23 @@
"""
Fuzz tests an object after the default construction to make sure it does not crash lldb.
"""
import sys
import lldb
def fuzz_obj(obj):
obj.GetFileAddress()
obj.GetLoadAddress(lldb.SBTarget())
obj.SetLoadAddress(0xffff, lldb.SBTarget())
obj.OffsetAddress(sys.maxsize)
obj.GetDescription(lldb.SBStream())
obj.GetSection()
obj.GetSymbolContext(lldb.eSymbolContextEverything)
obj.GetModule()
obj.GetCompileUnit()
obj.GetFunction()
obj.GetBlock()
obj.GetSymbol()
obj.GetLineEntry()
obj.Clear()

View File

@ -0,0 +1,18 @@
"""
Fuzz tests an object after the default construction to make sure it does not crash lldb.
"""
import sys
import lldb
def fuzz_obj(obj):
obj.IsInlined()
obj.GetInlinedName()
obj.GetInlinedCallSiteFile()
obj.GetInlinedCallSiteLine()
obj.GetInlinedCallSiteColumn()
obj.GetParent()
obj.GetSibling()
obj.GetFirstChild()
obj.GetDescription(lldb.SBStream())

View File

@ -0,0 +1,37 @@
"""
Fuzz tests an object after the default construction to make sure it does not crash lldb.
"""
import sys
import lldb
def fuzz_obj(obj):
obj.GetID()
obj.ClearAllBreakpointSites()
obj.FindLocationByAddress(sys.maxsize)
obj.FindLocationIDByAddress(sys.maxsize)
obj.FindLocationByID(0)
obj.GetLocationAtIndex(0)
obj.SetEnabled(True)
obj.IsEnabled()
obj.GetHitCount()
obj.SetIgnoreCount(1)
obj.GetIgnoreCount()
obj.SetCondition("i >= 10")
obj.GetCondition()
obj.SetThreadID(0)
obj.GetThreadID()
obj.SetThreadIndex(0)
obj.GetThreadIndex()
obj.SetThreadName("worker thread")
obj.GetThreadName()
obj.SetQueueName("my queue")
obj.GetQueueName()
obj.SetScriptCallbackFunction(None)
obj.SetScriptCallbackBody(None)
obj.GetNumResolvedLocations()
obj.GetNumLocations()
obj.GetDescription(lldb.SBStream())
for bp_loc in obj:
s = str(bp_loc)

View File

@ -0,0 +1,29 @@
"""
Fuzz tests an object after the default construction to make sure it does not crash lldb.
"""
import sys
import lldb
def fuzz_obj(obj):
obj.GetAddress()
obj.GetLoadAddress()
obj.SetEnabled(True)
obj.IsEnabled()
obj.SetCondition("i >= 10")
obj.GetCondition()
obj.SetThreadID(0)
obj.GetThreadID()
obj.SetThreadIndex(0)
obj.GetThreadIndex()
obj.SetThreadName("worker thread")
obj.GetThreadName()
obj.SetQueueName("my queue")
obj.GetQueueName()
obj.IsResolved()
obj.GetDescription(lldb.SBStream(), lldb.eDescriptionLevelVerbose)
breakpoint = obj.GetBreakpoint()
# Do fuzz testing on the breakpoint obj, it should not crash lldb.
import sb_breakpoint
sb_breakpoint.fuzz_obj(breakpoint)

View File

@ -0,0 +1,42 @@
"""
Fuzz tests an object after the default construction to make sure it does not crash lldb.
"""
import sys
import lldb
def fuzz_obj(obj):
obj.IsValid()
obj.GetName()
obj.SetEnabled(True)
obj.IsEnabled()
obj.SetOneShot(True)
obj.IsOneShot()
obj.SetIgnoreCount(1)
obj.GetIgnoreCount()
obj.SetCondition("1 == 2")
obj.GetCondition()
obj.SetAutoContinue(False)
obj.GetAutoContinue()
obj.SetThreadID(0x1234)
obj.GetThreadID()
obj.SetThreadIndex(10)
obj.GetThreadIndex()
obj.SetThreadName("AThread")
obj.GetThreadName()
obj.SetQueueName("AQueue")
obj.GetQueueName()
obj.SetScriptCallbackFunction("AFunction")
commands = lldb.SBStringList()
obj.SetCommandLineCommands(commands)
obj.GetCommandLineCommands(commands)
obj.SetScriptCallbackBody("Insert Python Code here")
obj.GetAllowList()
obj.SetAllowList(False)
obj.GetAllowDelete()
obj.SetAllowDelete(False)
obj.GetAllowDisable()
obj.SetAllowDisable(False)
stream = lldb.SBStream()
obj.GetDescription(stream)

View File

@ -0,0 +1,21 @@
"""
Fuzz tests an object after the default construction to make sure it does not crash lldb.
"""
import sys
import lldb
def fuzz_obj(obj):
obj.BroadcastEventByType(lldb.eBreakpointEventTypeInvalidType, True)
obj.BroadcastEvent(lldb.SBEvent(), False)
listener = lldb.SBListener("fuzz_testing")
obj.AddInitialEventsToListener(listener, 0xffffffff)
obj.AddInitialEventsToListener(listener, 0)
obj.AddListener(listener, 0xffffffff)
obj.AddListener(listener, 0)
obj.GetName()
obj.EventTypeHasListeners(0)
obj.RemoveListener(listener, 0xffffffff)
obj.RemoveListener(listener, 0)
obj.Clear()

View File

@ -0,0 +1,29 @@
"""
Fuzz tests an object after the default construction to make sure it does not crash lldb.
"""
import sys
import lldb
def fuzz_obj(obj):
broadcaster = obj.GetBroadcaster()
# Do fuzz testing on the broadcaster obj, it should not crash lldb.
import sb_broadcaster
sb_broadcaster.fuzz_obj(broadcaster)
obj.AdoptFileDesriptor(0, False)
obj.AdoptFileDesriptor(1, False)
obj.AdoptFileDesriptor(2, False)
obj.Connect("file:/tmp/myfile")
obj.Connect(None)
obj.Disconnect()
obj.IsConnected()
obj.GetCloseOnEOF()
obj.SetCloseOnEOF(True)
obj.SetCloseOnEOF(False)
#obj.Write(None, sys.maxint, None)
#obj.Read(None, sys.maxint, 0xffffffff, None)
obj.ReadThreadStart()
obj.ReadThreadStop()
obj.ReadThreadIsRunning()
obj.SetReadThreadBytesReceivedCallback(None, None)

View File

@ -0,0 +1,16 @@
"""
Fuzz tests an object after the default construction to make sure it does not crash lldb.
"""
import sys
import lldb
def fuzz_obj(obj):
obj.GetFileSpec()
obj.GetNumLineEntries()
obj.GetLineEntryAtIndex(0xffffffff)
obj.FindLineEntryIndex(0, 0xffffffff, None)
obj.GetDescription(lldb.SBStream())
for line_entry in obj:
s = str(line_entry)

View File

@ -0,0 +1,61 @@
"""
Fuzz tests an object after the default construction to make sure it does not crash lldb.
"""
import sys
import lldb
def fuzz_obj(obj):
obj.SetAsync(True)
obj.SetAsync(False)
obj.GetAsync()
obj.SkipLLDBInitFiles(True)
obj.SetInputFileHandle(None, True)
obj.SetOutputFileHandle(None, True)
obj.SetErrorFileHandle(None, True)
obj.GetInputFileHandle()
obj.GetOutputFileHandle()
obj.GetErrorFileHandle()
obj.GetCommandInterpreter()
obj.HandleCommand("nothing here")
listener = obj.GetListener()
obj.HandleProcessEvent(lldb.SBProcess(), lldb.SBEvent(), None, None)
obj.CreateTargetWithFileAndTargetTriple("a.out", "A-B-C")
obj.CreateTargetWithFileAndArch("b.out", "arm")
obj.CreateTarget("c.out")
obj.DeleteTarget(lldb.SBTarget())
obj.GetTargetAtIndex(0xffffffff)
obj.FindTargetWithProcessID(0)
obj.FindTargetWithFileAndArch("a.out", "arm")
obj.GetNumTargets()
obj.GetSelectedTarget()
obj.GetNumPlatforms()
obj.GetPlatformAtIndex(0xffffffff)
obj.GetNumAvailablePlatforms()
obj.GetAvailablePlatformInfoAtIndex(0xffffffff)
obj.GetSourceManager()
obj.SetSelectedTarget(lldb.SBTarget())
obj.SetCurrentPlatformSDKRoot("tmp/sdk-root")
try:
obj.DispatchInput(None)
except Exception:
pass
obj.DispatchInputInterrupt()
obj.DispatchInputEndOfFile()
obj.GetInstanceName()
obj.GetDescription(lldb.SBStream())
obj.GetTerminalWidth()
obj.SetTerminalWidth(0xffffffff)
obj.GetID()
obj.GetPrompt()
obj.SetPrompt("Hi, Mom!")
obj.GetScriptLanguage()
obj.SetScriptLanguage(lldb.eScriptLanguageNone)
obj.SetScriptLanguage(lldb.eScriptLanguagePython)
obj.GetCloseInputOnEOF()
obj.SetCloseInputOnEOF(True)
obj.SetCloseInputOnEOF(False)
obj.Clear()
for target in obj:
s = str(target)

View File

@ -0,0 +1,26 @@
"""
Fuzz tests an object after the default construction to make sure it does not crash lldb.
"""
import sys
import lldb
def fuzz_obj(obj):
obj.GetCString()
obj.Fail()
obj.Success()
obj.GetError()
obj.GetType()
obj.SetError(5, lldb.eErrorTypeGeneric)
obj.SetErrorToErrno()
obj.SetErrorToGenericError()
obj.SetErrorString("xyz")
obj.SetErrorString(None)
obj.SetErrorStringWithFormat("%s!", "error")
obj.SetErrorStringWithFormat(None)
obj.SetErrorStringWithFormat("error")
obj.SetErrorStringWithFormat("%s %s", "warning", "danger")
obj.SetErrorStringWithFormat("%s %s %s", "danger", "will", "robinson")
obj.GetDescription(lldb.SBStream())
obj.Clear()

View File

@ -0,0 +1,18 @@
"""
Fuzz tests an object after the default construction to make sure it does not crash lldb.
"""
import sys
import lldb
def fuzz_obj(obj):
obj.GetDataFlavor()
obj.GetType()
broadcaster = obj.GetBroadcaster()
# Do fuzz testing on the broadcaster obj, it should not crash lldb.
import sb_broadcaster
sb_broadcaster.fuzz_obj(broadcaster)
obj.BroadcasterMatchesRef(broadcaster)
obj.GetDescription(lldb.SBStream())
obj.Clear()

Some files were not shown because too many files have changed in this diff Show More