File indexing completed on 2026-05-10 08:42:42
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef LLDB_API_SBTARGET_H
0010 #define LLDB_API_SBTARGET_H
0011
0012 #include "lldb/API/SBAddress.h"
0013 #include "lldb/API/SBAttachInfo.h"
0014 #include "lldb/API/SBBreakpoint.h"
0015 #include "lldb/API/SBBroadcaster.h"
0016 #include "lldb/API/SBDefines.h"
0017 #include "lldb/API/SBFileSpec.h"
0018 #include "lldb/API/SBFileSpecList.h"
0019 #include "lldb/API/SBLaunchInfo.h"
0020 #include "lldb/API/SBStatisticsOptions.h"
0021 #include "lldb/API/SBSymbolContextList.h"
0022 #include "lldb/API/SBType.h"
0023 #include "lldb/API/SBValue.h"
0024 #include "lldb/API/SBWatchpoint.h"
0025 #include "lldb/API/SBWatchpointOptions.h"
0026
0027 namespace lldb_private {
0028 namespace python {
0029 class SWIGBridge;
0030 }
0031 }
0032
0033 namespace lldb {
0034
0035 class SBPlatform;
0036
0037 class LLDB_API SBTarget {
0038 public:
0039
0040 enum {
0041 eBroadcastBitBreakpointChanged = (1 << 0),
0042 eBroadcastBitModulesLoaded = (1 << 1),
0043 eBroadcastBitModulesUnloaded = (1 << 2),
0044 eBroadcastBitWatchpointChanged = (1 << 3),
0045 eBroadcastBitSymbolsLoaded = (1 << 4),
0046 eBroadcastBitSymbolsChanged = (1 << 5),
0047 };
0048
0049
0050 SBTarget();
0051
0052 SBTarget(const lldb::SBTarget &rhs);
0053
0054
0055 ~SBTarget();
0056
0057 const lldb::SBTarget &operator=(const lldb::SBTarget &rhs);
0058
0059 explicit operator bool() const;
0060
0061 bool IsValid() const;
0062
0063 static bool EventIsTargetEvent(const lldb::SBEvent &event);
0064
0065 static lldb::SBTarget GetTargetFromEvent(const lldb::SBEvent &event);
0066
0067 static uint32_t GetNumModulesFromEvent(const lldb::SBEvent &event);
0068
0069 static lldb::SBModule GetModuleAtIndexFromEvent(const uint32_t idx,
0070 const lldb::SBEvent &event);
0071
0072 static const char *GetBroadcasterClassName();
0073
0074 lldb::SBProcess GetProcess();
0075
0076
0077
0078
0079
0080 void SetCollectingStats(bool v);
0081
0082
0083
0084
0085
0086
0087 bool GetCollectingStats();
0088
0089
0090
0091
0092
0093 lldb::SBStructuredData GetStatistics();
0094
0095
0096
0097
0098
0099
0100
0101
0102 lldb::SBStructuredData GetStatistics(SBStatisticsOptions options);
0103
0104
0105
0106
0107 void ResetStatistics();
0108
0109
0110
0111
0112
0113
0114
0115
0116 lldb::SBPlatform GetPlatform();
0117
0118
0119
0120
0121
0122
0123
0124
0125 SBEnvironment GetEnvironment();
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139 SBError Install();
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151
0152
0153
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174
0175
0176
0177
0178
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188
0189
0190
0191
0192
0193
0194 lldb::SBProcess Launch(SBListener &listener, char const **argv,
0195 char const **envp, const char *stdin_path,
0196 const char *stdout_path, const char *stderr_path,
0197 const char *working_directory,
0198 uint32_t launch_flags,
0199 bool stop_at_entry, lldb::SBError &error);
0200
0201 SBProcess LoadCore(const char *core_file);
0202 SBProcess LoadCore(const char *core_file, lldb::SBError &error);
0203
0204
0205
0206
0207
0208
0209
0210
0211
0212
0213
0214
0215
0216
0217
0218
0219
0220
0221
0222
0223
0224
0225
0226
0227
0228
0229
0230 SBProcess LaunchSimple(const char **argv, const char **envp,
0231 const char *working_directory);
0232
0233 SBProcess Launch(SBLaunchInfo &launch_info, SBError &error);
0234
0235 SBProcess Attach(SBAttachInfo &attach_info, SBError &error);
0236
0237
0238
0239
0240
0241
0242
0243
0244
0245
0246
0247
0248
0249
0250
0251
0252
0253 lldb::SBProcess AttachToProcessWithID(SBListener &listener, lldb::pid_t pid,
0254 lldb::SBError &error);
0255
0256
0257
0258
0259
0260
0261
0262
0263
0264
0265
0266
0267
0268
0269
0270
0271
0272
0273
0274
0275 lldb::SBProcess AttachToProcessWithName(SBListener &listener,
0276 const char *name, bool wait_for,
0277 lldb::SBError &error);
0278
0279
0280
0281
0282
0283
0284
0285
0286
0287
0288
0289
0290
0291
0292
0293
0294
0295
0296
0297
0298 lldb::SBProcess ConnectRemote(SBListener &listener, const char *url,
0299 const char *plugin_name, SBError &error);
0300
0301 lldb::SBFileSpec GetExecutable();
0302
0303
0304 void AppendImageSearchPath(const char *from, const char *to,
0305 lldb::SBError &error);
0306
0307 bool AddModule(lldb::SBModule &module);
0308
0309 lldb::SBModule AddModule(const char *path, const char *triple,
0310 const char *uuid);
0311
0312 lldb::SBModule AddModule(const char *path, const char *triple,
0313 const char *uuid_cstr, const char *symfile);
0314
0315 lldb::SBModule AddModule(const SBModuleSpec &module_spec);
0316
0317 uint32_t GetNumModules() const;
0318
0319 lldb::SBModule GetModuleAtIndex(uint32_t idx);
0320
0321 bool RemoveModule(lldb::SBModule module);
0322
0323 lldb::SBDebugger GetDebugger() const;
0324
0325 lldb::SBModule FindModule(const lldb::SBFileSpec &file_spec);
0326
0327
0328
0329
0330
0331
0332
0333
0334
0335
0336
0337 lldb::SBSymbolContextList
0338 FindCompileUnits(const lldb::SBFileSpec &sb_file_spec);
0339
0340 lldb::ByteOrder GetByteOrder();
0341
0342 uint32_t GetAddressByteSize();
0343
0344 const char *GetTriple();
0345
0346 const char *GetABIName();
0347
0348 const char *GetLabel() const;
0349
0350 SBError SetLabel(const char *label);
0351
0352
0353
0354
0355
0356
0357 uint32_t GetDataByteSize();
0358
0359
0360
0361
0362
0363
0364 uint32_t GetCodeByteSize();
0365
0366
0367
0368
0369 uint32_t GetMaximumNumberOfChildrenToDisplay() const;
0370
0371
0372
0373
0374
0375
0376
0377
0378
0379
0380
0381
0382
0383 lldb::SBError SetSectionLoadAddress(lldb::SBSection section,
0384 lldb::addr_t section_base_addr);
0385
0386
0387
0388
0389
0390
0391
0392
0393
0394
0395 lldb::SBError ClearSectionLoadAddress(lldb::SBSection section);
0396
0397 #ifndef SWIG
0398
0399
0400
0401
0402
0403
0404
0405
0406
0407
0408
0409
0410
0411
0412
0413
0414
0415
0416 LLDB_DEPRECATED_FIXME("Use SetModuleLoadAddress(lldb::SBModule, uint64_t)",
0417 "SetModuleLoadAddress(lldb::SBModule, uint64_t)")
0418 lldb::SBError SetModuleLoadAddress(lldb::SBModule module,
0419 int64_t sections_offset);
0420 #endif
0421
0422
0423
0424
0425
0426
0427
0428
0429
0430
0431
0432
0433
0434
0435
0436
0437
0438
0439
0440 lldb::SBError SetModuleLoadAddress(lldb::SBModule module,
0441 uint64_t sections_offset);
0442
0443
0444
0445
0446
0447
0448
0449
0450
0451 lldb::SBError ClearModuleLoadAddress(lldb::SBModule module);
0452
0453
0454
0455
0456
0457
0458
0459
0460
0461
0462
0463
0464
0465
0466
0467
0468 lldb::SBSymbolContextList
0469 FindFunctions(const char *name,
0470 uint32_t name_type_mask = lldb::eFunctionNameTypeAny);
0471
0472
0473
0474
0475
0476
0477
0478
0479
0480
0481
0482
0483 lldb::SBValueList FindGlobalVariables(const char *name, uint32_t max_matches);
0484
0485
0486
0487
0488
0489
0490
0491
0492
0493 lldb::SBValue FindFirstGlobalVariable(const char *name);
0494
0495
0496
0497
0498
0499
0500
0501
0502
0503
0504
0505
0506
0507
0508 lldb::SBValueList FindGlobalVariables(const char *name, uint32_t max_matches,
0509 MatchType matchtype);
0510
0511
0512
0513
0514
0515
0516
0517
0518
0519
0520
0521
0522
0523
0524 lldb::SBSymbolContextList FindGlobalFunctions(const char *name,
0525 uint32_t max_matches,
0526 MatchType matchtype);
0527
0528 void Clear();
0529
0530
0531
0532
0533
0534
0535
0536
0537 lldb::SBAddress ResolveFileAddress(lldb::addr_t file_addr);
0538
0539
0540
0541
0542
0543
0544
0545
0546
0547
0548
0549
0550 lldb::SBAddress ResolveLoadAddress(lldb::addr_t vm_addr);
0551
0552
0553
0554
0555
0556
0557
0558
0559
0560
0561
0562
0563
0564
0565
0566
0567
0568
0569
0570
0571
0572 lldb::SBAddress ResolvePastLoadAddress(uint32_t stop_id,
0573 lldb::addr_t vm_addr);
0574
0575 SBSymbolContext ResolveSymbolContextForAddress(const SBAddress &addr,
0576 uint32_t resolve_scope);
0577
0578
0579
0580
0581
0582
0583
0584
0585
0586
0587
0588
0589
0590
0591
0592
0593
0594
0595
0596
0597
0598 size_t ReadMemory(const SBAddress addr, void *buf, size_t size,
0599 lldb::SBError &error);
0600
0601 lldb::SBBreakpoint BreakpointCreateByLocation(const char *file,
0602 uint32_t line);
0603
0604 lldb::SBBreakpoint
0605 BreakpointCreateByLocation(const lldb::SBFileSpec &file_spec, uint32_t line);
0606
0607 lldb::SBBreakpoint
0608 BreakpointCreateByLocation(const lldb::SBFileSpec &file_spec, uint32_t line,
0609 lldb::addr_t offset);
0610
0611 lldb::SBBreakpoint
0612 BreakpointCreateByLocation(const lldb::SBFileSpec &file_spec, uint32_t line,
0613 lldb::addr_t offset, SBFileSpecList &module_list);
0614
0615 lldb::SBBreakpoint
0616 BreakpointCreateByLocation(const lldb::SBFileSpec &file_spec, uint32_t line,
0617 uint32_t column, lldb::addr_t offset,
0618 SBFileSpecList &module_list);
0619
0620 lldb::SBBreakpoint
0621 BreakpointCreateByLocation(const lldb::SBFileSpec &file_spec, uint32_t line,
0622 uint32_t column, lldb::addr_t offset,
0623 SBFileSpecList &module_list,
0624 bool move_to_nearest_code);
0625
0626 lldb::SBBreakpoint BreakpointCreateByName(const char *symbol_name,
0627 const char *module_name = nullptr);
0628
0629
0630 lldb::SBBreakpoint
0631 BreakpointCreateByName(const char *symbol_name,
0632 const SBFileSpecList &module_list,
0633 const SBFileSpecList &comp_unit_list);
0634
0635 lldb::SBBreakpoint BreakpointCreateByName(
0636 const char *symbol_name,
0637 uint32_t
0638 name_type_mask,
0639 const SBFileSpecList &module_list,
0640 const SBFileSpecList &comp_unit_list);
0641
0642 lldb::SBBreakpoint BreakpointCreateByName(
0643 const char *symbol_name,
0644 uint32_t
0645 name_type_mask,
0646 lldb::LanguageType symbol_language,
0647 const SBFileSpecList &module_list, const SBFileSpecList &comp_unit_list);
0648
0649 #ifdef SWIG
0650 lldb::SBBreakpoint BreakpointCreateByNames(
0651 const char **symbol_name, uint32_t num_names,
0652 uint32_t
0653 name_type_mask,
0654 const SBFileSpecList &module_list,
0655 const SBFileSpecList &comp_unit_list);
0656
0657 lldb::SBBreakpoint BreakpointCreateByNames(
0658 const char **symbol_name, uint32_t num_names,
0659 uint32_t
0660 name_type_mask,
0661 lldb::LanguageType symbol_language,
0662 const SBFileSpecList &module_list, const SBFileSpecList &comp_unit_list);
0663
0664 lldb::SBBreakpoint BreakpointCreateByNames(
0665 const char **symbol_name, uint32_t num_names,
0666 uint32_t
0667 name_type_mask,
0668 lldb::LanguageType symbol_language,
0669 lldb::addr_t offset, const SBFileSpecList &module_list,
0670 const SBFileSpecList &comp_unit_list);
0671 #else
0672 lldb::SBBreakpoint BreakpointCreateByNames(
0673 const char *symbol_name[], uint32_t num_names,
0674 uint32_t
0675 name_type_mask,
0676 const SBFileSpecList &module_list,
0677 const SBFileSpecList &comp_unit_list);
0678
0679 lldb::SBBreakpoint BreakpointCreateByNames(
0680 const char *symbol_name[], uint32_t num_names,
0681 uint32_t
0682 name_type_mask,
0683 lldb::LanguageType symbol_language,
0684 const SBFileSpecList &module_list, const SBFileSpecList &comp_unit_list);
0685
0686 lldb::SBBreakpoint BreakpointCreateByNames(
0687 const char *symbol_name[], uint32_t num_names,
0688 uint32_t
0689 name_type_mask,
0690 lldb::LanguageType symbol_language,
0691 lldb::addr_t offset, const SBFileSpecList &module_list,
0692 const SBFileSpecList &comp_unit_list);
0693 #endif
0694
0695 lldb::SBBreakpoint BreakpointCreateByRegex(const char *symbol_name_regex,
0696 const char *module_name = nullptr);
0697
0698 lldb::SBBreakpoint
0699 BreakpointCreateByRegex(const char *symbol_name_regex,
0700 const SBFileSpecList &module_list,
0701 const SBFileSpecList &comp_unit_list);
0702
0703 lldb::SBBreakpoint BreakpointCreateByRegex(
0704 const char *symbol_name_regex, lldb::LanguageType symbol_language,
0705 const SBFileSpecList &module_list, const SBFileSpecList &comp_unit_list);
0706
0707 lldb::SBBreakpoint
0708 BreakpointCreateBySourceRegex(const char *source_regex,
0709 const SBFileSpec &source_file,
0710 const char *module_name = nullptr);
0711
0712 lldb::SBBreakpoint
0713 BreakpointCreateBySourceRegex(const char *source_regex,
0714 const SBFileSpecList &module_list,
0715 const SBFileSpecList &source_file);
0716
0717 lldb::SBBreakpoint BreakpointCreateBySourceRegex(
0718 const char *source_regex, const SBFileSpecList &module_list,
0719 const SBFileSpecList &source_file, const SBStringList &func_names);
0720
0721 lldb::SBBreakpoint BreakpointCreateForException(lldb::LanguageType language,
0722 bool catch_bp, bool throw_bp);
0723
0724 lldb::SBBreakpoint BreakpointCreateByAddress(addr_t address);
0725
0726 lldb::SBBreakpoint BreakpointCreateBySBAddress(SBAddress &address);
0727
0728
0729
0730
0731
0732
0733
0734
0735
0736
0737
0738
0739
0740
0741
0742
0743
0744
0745
0746
0747
0748
0749
0750 lldb::SBBreakpoint BreakpointCreateFromScript(
0751 const char *class_name,
0752 SBStructuredData &extra_args,
0753 const SBFileSpecList &module_list,
0754 const SBFileSpecList &file_list,
0755 bool request_hardware = false);
0756
0757
0758
0759
0760
0761
0762
0763
0764
0765
0766
0767
0768 lldb::SBError BreakpointsCreateFromFile(SBFileSpec &source_file,
0769 SBBreakpointList &new_bps);
0770
0771
0772
0773
0774
0775
0776
0777
0778
0779
0780
0781
0782
0783
0784
0785
0786 lldb::SBError BreakpointsCreateFromFile(SBFileSpec &source_file,
0787 SBStringList &matching_names,
0788 SBBreakpointList &new_bps);
0789
0790
0791
0792
0793
0794
0795
0796
0797 lldb::SBError BreakpointsWriteToFile(SBFileSpec &dest_file);
0798
0799
0800
0801
0802
0803
0804
0805
0806
0807
0808
0809
0810
0811
0812
0813
0814 lldb::SBError BreakpointsWriteToFile(SBFileSpec &dest_file,
0815 SBBreakpointList &bkpt_list,
0816 bool append = false);
0817
0818 uint32_t GetNumBreakpoints() const;
0819
0820 lldb::SBBreakpoint GetBreakpointAtIndex(uint32_t idx) const;
0821
0822 bool BreakpointDelete(break_id_t break_id);
0823
0824 lldb::SBBreakpoint FindBreakpointByID(break_id_t break_id);
0825
0826
0827
0828 bool FindBreakpointsByName(const char *name, SBBreakpointList &bkpt_list);
0829
0830 void GetBreakpointNames(SBStringList &names);
0831
0832 void DeleteBreakpointName(const char *name);
0833
0834 bool EnableAllBreakpoints();
0835
0836 bool DisableAllBreakpoints();
0837
0838 bool DeleteAllBreakpoints();
0839
0840 uint32_t GetNumWatchpoints() const;
0841
0842 lldb::SBWatchpoint GetWatchpointAtIndex(uint32_t idx) const;
0843
0844 bool DeleteWatchpoint(lldb::watch_id_t watch_id);
0845
0846 lldb::SBWatchpoint FindWatchpointByID(lldb::watch_id_t watch_id);
0847
0848 LLDB_DEPRECATED("WatchAddress deprecated, use WatchpointCreateByAddress")
0849 lldb::SBWatchpoint WatchAddress(lldb::addr_t addr, size_t size, bool read,
0850 bool modify, SBError &error);
0851
0852 lldb::SBWatchpoint
0853 WatchpointCreateByAddress(lldb::addr_t addr, size_t size,
0854 lldb::SBWatchpointOptions options, SBError &error);
0855
0856 bool EnableAllWatchpoints();
0857
0858 bool DisableAllWatchpoints();
0859
0860 bool DeleteAllWatchpoints();
0861
0862 lldb::SBBroadcaster GetBroadcaster() const;
0863
0864 lldb::SBType FindFirstType(const char *type);
0865
0866 lldb::SBTypeList FindTypes(const char *type);
0867
0868 lldb::SBType GetBasicType(lldb::BasicType type);
0869
0870 lldb::SBValue CreateValueFromAddress(const char *name, lldb::SBAddress addr,
0871 lldb::SBType type);
0872
0873 lldb::SBValue CreateValueFromData(const char *name, lldb::SBData data,
0874 lldb::SBType type);
0875
0876 lldb::SBValue CreateValueFromExpression(const char *name, const char *expr);
0877
0878 SBSourceManager GetSourceManager();
0879
0880 lldb::SBInstructionList ReadInstructions(lldb::SBAddress base_addr,
0881 uint32_t count);
0882
0883 lldb::SBInstructionList ReadInstructions(lldb::SBAddress base_addr,
0884 uint32_t count,
0885 const char *flavor_string);
0886
0887 lldb::SBInstructionList ReadInstructions(lldb::SBAddress start_addr,
0888 lldb::SBAddress end_addr,
0889 const char *flavor_string);
0890
0891 lldb::SBInstructionList GetInstructions(lldb::SBAddress base_addr,
0892 const void *buf, size_t size);
0893
0894
0895
0896
0897 lldb::SBInstructionList GetInstructionsWithFlavor(lldb::SBAddress base_addr,
0898 const char *flavor_string,
0899 const void *buf,
0900 size_t size);
0901
0902 #ifndef SWIG
0903 lldb::SBInstructionList GetInstructions(lldb::addr_t base_addr,
0904 const void *buf, size_t size);
0905 lldb::SBInstructionList GetInstructionsWithFlavor(lldb::addr_t base_addr,
0906 const char *flavor_string,
0907 const void *buf,
0908 size_t size);
0909 #endif
0910
0911 lldb::SBSymbolContextList FindSymbols(const char *name,
0912 lldb::SymbolType type = eSymbolTypeAny);
0913
0914 bool operator==(const lldb::SBTarget &rhs) const;
0915
0916 bool operator!=(const lldb::SBTarget &rhs) const;
0917
0918 bool GetDescription(lldb::SBStream &description,
0919 lldb::DescriptionLevel description_level);
0920
0921 lldb::SBValue EvaluateExpression(const char *expr);
0922
0923 lldb::SBValue EvaluateExpression(const char *expr,
0924 const SBExpressionOptions &options);
0925
0926 lldb::addr_t GetStackRedZoneSize();
0927
0928 bool IsLoaded(const lldb::SBModule &module) const;
0929
0930 lldb::SBLaunchInfo GetLaunchInfo() const;
0931
0932 void SetLaunchInfo(const lldb::SBLaunchInfo &launch_info);
0933
0934
0935
0936
0937
0938
0939
0940 lldb::SBTrace GetTrace();
0941
0942
0943
0944
0945
0946
0947 lldb::SBTrace CreateTrace(SBError &error);
0948
0949 protected:
0950 friend class SBAddress;
0951 friend class SBAddressRange;
0952 friend class SBBlock;
0953 friend class SBBreakpoint;
0954 friend class SBBreakpointList;
0955 friend class SBBreakpointNameImpl;
0956 friend class SBDebugger;
0957 friend class SBExecutionContext;
0958 friend class SBFrame;
0959 friend class SBFunction;
0960 friend class SBInstruction;
0961 friend class SBModule;
0962 friend class SBPlatform;
0963 friend class SBProcess;
0964 friend class SBSection;
0965 friend class SBSourceManager;
0966 friend class SBSymbol;
0967 friend class SBTypeStaticField;
0968 friend class SBValue;
0969 friend class SBVariablesOptions;
0970
0971 friend class lldb_private::python::SWIGBridge;
0972
0973
0974
0975
0976 SBTarget(const lldb::TargetSP &target_sp);
0977
0978 lldb::TargetSP GetSP() const;
0979
0980 void SetSP(const lldb::TargetSP &target_sp);
0981
0982 private:
0983 lldb::TargetSP m_opaque_sp;
0984 };
0985
0986 }
0987
0988 #endif