1cd6377ee248eb5c7f0888b92bcbf52b79b6cea79Johnny Chen"""
2cd6377ee248eb5c7f0888b92bcbf52b79b6cea79Johnny ChenFuzz tests an object after the default construction to make sure it does not crash lldb.
3cd6377ee248eb5c7f0888b92bcbf52b79b6cea79Johnny Chen"""
4cd6377ee248eb5c7f0888b92bcbf52b79b6cea79Johnny Chen
5cd6377ee248eb5c7f0888b92bcbf52b79b6cea79Johnny Chenimport sys
6cd6377ee248eb5c7f0888b92bcbf52b79b6cea79Johnny Chenimport lldb
7cd6377ee248eb5c7f0888b92bcbf52b79b6cea79Johnny Chen
8cd6377ee248eb5c7f0888b92bcbf52b79b6cea79Johnny Chendef fuzz_obj(obj):
9e0510ea02ad1998973a9e0733f2342b06ddcf182Johnny Chen    obj.GetAddress()
10cd6377ee248eb5c7f0888b92bcbf52b79b6cea79Johnny Chen    obj.GetLoadAddress()
11cd6377ee248eb5c7f0888b92bcbf52b79b6cea79Johnny Chen    obj.SetEnabled(True)
12cd6377ee248eb5c7f0888b92bcbf52b79b6cea79Johnny Chen    obj.IsEnabled()
13cd6377ee248eb5c7f0888b92bcbf52b79b6cea79Johnny Chen    obj.SetCondition("i >= 10")
14cd6377ee248eb5c7f0888b92bcbf52b79b6cea79Johnny Chen    obj.GetCondition()
15cd6377ee248eb5c7f0888b92bcbf52b79b6cea79Johnny Chen    obj.SetThreadID(0)
16cd6377ee248eb5c7f0888b92bcbf52b79b6cea79Johnny Chen    obj.GetThreadID()
17cd6377ee248eb5c7f0888b92bcbf52b79b6cea79Johnny Chen    obj.SetThreadIndex(0)
18cd6377ee248eb5c7f0888b92bcbf52b79b6cea79Johnny Chen    obj.GetThreadIndex()
19cd6377ee248eb5c7f0888b92bcbf52b79b6cea79Johnny Chen    obj.SetThreadName("worker thread")
20cd6377ee248eb5c7f0888b92bcbf52b79b6cea79Johnny Chen    obj.GetThreadName()
21cd6377ee248eb5c7f0888b92bcbf52b79b6cea79Johnny Chen    obj.SetQueueName("my queue")
22cd6377ee248eb5c7f0888b92bcbf52b79b6cea79Johnny Chen    obj.GetQueueName()
23cd6377ee248eb5c7f0888b92bcbf52b79b6cea79Johnny Chen    obj.IsResolved()
24cd6377ee248eb5c7f0888b92bcbf52b79b6cea79Johnny Chen    obj.GetDescription(lldb.SBStream(), lldb.eDescriptionLevelVerbose)
25cd6377ee248eb5c7f0888b92bcbf52b79b6cea79Johnny Chen    breakpoint = obj.GetBreakpoint()
26cd6377ee248eb5c7f0888b92bcbf52b79b6cea79Johnny Chen    # Do fuzz testing on the breakpoint obj, it should not crash lldb.
27cd6377ee248eb5c7f0888b92bcbf52b79b6cea79Johnny Chen    import sb_breakpoint
28cd6377ee248eb5c7f0888b92bcbf52b79b6cea79Johnny Chen    sb_breakpoint.fuzz_obj(breakpoint)
29