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
//===-- SBProcessBinding.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"
#include "lldb/API/SBUnixSignals.h"
#include "lldb/API/SBThreadCollection.h"

using namespace lldb;

#ifdef __cplusplus
extern "C" {
#endif

SBProcessRef
CreateSBProcess()
{
    return reinterpret_cast<SBProcessRef>(new SBProcess());
}

void
DisposeSBProcess(SBProcessRef instance)
{
    delete reinterpret_cast<SBProcess *>(instance);
}

const char *
SBProcessGetBroadcasterClassName()
{
    return lldb::SBProcess::GetBroadcasterClassName();
}

const char *
SBProcessGetPluginName(SBProcessRef instance)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return unwrapped->GetPluginName();
}

const char *
SBProcessGetShortPluginName(SBProcessRef instance)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return unwrapped->GetShortPluginName();
}

void
SBProcessClear(SBProcessRef instance)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    unwrapped->Clear();
}

bool
SBProcessIsValid(SBProcessRef instance)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return unwrapped->IsValid();
}

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

enum lldb::ByteOrder
SBProcessGetByteOrder(SBProcessRef instance)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return unwrapped->GetByteOrder();
}

unsigned int
SBProcessPutSTDIN(SBProcessRef instance, const char *src, size_t src_len)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return unwrapped->PutSTDIN(src, src_len);
}

unsigned int
SBProcessGetSTDOUT(SBProcessRef instance, char *dst, size_t dst_len)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return unwrapped->GetSTDOUT(dst, dst_len);
}

unsigned int
SBProcessGetSTDERR(SBProcessRef instance, char *dst, size_t dst_len)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return unwrapped->GetSTDERR(dst, dst_len);
}

unsigned int
SBProcessGetAsyncProfileData(SBProcessRef instance, char *dst, size_t dst_len)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return unwrapped->GetAsyncProfileData(dst, dst_len);
}

void
SBProcessReportEventState(SBProcessRef instance, SBEventRef event, FILE *out)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    unwrapped->ReportEventState(*reinterpret_cast<SBEvent *>(event), reinterpret_cast<FILE *>(out));
}

void
SBProcessAppendEventStateReport(SBProcessRef instance, SBEventRef event,
                                    SBCommandReturnObjectRef result)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    unwrapped->AppendEventStateReport(*reinterpret_cast<SBEvent *>(event),
                                      *reinterpret_cast<SBCommandReturnObject *>(result));
}

bool
SBProcessRemoteAttachToProcessWithID(SBProcessRef instance, lldb_pid_t pid, SBErrorRef error)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return unwrapped->RemoteAttachToProcessWithID(pid, *reinterpret_cast<SBError *>(error));
}

bool
SBProcessRemoteLaunch(SBProcessRef instance, 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)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return unwrapped->RemoteLaunch(argv, envp, stdin_path, stdout_path, stderr_path, working_directory, launch_flags,
                                   stop_at_entry, *reinterpret_cast<SBError *>(error));
}

unsigned int
SBProcessGetNumThreads(SBProcessRef instance)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return unwrapped->GetNumThreads();
}

SBThreadRef
SBProcessGetThreadAtIndex(SBProcessRef instance, size_t index)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return reinterpret_cast<SBThreadRef>(new SBThread(unwrapped->GetThreadAtIndex(index)));
}

SBThreadRef
SBProcessGetThreadByID(SBProcessRef instance, lldb_tid_t sb_thread_id)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return reinterpret_cast<SBThreadRef>(new SBThread(unwrapped->GetThreadByID(sb_thread_id)));
}

SBThreadRef
SBProcessGetThreadByIndexID(SBProcessRef instance, uint32_t index_id)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return reinterpret_cast<SBThreadRef>(new SBThread(unwrapped->GetThreadByIndexID(index_id)));
}

SBThreadRef
SBProcessGetSelectedThread(SBProcessRef instance)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return reinterpret_cast<SBThreadRef>(new SBThread(unwrapped->GetSelectedThread()));
}

SBThreadRef
SBProcessCreateOSPluginThread(SBProcessRef instance, lldb_tid_t tid, lldb_addr_t context)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return reinterpret_cast<SBThreadRef>(new SBThread(unwrapped->CreateOSPluginThread(tid, context)));
}

bool
SBProcessSetSelectedThread(SBProcessRef instance, SBThreadRef thread)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return unwrapped->SetSelectedThread(*reinterpret_cast<SBThread *>(thread));
}

bool
SBProcessSetSelectedThreadByID(SBProcessRef instance, lldb_tid_t tid)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return unwrapped->SetSelectedThreadByID(tid);
}

bool
SBProcessSetSelectedThreadByIndexID(SBProcessRef instance, uint32_t index_id)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return unwrapped->SetSelectedThreadByIndexID(index_id);
}

unsigned int
SBProcessGetNumQueues(SBProcessRef instance)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return unwrapped->GetNumQueues();
}

SBQueueRef
SBProcessGetQueueAtIndex(SBProcessRef instance, size_t index)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return reinterpret_cast<SBQueueRef>(new SBQueue(unwrapped->GetQueueAtIndex(index)));
}

lldb::StateType
SBProcessGetState(SBProcessRef instance)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return unwrapped->GetState();
}

int
SBProcessGetExitStatus(SBProcessRef instance)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return unwrapped->GetExitStatus();
}

const char *
SBProcessGetExitDescription(SBProcessRef instance)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return unwrapped->GetExitDescription();
}

unsigned long long
SBProcessGetProcessID(SBProcessRef instance)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return unwrapped->GetProcessID();
}

unsigned int
SBProcessGetUniqueID(SBProcessRef instance)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return unwrapped->GetUniqueID();
}

unsigned int
SBProcessGetAddressByteSize(SBProcessRef instance)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return unwrapped->GetAddressByteSize();
}

SBErrorRef
SBProcessDestroy(SBProcessRef instance)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return reinterpret_cast<SBErrorRef>(new SBError(unwrapped->Destroy()));
}

SBErrorRef
SBProcessContinue(SBProcessRef instance)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return reinterpret_cast<SBErrorRef>(new SBError(unwrapped->Continue()));
}

SBErrorRef
SBProcessStop(SBProcessRef instance)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return reinterpret_cast<SBErrorRef>(new SBError(unwrapped->Stop()));
}

SBErrorRef
SBProcessKill(SBProcessRef instance)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return reinterpret_cast<SBErrorRef>(new SBError(unwrapped->Kill()));
}

SBErrorRef
SBProcessDetach(SBProcessRef instance)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return reinterpret_cast<SBErrorRef>(new SBError(unwrapped->Detach()));
}

SBErrorRef
SBProcessDetach2(SBProcessRef instance, bool keep_stopped)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return reinterpret_cast<SBErrorRef>(new SBError(unwrapped->Detach(keep_stopped)));
}

SBErrorRef
SBProcessSignal(SBProcessRef instance, int signal)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return reinterpret_cast<SBErrorRef>(new SBError(unwrapped->Signal(signal)));
}

SBUnixSignalsRef
SBProcessGetUnixSignals(SBProcessRef instance)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return reinterpret_cast<SBUnixSignalsRef>(new SBUnixSignals(unwrapped->GetUnixSignals()));
}

void
SBProcessSendAsyncInterrupt(SBProcessRef instance)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    unwrapped->SendAsyncInterrupt();
}

unsigned int
SBProcessGetStopID(SBProcessRef instance, bool include_expression_stops)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return unwrapped->GetStopID(include_expression_stops);
}

unsigned int
SBProcessReadMemory(SBProcessRef instance, lldb_addr_t addr, void *buf, size_t size, SBErrorRef error)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return unwrapped->ReadMemory(addr, buf, size, *reinterpret_cast<SBError *>(error));
}

unsigned int
SBProcessWriteMemory(SBProcessRef instance, lldb_addr_t addr, void *buf, size_t size, SBErrorRef error)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return unwrapped->WriteMemory(addr, buf, size, *reinterpret_cast<SBError *>(error));
}

unsigned int
SBProcessReadCStringFromMemory(SBProcessRef instance, lldb_addr_t addr, void *buf, size_t size,
                                   SBErrorRef error)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return unwrapped->ReadCStringFromMemory(addr, buf, size, *reinterpret_cast<SBError *>(error));
}

unsigned long long
SBProcessReadUnsignedFromMemory(SBProcessRef instance, lldb_addr_t addr, uint32_t byte_size,
                                    SBErrorRef error)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return unwrapped->ReadUnsignedFromMemory(addr, byte_size, *reinterpret_cast<SBError *>(error));
}

unsigned long long
SBProcessReadPointerFromMemory(SBProcessRef instance, lldb_addr_t addr, SBErrorRef error)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return unwrapped->ReadPointerFromMemory(addr, *reinterpret_cast<SBError *>(error));
}

lldb::StateType
SBProcessGetStateFromEvent(SBEventRef event)
{
    return lldb::SBProcess::GetStateFromEvent(*reinterpret_cast<SBEvent *>(event));
}

bool
SBProcessGetRestartedFromEvent(SBEventRef event)
{
    return lldb::SBProcess::GetRestartedFromEvent(*reinterpret_cast<SBEvent *>(event));
}

unsigned int
SBProcessGetNumRestartedReasonsFromEvent(SBEventRef event)
{
    return lldb::SBProcess::GetNumRestartedReasonsFromEvent(*reinterpret_cast<SBEvent *>(event));
}

const char *
SBProcessGetRestartedReasonAtIndexFromEvent(SBEventRef event, size_t idx)
{
    return lldb::SBProcess::GetRestartedReasonAtIndexFromEvent(*reinterpret_cast<SBEvent *>(event), idx);
}

SBProcessRef
SBProcessGetProcessFromEvent(SBEventRef event)
{
    return reinterpret_cast<SBProcessRef>(
        new SBProcess(lldb::SBProcess::GetProcessFromEvent(*reinterpret_cast<SBEvent *>(event))));
}

bool
SBProcessGetInterruptedFromEvent(SBEventRef event)
{
    return lldb::SBProcess::GetInterruptedFromEvent(*reinterpret_cast<SBEvent *>(event));
}

SBStructuredDataRef
SBProcessGetStructuredDataFromEvent(SBEventRef event)
{
    return reinterpret_cast<SBStructuredDataRef>(
        new SBStructuredData(lldb::SBProcess::GetStructuredDataFromEvent(*reinterpret_cast<SBEvent *>(event))));
}

bool
SBProcessEventIsProcessEvent(SBEventRef event)
{
    return lldb::SBProcess::EventIsProcessEvent(*reinterpret_cast<SBEvent *>(event));
}

bool
SBProcessEventIsStructuredDataEvent(SBEventRef event)
{
    return lldb::SBProcess::EventIsStructuredDataEvent(*reinterpret_cast<SBEvent *>(event));
}

SBBroadcasterRef
SBProcessGetBroadcaster(SBProcessRef instance)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return reinterpret_cast<SBBroadcasterRef>(new SBBroadcaster(unwrapped->GetBroadcaster()));
}

const char *
SBProcessGetBroadcasterClass()
{
    return lldb::SBProcess::GetBroadcasterClass();
}

bool
SBProcessGetDescription(SBProcessRef instance, SBStreamRef description)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return unwrapped->GetDescription(*reinterpret_cast<SBStream *>(description));
}

unsigned int
SBProcessGetNumSupportedHardwareWatchpoints(SBProcessRef instance, SBErrorRef error)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return unwrapped->GetNumSupportedHardwareWatchpoints(*reinterpret_cast<SBError *>(error));
}

unsigned int
SBProcessLoadImage(SBProcessRef instance, SBFileSpecRef image_spec, SBErrorRef error)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return unwrapped->LoadImage(*reinterpret_cast<SBFileSpec *>(image_spec), *reinterpret_cast<SBError *>(error));
}

SBErrorRef
SBProcessUnloadImage(SBProcessRef instance, uint32_t image_token)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return reinterpret_cast<SBErrorRef>(new SBError(unwrapped->UnloadImage(image_token)));
}

SBErrorRef
SBProcessSendEventData(SBProcessRef instance, const char *data)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return reinterpret_cast<SBErrorRef>(new SBError(unwrapped->SendEventData(data)));
}

unsigned int
SBProcessGetNumExtendedBacktraceTypes(SBProcessRef instance)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return unwrapped->GetNumExtendedBacktraceTypes();
}

const char *
SBProcessGetExtendedBacktraceTypeAtIndex(SBProcessRef instance, uint32_t idx)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return unwrapped->GetExtendedBacktraceTypeAtIndex(idx);
}

SBThreadCollectionRef
SBProcessGetHistoryThreads(SBProcessRef instance, lldb_addr_t addr)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return reinterpret_cast<SBThreadCollectionRef>(new SBThreadCollection(unwrapped->GetHistoryThreads(addr)));
}

bool
SBProcessIsInstrumentationRuntimePresent(SBProcessRef instance, enum lldb::InstrumentationRuntimeType type)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return unwrapped->IsInstrumentationRuntimePresent(type);
}

SBErrorRef
SBProcessSaveCore(SBProcessRef instance, const char *file_name)
{
    SBProcess *unwrapped = reinterpret_cast<SBProcess *>(instance);
    return reinterpret_cast<SBErrorRef>(new SBError(unwrapped->SaveCore(file_name)));
}

#ifdef __cplusplus
}
#endif