lldb-sys 0.0.13

Raw bindings to the LLDB C++ API. LLDB is the debugger that is part of the LLVM project and is the default system debugger on Mac OS X. Building and using this is currently slightly tricky, so be sure to see the README.md in the repository.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
//===-- SBTargetBinding.cpp -------------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#include "lldb/Bindings/LLDBBinding.h"
#include "lldb/API/LLDB.h"

using namespace lldb;

#ifdef __cplusplus
extern "C" {
#endif

SBTargetRef
CreateSBTarget()
{
    return reinterpret_cast<SBTargetRef>(new SBTarget());
}

void
DisposeSBTarget(SBTargetRef instance)
{
    delete reinterpret_cast<SBTarget *>(instance);
}

bool
SBTargetIsValid(SBTargetRef instance)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return unwrapped->IsValid();
}

bool
SBTargetEventIsTargetEvent(SBEventRef event)
{
    return lldb::SBTarget::EventIsTargetEvent(*reinterpret_cast<SBEvent *>(event));
}

SBTargetRef
SBTargetGetTargetFromEvent(SBEventRef event)
{
    return reinterpret_cast<SBTargetRef>(
        new SBTarget(lldb::SBTarget::GetTargetFromEvent(*reinterpret_cast<SBEvent *>(event))));
}

unsigned int
SBTargetGetNumModulesFromEvent(SBEventRef event)
{
    return lldb::SBTarget::GetNumModulesFromEvent(*reinterpret_cast<SBEvent *>(event));
}

SBModuleRef
SBTargetGetModuleAtIndexFromEvent(const uint32_t idx, SBEventRef event)
{
    return reinterpret_cast<SBModuleRef>(
        new SBModule(lldb::SBTarget::GetModuleAtIndexFromEvent(idx, *reinterpret_cast<SBEvent *>(event))));
}

const char *
SBTargetGetBroadcasterClassName()
{
    return lldb::SBTarget::GetBroadcasterClassName();
}

SBProcessRef
SBTargetGetProcess(SBTargetRef instance)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBProcessRef>(new SBProcess(unwrapped->GetProcess()));
}

SBPlatformRef
SBTargetGetPlatform(SBTargetRef instance)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBPlatformRef>(new SBPlatform(unwrapped->GetPlatform()));
}

SBErrorRef
SBTargetInstall(SBTargetRef instance)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBErrorRef>(new SBError(unwrapped->Install()));
}

SBProcessRef
SBTargetLaunch(SBTargetRef instance, SBListenerRef listener, const char **argv, const char **envp,
                   const char *stdin_path, const char *stdout_path, const char *stderr_path,
                   const char *working_directory, uint32_t launch_flags, bool stop_at_entry, SBErrorRef error)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBProcessRef>(new SBProcess(
        unwrapped->Launch(*reinterpret_cast<SBListener *>(listener), argv, envp, stdin_path, stdout_path, stderr_path,
                          working_directory, launch_flags, stop_at_entry, *reinterpret_cast<SBError *>(error))));
}

SBProcessRef
SBTargetLaunchSimple(SBTargetRef instance, const char **argv, const char **envp, const char *working_directory)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBProcessRef>(new SBProcess(unwrapped->LaunchSimple(argv, envp, working_directory)));
}

SBProcessRef
SBTargetLaunch2(SBTargetRef instance, SBLaunchInfoRef launch_info, SBErrorRef error)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBProcessRef>(new SBProcess(
        unwrapped->Launch(*reinterpret_cast<SBLaunchInfo *>(launch_info), *reinterpret_cast<SBError *>(error))));
}

SBProcessRef
SBTargetLoadCore(SBTargetRef instance, const char *core_file)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBProcessRef>(new SBProcess(unwrapped->LoadCore(core_file)));
}

SBProcessRef
SBTargetAttach(SBTargetRef instance, SBAttachInfoRef attach_info, SBErrorRef error)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBProcessRef>(new SBProcess(
        unwrapped->Attach(*reinterpret_cast<SBAttachInfo *>(attach_info), *reinterpret_cast<SBError *>(error))));
}

SBProcessRef
SBTargetAttachToProcessWithID(SBTargetRef instance, SBListenerRef listener, lldb_pid_t pid,
                                  SBErrorRef error)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBProcessRef>(new SBProcess(unwrapped->AttachToProcessWithID(
        *reinterpret_cast<SBListener *>(listener), pid, *reinterpret_cast<SBError *>(error))));
}

SBProcessRef
SBTargetAttachToProcessWithName(SBTargetRef instance, SBListenerRef listener, const char *name,
                                    bool wait_for, SBErrorRef error)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBProcessRef>(new SBProcess(unwrapped->AttachToProcessWithName(
        *reinterpret_cast<SBListener *>(listener), name, wait_for, *reinterpret_cast<SBError *>(error))));
}

SBProcessRef
SBTargetConnectRemote(SBTargetRef instance, SBListenerRef listener, const char *url,
                          const char *plugin_name, SBErrorRef error)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBProcessRef>(new SBProcess(unwrapped->ConnectRemote(
        *reinterpret_cast<SBListener *>(listener), url, plugin_name, *reinterpret_cast<SBError *>(error))));
}

SBFileSpecRef
SBTargetGetExecutable(SBTargetRef instance)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBFileSpecRef>(new SBFileSpec(unwrapped->GetExecutable()));
}

bool
SBTargetAddModule(SBTargetRef instance, SBModuleRef module)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return unwrapped->AddModule(*reinterpret_cast<SBModule *>(module));
}

SBModuleRef
SBTargetAddModuleSpec(SBTargetRef instance, SBModuleSpecRef module_spec)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBModuleRef>(
        new SBModule(unwrapped->AddModule(*reinterpret_cast<SBModuleSpec *>(module_spec))));
}

unsigned int
SBTargetGetNumModules(SBTargetRef instance)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return unwrapped->GetNumModules();
}

SBModuleRef
SBTargetGetModuleAtIndex(SBTargetRef instance, uint32_t idx)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBModuleRef>(new SBModule(unwrapped->GetModuleAtIndex(idx)));
}

bool
SBTargetRemoveModule(SBTargetRef instance, SBModuleRef module)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return unwrapped->RemoveModule(*reinterpret_cast<SBModule *>(module));
}

SBDebuggerRef
SBTargetGetDebugger(SBTargetRef instance)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBDebuggerRef>(new SBDebugger(unwrapped->GetDebugger()));
}

SBModuleRef
SBTargetFindModule(SBTargetRef instance, SBFileSpecRef file_spec)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBModuleRef>(
        new SBModule(unwrapped->FindModule(*reinterpret_cast<SBFileSpec *>(file_spec))));
}

enum lldb::ByteOrder
SBTargetGetByteOrder(SBTargetRef instance)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return unwrapped->GetByteOrder();
}

unsigned int
SBTargetGetAddressByteSize(SBTargetRef instance)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return unwrapped->GetAddressByteSize();
}

const char *
SBTargetGetTriple(SBTargetRef instance)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return unwrapped->GetTriple();
}

unsigned int
SBTargetGetDataByteSize(SBTargetRef instance)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return unwrapped->GetDataByteSize();
}

unsigned int
SBTargetGetCodeByteSize(SBTargetRef instance)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return unwrapped->GetCodeByteSize();
}

SBErrorRef
SBTargetSetSectionLoadAddress(SBTargetRef instance, SBSectionRef section, lldb_addr_t section_base_addr)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBErrorRef>(
        new SBError(unwrapped->SetSectionLoadAddress(*reinterpret_cast<SBSection *>(section), section_base_addr)));
}

SBErrorRef
SBTargetClearSectionLoadAddress(SBTargetRef instance, SBSectionRef section)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBErrorRef>(
        new SBError(unwrapped->ClearSectionLoadAddress(*reinterpret_cast<SBSection *>(section))));
}

SBErrorRef
SBTargetSetModuleLoadAddress(SBTargetRef instance, SBModuleRef module, int64_t sections_offset)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBErrorRef>(
        new SBError(unwrapped->SetModuleLoadAddress(*reinterpret_cast<SBModule *>(module), sections_offset)));
}

SBErrorRef
SBTargetClearModuleLoadAddress(SBTargetRef instance, SBModuleRef module)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBErrorRef>(
        new SBError(unwrapped->ClearModuleLoadAddress(*reinterpret_cast<SBModule *>(module))));
}

SBSymbolContextListRef
SBTargetFindFunctions(SBTargetRef instance, const char *name, uint32_t name_type_mask)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBSymbolContextListRef>(
        new SBSymbolContextList(unwrapped->FindFunctions(name, name_type_mask)));
}

SBValueListRef
SBTargetFindGlobalVariables(SBTargetRef instance, const char *name, uint32_t max_matches)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBValueListRef>(new SBValueList(unwrapped->FindGlobalVariables(name, max_matches)));
}

SBValueRef
SBTargetFindFirstGlobalVariable(SBTargetRef instance, const char *name)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBValueRef>(new SBValue(unwrapped->FindFirstGlobalVariable(name)));
}

SBValueListRef
SBTargetFindGlobalVariables2(SBTargetRef instance, const char *name, uint32_t max_matches,
                             enum lldb::MatchType matchtype)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBValueListRef>(
        new SBValueList(unwrapped->FindGlobalVariables(name, max_matches, matchtype)));
}

SBSymbolContextListRef
SBTargetFindGlobalFunctions(SBTargetRef instance, const char *name, uint32_t max_matches,
                            enum lldb::MatchType matchtype)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBSymbolContextListRef>(
        new SBSymbolContextList(unwrapped->FindGlobalFunctions(name, max_matches, matchtype)));
}

void
SBTargetClear(SBTargetRef instance)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    unwrapped->Clear();
}

SBAddressRef
SBTargetResolveFileAddress(SBTargetRef instance, lldb_addr_t file_addr)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBAddressRef>(new SBAddress(unwrapped->ResolveFileAddress(file_addr)));
}

SBAddressRef
SBTargetResolveLoadAddress(SBTargetRef instance, lldb_addr_t vm_addr)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBAddressRef>(new SBAddress(unwrapped->ResolveLoadAddress(vm_addr)));
}

SBAddressRef
SBTargetResolvePastLoadAddress(SBTargetRef instance, uint32_t stop_id, lldb_addr_t vm_addr)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBAddressRef>(new SBAddress(unwrapped->ResolvePastLoadAddress(stop_id, vm_addr)));
}

SBSymbolContextRef
SBTargetResolveSymbolContextForAddress(SBTargetRef instance, SBAddressRef addr, uint32_t resolve_scope)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBSymbolContextRef>(new SBSymbolContext(
        unwrapped->ResolveSymbolContextForAddress(*reinterpret_cast<SBAddress *>(addr), resolve_scope)));
}

unsigned int
SBTargetReadMemory(SBTargetRef instance, SBAddressRef addr, void *buf, size_t size, SBErrorRef error)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return unwrapped->ReadMemory(*reinterpret_cast<SBAddress *>(addr), buf, size, *reinterpret_cast<SBError *>(error));
}

SBBreakpointRef
SBTargetBreakpointCreateByLocation(SBTargetRef instance, const char *file, uint32_t line)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBBreakpointRef>(new SBBreakpoint(unwrapped->BreakpointCreateByLocation(file, line)));
}

SBBreakpointRef
SBTargetBreakpointCreateByLocation2(SBTargetRef instance, SBFileSpecRef file_spec, uint32_t line)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBBreakpointRef>(
        new SBBreakpoint(unwrapped->BreakpointCreateByLocation(*reinterpret_cast<SBFileSpec *>(file_spec), line)));
}

SBBreakpointRef
SBTargetBreakpointCreateByLocation3(SBTargetRef instance, SBFileSpecRef file_spec,
                                    uint32_t line, lldb_addr_t offset)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBBreakpointRef>(
        new SBBreakpoint(unwrapped->BreakpointCreateByLocation(*reinterpret_cast<SBFileSpec *>(file_spec), line, offset)));
}

SBBreakpointRef
SBTargetBreakpointCreateByLocation4(SBTargetRef instance, SBFileSpecRef file_spec,
                                    uint32_t line, lldb_addr_t offset,
                                    SBFileSpecListRef module_list)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBBreakpointRef>(
        new SBBreakpoint(unwrapped->BreakpointCreateByLocation(*reinterpret_cast<SBFileSpec *>(file_spec), line, offset, *reinterpret_cast<SBFileSpecList *>(module_list))));
}

SBBreakpointRef
SBTargetBreakpointCreateByName(SBTargetRef instance, const char *symbol_name, const char *module_name)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBBreakpointRef>(
        new SBBreakpoint(unwrapped->BreakpointCreateByName(symbol_name, module_name)));
}

SBBreakpointRef
SBTargetBreakpointCreateByName2(SBTargetRef instance, const char *symbol_name,
                                SBFileSpecListRef module_list, SBFileSpecListRef comp_unit_list)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBBreakpointRef>(new SBBreakpoint(
        unwrapped->BreakpointCreateByName(symbol_name, *reinterpret_cast<SBFileSpecList *>(module_list),
                                          *reinterpret_cast<SBFileSpecList *>(comp_unit_list))));
}

SBBreakpointRef
SBTargetBreakpointCreateByName3(SBTargetRef instance, const char *symbol_name, uint32_t name_type_mask,
                                SBFileSpecListRef module_list, SBFileSpecListRef comp_unit_list)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBBreakpointRef>(new SBBreakpoint(
        unwrapped->BreakpointCreateByName(symbol_name, name_type_mask, *reinterpret_cast<SBFileSpecList *>(module_list),
                                          *reinterpret_cast<SBFileSpecList *>(comp_unit_list))));
}

SBBreakpointRef
SBTargetBreakpointCreateByNames(SBTargetRef instance, const char **symbol_name, uint32_t num_names,
                                uint32_t name_type_mask, SBFileSpecListRef module_list,
                                SBFileSpecListRef comp_unit_list)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBBreakpointRef>(new SBBreakpoint(unwrapped->BreakpointCreateByNames(
        symbol_name, num_names, name_type_mask, *reinterpret_cast<SBFileSpecList *>(module_list),
        *reinterpret_cast<SBFileSpecList *>(comp_unit_list))));
}

SBBreakpointRef
SBTargetBreakpointCreateByNames2(SBTargetRef instance, const char **symbol_name, uint32_t num_names,
                                 uint32_t name_type_mask, lldb::LanguageType symbol_language,
                                 SBFileSpecListRef module_list,
                                 SBFileSpecListRef comp_unit_list)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBBreakpointRef>(new SBBreakpoint(unwrapped->BreakpointCreateByNames(
        symbol_name, num_names, name_type_mask, symbol_language,
        *reinterpret_cast<SBFileSpecList *>(module_list),
        *reinterpret_cast<SBFileSpecList *>(comp_unit_list))));
}

SBBreakpointRef
SBTargetBreakpointCreateByNames3(SBTargetRef instance, const char **symbol_name, uint32_t num_names,
                                 uint32_t name_type_mask, lldb::LanguageType symbol_language,
                                 lldb::addr_t offset,
                                 SBFileSpecListRef module_list,
                                 SBFileSpecListRef comp_unit_list)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBBreakpointRef>(new SBBreakpoint(unwrapped->BreakpointCreateByNames(
        symbol_name, num_names, name_type_mask, symbol_language, offset,
        *reinterpret_cast<SBFileSpecList *>(module_list),
        *reinterpret_cast<SBFileSpecList *>(comp_unit_list))));
}

SBBreakpointRef
SBTargetBreakpointCreateByRegex(SBTargetRef instance, const char *symbol_name_regex, const char *module_name)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBBreakpointRef>(
        new SBBreakpoint(unwrapped->BreakpointCreateByRegex(symbol_name_regex, module_name)));
}

SBBreakpointRef
SBTargetBreakpointCreateByRegex2(SBTargetRef instance, const char *symbol_name_regex,
                                 SBFileSpecListRef module_list, SBFileSpecListRef comp_unit_list)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBBreakpointRef>(new SBBreakpoint(
        unwrapped->BreakpointCreateByRegex(symbol_name_regex, *reinterpret_cast<SBFileSpecList *>(module_list),
                                           *reinterpret_cast<SBFileSpecList *>(comp_unit_list))));
}

SBBreakpointRef
SBTargetBreakpointCreateByRegex3(SBTargetRef instance, const char *symbol_name_regex,
                                 lldb::LanguageType symbol_language,
                                 SBFileSpecListRef module_list, SBFileSpecListRef comp_unit_list)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBBreakpointRef>(new SBBreakpoint(
        unwrapped->BreakpointCreateByRegex(symbol_name_regex, symbol_language,
                                           *reinterpret_cast<SBFileSpecList *>(module_list),
                                           *reinterpret_cast<SBFileSpecList *>(comp_unit_list))));
}

SBBreakpointRef
SBTargetBreakpointCreateBySourceRegex(SBTargetRef instance, const char *source_regex,
                                      SBFileSpecRef source_file, const char *module_name)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBBreakpointRef>(new SBBreakpoint(unwrapped->BreakpointCreateBySourceRegex(
        source_regex, *reinterpret_cast<SBFileSpec *>(source_file), module_name)));
}

SBBreakpointRef
SBTargetBreakpointCreateBySourceRegex2(SBTargetRef instance, const char *source_regex,
                                       SBFileSpecListRef module_list, SBFileSpecListRef source_file)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBBreakpointRef>(new SBBreakpoint(
        unwrapped->BreakpointCreateBySourceRegex(source_regex,
                                                 *reinterpret_cast<SBFileSpecList *>(module_list),
                                                 *reinterpret_cast<SBFileSpecList *>(source_file))));
}

SBBreakpointRef
SBTargetBreakpointCreateBySourceRegex3(SBTargetRef instance, const char *source_regex,
                                       SBFileSpecListRef module_list,
                                       SBFileSpecListRef source_file,
                                       SBStringListRef func_names)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBBreakpointRef>(new SBBreakpoint(
        unwrapped->BreakpointCreateBySourceRegex(source_regex,
                                                 *reinterpret_cast<SBFileSpecList *>(module_list),
                                                 *reinterpret_cast<SBFileSpecList *>(source_file),
                                                 *reinterpret_cast<SBStringList *>(func_names))));
}

SBBreakpointRef
SBTargetBreakpointCreateForException(SBTargetRef instance, lldb::LanguageType language,
                                     bool catch_bp, bool throw_bp)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBBreakpointRef>(
        new SBBreakpoint(unwrapped->BreakpointCreateForException(language, catch_bp, throw_bp)));
}

SBBreakpointRef
SBTargetBreakpointCreateByAddress(SBTargetRef instance, lldb_addr_t address)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBBreakpointRef>(new SBBreakpoint(unwrapped->BreakpointCreateByAddress(address)));
}

SBBreakpointRef
SBTargetBreakpointCreateBySBAddress(SBTargetRef instance, SBAddressRef address)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBBreakpointRef>(
        new SBBreakpoint(
            unwrapped->BreakpointCreateBySBAddress(*reinterpret_cast<SBAddress *>(address))));
}

LLDB_API SBErrorRef
SBTargetBreakpointsCreateFromFile(SBTargetRef instance, SBFileSpecRef source_file,
                                  SBBreakpointListRef new_bps)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBErrorRef>(
        new SBError(
            unwrapped->BreakpointsCreateFromFile(*reinterpret_cast<SBFileSpec *>(source_file),
                                                 *reinterpret_cast<SBBreakpointList *>(new_bps))));
}

LLDB_API SBErrorRef
SBTargetBreakpointsCreateFromFile2(SBTargetRef instance, SBFileSpecRef source_file,
                                  SBStringListRef matching_names,
                                  SBBreakpointListRef new_bps)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBErrorRef>(
        new SBError(
            unwrapped->BreakpointsCreateFromFile(*reinterpret_cast<SBFileSpec *>(source_file),
                                                 *reinterpret_cast<SBStringList *>(matching_names),
                                                 *reinterpret_cast<SBBreakpointList *>(new_bps))));
}

SBErrorRef
SBTargetBreakspointsWriteToFile(SBTargetRef instance, SBFileSpecRef dest_file)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBErrorRef>(
        new SBError(
            unwrapped->BreakpointsWriteToFile(*reinterpret_cast<SBFileSpec *>(dest_file))));
}

SBErrorRef
SBTargetBreakspointsWriteToFile2(SBTargetRef instance, SBFileSpecRef dest_file,
                                 SBBreakpointListRef bkpt_list, bool append)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBErrorRef>(
        new SBError(
            unwrapped->BreakpointsWriteToFile(*reinterpret_cast<SBFileSpec *>(dest_file),
                                              *reinterpret_cast<SBBreakpointList *>(bkpt_list),
                                              append)));
}

unsigned int
SBTargetGetNumBreakpoints(SBTargetRef instance)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return unwrapped->GetNumBreakpoints();
}

SBBreakpointRef
SBTargetGetBreakpointAtIndex(SBTargetRef instance, uint32_t idx)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBBreakpointRef>(new SBBreakpoint(unwrapped->GetBreakpointAtIndex(idx)));
}

bool
SBTargetBreakpointDelete(SBTargetRef instance, int break_id)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return unwrapped->BreakpointDelete(break_id);
}

SBBreakpointRef
SBTargetFindBreakpointByID(SBTargetRef instance, int break_id)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBBreakpointRef>(new SBBreakpoint(unwrapped->FindBreakpointByID(break_id)));
}

bool
SBTargetFindBreakpointsByName(SBTargetRef instance,
                              const char *name,
                              SBBreakpointListRef bkpt_list)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return unwrapped->FindBreakpointsByName(name, *reinterpret_cast<SBBreakpointList *>(bkpt_list));
}

bool
SBTargetEnableAllBreakpoints(SBTargetRef instance)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return unwrapped->EnableAllBreakpoints();
}

bool
SBTargetDisableAllBreakpoints(SBTargetRef instance)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return unwrapped->DisableAllBreakpoints();
}

bool
SBTargetDeleteAllBreakpoints(SBTargetRef instance)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return unwrapped->DeleteAllBreakpoints();
}

unsigned int
SBTargetGetNumWatchpoints(SBTargetRef instance)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return unwrapped->GetNumWatchpoints();
}

SBWatchpointRef
SBTargetGetWatchpointAtIndex(SBTargetRef instance, uint32_t idx)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBWatchpointRef>(new SBWatchpoint(unwrapped->GetWatchpointAtIndex(idx)));
}

bool
SBTargetDeleteWatchpoint(SBTargetRef instance, int watch_id)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return unwrapped->DeleteWatchpoint(watch_id);
}

SBWatchpointRef
SBTargetFindWatchpointByID(SBTargetRef instance, int watch_id)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBWatchpointRef>(new SBWatchpoint(unwrapped->FindWatchpointByID(watch_id)));
}

SBWatchpointRef
SBTargetWatchAddress(SBTargetRef instance, lldb_addr_t addr, size_t size, bool read, bool write,
                         SBErrorRef error)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBWatchpointRef>(
        new SBWatchpoint(unwrapped->WatchAddress(addr, size, read, write, *reinterpret_cast<SBError *>(error))));
}

bool
SBTargetEnableAllWatchpoints(SBTargetRef instance)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return unwrapped->EnableAllWatchpoints();
}

bool
SBTargetDisableAllWatchpoints(SBTargetRef instance)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return unwrapped->DisableAllWatchpoints();
}

bool
SBTargetDeleteAllWatchpoints(SBTargetRef instance)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return unwrapped->DeleteAllWatchpoints();
}

SBBroadcasterRef
SBTargetGetBroadcaster(SBTargetRef instance)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBBroadcasterRef>(new SBBroadcaster(unwrapped->GetBroadcaster()));
}

SBTypeRef
SBTargetFindFirstType(SBTargetRef instance, const char *type)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBTypeRef>(new SBType(unwrapped->FindFirstType(type)));
}

SBTypeListRef
SBTargetFindTypes(SBTargetRef instance, const char *type)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBTypeListRef>(new SBTypeList(unwrapped->FindTypes(type)));
}

SBTypeRef
SBTargetGetBasicType(SBTargetRef instance, lldb::BasicType type)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBTypeRef>(new SBType(unwrapped->GetBasicType(type)));
}

SBValueRef
SBTargetCreateValueFromAddress(SBTargetRef instance, const char *name, SBAddressRef addr,
                                   SBTypeRef type)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBValueRef>(new SBValue(unwrapped->CreateValueFromAddress(
        name, *reinterpret_cast<SBAddress *>(addr), *reinterpret_cast<SBType *>(type))));
}

SBValueRef
SBTargetCreateValueFromData(SBTargetRef instance, const char *name, SBDataRef data, SBTypeRef type)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBValueRef>(new SBValue(
        unwrapped->CreateValueFromData(name, *reinterpret_cast<SBData *>(data), *reinterpret_cast<SBType *>(type))));
}

SBValueRef
SBTargetCreateValueFromExpression(SBTargetRef instance, const char *name, const char *expr)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBValueRef>(new SBValue(unwrapped->CreateValueFromExpression(name, expr)));
}

SBSourceManagerRef
SBTargetGetSourceManager(SBTargetRef instance)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBSourceManagerRef>(new SBSourceManager(unwrapped->GetSourceManager()));
}

SBInstructionListRef
SBTargetReadInstructions(SBTargetRef instance, SBAddressRef base_addr, uint32_t count)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBInstructionListRef>(
        new SBInstructionList(unwrapped->ReadInstructions(*reinterpret_cast<SBAddress *>(base_addr), count)));
}

SBInstructionListRef
SBTargetReadInstructions2(SBTargetRef instance, SBAddressRef base_addr, uint32_t count,
                              const char *flavor_string)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBInstructionListRef>(new SBInstructionList(
        unwrapped->ReadInstructions(*reinterpret_cast<SBAddress *>(base_addr), count, flavor_string)));
}

SBInstructionListRef
SBTargetGetInstructions(SBTargetRef instance, SBAddressRef base_addr, void *buf, size_t size)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBInstructionListRef>(
        new SBInstructionList(unwrapped->GetInstructions(*reinterpret_cast<SBAddress *>(base_addr), buf, size)));
}

SBInstructionListRef
SBTargetGetInstructionsWithFlavor(SBTargetRef instance, SBAddressRef base_addr, const char *flavor_string,
                                      void *buf, size_t size)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBInstructionListRef>(new SBInstructionList(
        unwrapped->GetInstructionsWithFlavor(*reinterpret_cast<SBAddress *>(base_addr), flavor_string, buf, size)));
}

SBInstructionListRef
SBTargetGetInstructions2(SBTargetRef instance, lldb_addr_t base_addr, void *buf, size_t size)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBInstructionListRef>(
        new SBInstructionList(unwrapped->GetInstructions(base_addr, buf, size)));
}

SBInstructionListRef
SBTargetGetInstructionsWithFlavor2(SBTargetRef instance, lldb_addr_t base_addr, const char *flavor_string,
                                       void *buf, size_t size)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBInstructionListRef>(
        new SBInstructionList(unwrapped->GetInstructionsWithFlavor(base_addr, flavor_string, buf, size)));
}

SBSymbolContextListRef
SBTargetFindSymbols(SBTargetRef instance, const char *name, lldb::SymbolType type)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBSymbolContextListRef>(new SBSymbolContextList(unwrapped->FindSymbols(name, type)));
}

bool
SBTargetGetDescription(SBTargetRef instance, SBStreamRef description,
                           lldb::DescriptionLevel description_level)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return unwrapped->GetDescription(*reinterpret_cast<SBStream *>(description), description_level);
}

SBValueRef
SBTargetEvaluateExpression(SBTargetRef instance, const char *expr, SBExpressionOptionsRef options)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBValueRef>(
        new SBValue(unwrapped->EvaluateExpression(expr, *reinterpret_cast<SBExpressionOptions *>(options))));
}

lldb::addr_t
SBTargetGetStackRedZoneSize(SBTargetRef instance)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return unwrapped->GetStackRedZoneSize();
}

SBLaunchInfoRef
SBTargetGetLaunchInfo(SBTargetRef instance)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    return reinterpret_cast<SBLaunchInfoRef>(new SBLaunchInfo(unwrapped->GetLaunchInfo()));
}

void
SBTargetSetLaunchInfo(SBTargetRef instance, SBLaunchInfoRef launch_info)
{
    SBTarget *unwrapped = reinterpret_cast<SBTarget *>(instance);
    unwrapped->SetLaunchInfo(*reinterpret_cast<SBLaunchInfo *>(launch_info));
}

#ifdef __cplusplus
}
#endif