blob: 1f697bad587b693f3a1be99c93dc5a07bb07a41d [file] [log] [blame]
Johnny Chendc7d3c12011-07-16 21:15:39 +00001//===-- SWIG Interface for SBTarget -----------------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10namespace lldb {
11
Greg Clayton0e615682012-02-24 05:03:03 +000012class SBLaunchInfo
13{
Greg Clayton38d1f052012-02-24 20:59:25 +000014public:
15 SBLaunchInfo (const char **argv);
Greg Clayton0e615682012-02-24 05:03:03 +000016
17 uint32_t
18 GetUserID();
19
20 uint32_t
21 GetGroupID();
22
23 bool
24 UserIDIsValid ();
25
26 bool
27 GroupIDIsValid ();
28
29 void
30 SetUserID (uint32_t uid);
31
32 void
33 SetGroupID (uint32_t gid);
34
Greg Clayton3e32ad62014-05-07 20:16:06 +000035 lldb::SBFileSpec
36 GetExecutableFile ();
37
38 void
39 SetExecutableFile (lldb::SBFileSpec exe_file, bool add_as_first_arg);
40
Greg Clayton0e615682012-02-24 05:03:03 +000041 uint32_t
42 GetNumArguments ();
43
44 const char *
45 GetArgumentAtIndex (uint32_t idx);
46
47 void
48 SetArguments (const char **argv, bool append);
49
50 uint32_t
51 GetNumEnvironmentEntries ();
52
53 const char *
54 GetEnvironmentEntryAtIndex (uint32_t idx);
55
56 void
57 SetEnvironmentEntries (const char **envp, bool append);
58
59 void
60 Clear ();
61
62 const char *
63 GetWorkingDirectory () const;
64
65 void
66 SetWorkingDirectory (const char *working_dir);
67
68 uint32_t
69 GetLaunchFlags ();
70
71 void
72 SetLaunchFlags (uint32_t flags);
73
74 const char *
75 GetProcessPluginName ();
76
77 void
78 SetProcessPluginName (const char *plugin_name);
79
80 const char *
81 GetShell ();
82
83 void
84 SetShell (const char * path);
85
86 uint32_t
87 GetResumeCount ();
88
89 void
90 SetResumeCount (uint32_t c);
91
92 bool
93 AddCloseFileAction (int fd);
94
95 bool
96 AddDuplicateFileAction (int fd, int dup_fd);
97
98 bool
99 AddOpenFileAction (int fd, const char *path, bool read, bool write);
100
101 bool
102 AddSuppressFileAction (int fd, bool read, bool write);
Jason Molendaa3329782014-03-29 18:54:20 +0000103
104 void
105 SetLaunchEventData (const char *data);
106
107 const char *
108 GetLaunchEventData () const;
109
Greg Clayton0e615682012-02-24 05:03:03 +0000110};
111
112class SBAttachInfo
113{
114public:
115 SBAttachInfo ();
116
117 SBAttachInfo (lldb::pid_t pid);
118
119 SBAttachInfo (const char *path, bool wait_for);
120
121 SBAttachInfo (const lldb::SBAttachInfo &rhs);
122
123 lldb::pid_t
124 GetProcessID ();
125
126 void
127 SetProcessID (lldb::pid_t pid);
128
129 void
130 SetExecutable (const char *path);
131
132 void
133 SetExecutable (lldb::SBFileSpec exe_file);
134
135 bool
136 GetWaitForLaunch ();
137
138 void
139 SetWaitForLaunch (bool b);
140
Jim Inghamcd16df92012-07-20 21:37:13 +0000141 bool
142 GetIgnoreExisting ();
143
144 void
145 SetIgnoreExisting (bool b);
146
Greg Clayton0e615682012-02-24 05:03:03 +0000147 uint32_t
148 GetResumeCount ();
149
150 void
151 SetResumeCount (uint32_t c);
152
153 const char *
154 GetProcessPluginName ();
155
156 void
157 SetProcessPluginName (const char *plugin_name);
158
159 uint32_t
Greg Clayton41bd8ac2012-02-24 23:56:06 +0000160 GetUserID();
161
162 uint32_t
163 GetGroupID();
164
165 bool
166 UserIDIsValid ();
167
168 bool
169 GroupIDIsValid ();
170
171 void
172 SetUserID (uint32_t uid);
173
174 void
175 SetGroupID (uint32_t gid);
176
177 uint32_t
Greg Clayton0e615682012-02-24 05:03:03 +0000178 GetEffectiveUserID();
179
180 uint32_t
181 GetEffectiveGroupID();
182
183 bool
184 EffectiveUserIDIsValid ();
185
186 bool
187 EffectiveGroupIDIsValid ();
188
189 void
190 SetEffectiveUserID (uint32_t uid);
191
192 void
193 SetEffectiveGroupID (uint32_t gid);
194
195 lldb::pid_t
196 GetParentProcessID ();
197
198 void
199 SetParentProcessID (lldb::pid_t pid);
200
201 bool
202 ParentProcessIDIsValid();
203};
204
205
Johnny Chendc7d3c12011-07-16 21:15:39 +0000206%feature("docstring",
207"Represents the target program running under the debugger.
208
Johnny Chen01a67862011-10-14 00:42:25 +0000209SBTarget supports module, breakpoint, and watchpoint iterations. For example,
Johnny Chendc7d3c12011-07-16 21:15:39 +0000210
211 for m in target.module_iter():
212 print m
213
214produces:
215
216(x86_64) /Volumes/data/lldb/svn/trunk/test/python_api/lldbutil/iter/a.out
217(x86_64) /usr/lib/dyld
218(x86_64) /usr/lib/libstdc++.6.dylib
219(x86_64) /usr/lib/libSystem.B.dylib
220(x86_64) /usr/lib/system/libmathCommon.A.dylib
221(x86_64) /usr/lib/libSystem.B.dylib(__commpage)
222
223and,
224
225 for b in target.breakpoint_iter():
226 print b
227
228produces:
229
230SBBreakpoint: id = 1, file ='main.cpp', line = 66, locations = 1
Johnny Chend4dd7992011-09-27 01:19:20 +0000231SBBreakpoint: id = 2, file ='main.cpp', line = 85, locations = 1
232
233and,
234
Johnny Chen01a67862011-10-14 00:42:25 +0000235 for wp_loc in target.watchpoint_iter():
Johnny Chend4dd7992011-09-27 01:19:20 +0000236 print wp_loc
237
238produces:
239
Johnny Chen01a67862011-10-14 00:42:25 +0000240Watchpoint 1: addr = 0x1034ca048 size = 4 state = enabled type = rw
Johnny Chend4dd7992011-09-27 01:19:20 +0000241 declare @ '/Volumes/data/lldb/svn/trunk/test/python_api/watchpoint/main.c:12'
Johnny Chen01a67862011-10-14 00:42:25 +0000242 hw_index = 0 hit_count = 2 ignore_count = 0"
Johnny Chen357033b2011-07-18 20:13:38 +0000243) SBTarget;
Johnny Chendc7d3c12011-07-16 21:15:39 +0000244class SBTarget
245{
Johnny Chendc7d3c12011-07-16 21:15:39 +0000246public:
247 //------------------------------------------------------------------
248 // Broadcaster bits.
249 //------------------------------------------------------------------
250 enum
251 {
252 eBroadcastBitBreakpointChanged = (1 << 0),
253 eBroadcastBitModulesLoaded = (1 << 1),
Jim Ingham1b5792e2012-12-18 02:03:49 +0000254 eBroadcastBitModulesUnloaded = (1 << 2),
Enrico Granataf15ee4e2013-04-05 18:49:06 +0000255 eBroadcastBitWatchpointChanged = (1 << 3),
256 eBroadcastBitSymbolsLoaded = (1 << 4)
Johnny Chendc7d3c12011-07-16 21:15:39 +0000257 };
258
259 //------------------------------------------------------------------
260 // Constructors
261 //------------------------------------------------------------------
262 SBTarget ();
263
264 SBTarget (const lldb::SBTarget& rhs);
265
Johnny Chendc7d3c12011-07-16 21:15:39 +0000266 //------------------------------------------------------------------
267 // Destructor
268 //------------------------------------------------------------------
269 ~SBTarget();
270
Jim Ingham4bddaeb2012-02-16 06:50:00 +0000271 static const char *
272 GetBroadcasterClassName ();
273
Johnny Chendc7d3c12011-07-16 21:15:39 +0000274 bool
275 IsValid() const;
276
277 lldb::SBProcess
278 GetProcess ();
279
280 %feature("docstring", "
281 //------------------------------------------------------------------
Greg Claytonfbb76342013-11-20 21:07:01 +0000282 /// Install any binaries that need to be installed.
283 ///
284 /// This function does nothing when debugging on the host system.
285 /// When connected to remote platforms, the target's main executable
286 /// and any modules that have their install path set will be
287 /// installed on the remote platform. If the main executable doesn't
288 /// have an install location set, it will be installed in the remote
289 /// platform's working directory.
290 ///
291 /// @return
292 /// An error describing anything that went wrong during
293 /// installation.
294 //------------------------------------------------------------------
295 ") Install;
296 lldb::SBError
297 Install();
298
299 %feature("docstring", "
300 //------------------------------------------------------------------
Johnny Chendc7d3c12011-07-16 21:15:39 +0000301 /// Launch a new process.
302 ///
303 /// Launch a new process by spawning a new process using the
304 /// target object's executable module's file as the file to launch.
305 /// Arguments are given in \a argv, and the environment variables
306 /// are in \a envp. Standard input and output files can be
307 /// optionally re-directed to \a stdin_path, \a stdout_path, and
308 /// \a stderr_path.
309 ///
310 /// @param[in] listener
311 /// An optional listener that will receive all process events.
312 /// If \a listener is valid then \a listener will listen to all
313 /// process events. If not valid, then this target's debugger
314 /// (SBTarget::GetDebugger()) will listen to all process events.
315 ///
316 /// @param[in] argv
317 /// The argument array.
318 ///
319 /// @param[in] envp
320 /// The environment array.
321 ///
322 /// @param[in] launch_flags
323 /// Flags to modify the launch (@see lldb::LaunchFlags)
324 ///
325 /// @param[in] stdin_path
326 /// The path to use when re-directing the STDIN of the new
327 /// process. If all stdXX_path arguments are NULL, a pseudo
328 /// terminal will be used.
329 ///
330 /// @param[in] stdout_path
331 /// The path to use when re-directing the STDOUT of the new
332 /// process. If all stdXX_path arguments are NULL, a pseudo
333 /// terminal will be used.
334 ///
335 /// @param[in] stderr_path
336 /// The path to use when re-directing the STDERR of the new
337 /// process. If all stdXX_path arguments are NULL, a pseudo
338 /// terminal will be used.
339 ///
340 /// @param[in] working_directory
341 /// The working directory to have the child process run in
342 ///
343 /// @param[in] launch_flags
344 /// Some launch options specified by logical OR'ing
345 /// lldb::LaunchFlags enumeration values together.
346 ///
347 /// @param[in] stop_at_endtry
348 /// If false do not stop the inferior at the entry point.
349 ///
350 /// @param[out]
351 /// An error object. Contains the reason if there is some failure.
352 ///
353 /// @return
354 /// A process object for the newly created process.
355 //------------------------------------------------------------------
356
357 For example,
358
359 process = target.Launch(self.dbg.GetListener(), None, None,
360 None, '/tmp/stdout.txt', None,
361 None, 0, False, error)
362
363 launches a new process by passing nothing for both the args and the envs
364 and redirect the standard output of the inferior to the /tmp/stdout.txt
365 file. It does not specify a working directory so that the debug server
366 will use its idea of what the current working directory is for the
367 inferior. Also, we ask the debugger not to stop the inferior at the
368 entry point. If no breakpoint is specified for the inferior, it should
369 run to completion if no user interaction is required.
370 ") Launch;
371 lldb::SBProcess
372 Launch (SBListener &listener,
373 char const **argv,
374 char const **envp,
375 const char *stdin_path,
376 const char *stdout_path,
377 const char *stderr_path,
378 const char *working_directory,
379 uint32_t launch_flags, // See LaunchFlags
380 bool stop_at_entry,
381 lldb::SBError& error);
382
383 %feature("docstring", "
384 //------------------------------------------------------------------
385 /// Launch a new process with sensible defaults.
386 ///
387 /// @param[in] argv
388 /// The argument array.
389 ///
390 /// @param[in] envp
391 /// The environment array.
392 ///
393 /// @param[in] working_directory
394 /// The working directory to have the child process run in
395 ///
396 /// Default: listener
397 /// Set to the target's debugger (SBTarget::GetDebugger())
398 ///
399 /// Default: launch_flags
400 /// Empty launch flags
401 ///
402 /// Default: stdin_path
403 /// Default: stdout_path
404 /// Default: stderr_path
405 /// A pseudo terminal will be used.
406 ///
407 /// @return
408 /// A process object for the newly created process.
409 //------------------------------------------------------------------
410
411 For example,
412
413 process = target.LaunchSimple(['X', 'Y', 'Z'], None, os.getcwd())
414
415 launches a new process by passing 'X', 'Y', 'Z' as the args to the
416 executable.
417 ") LaunchSimple;
418 lldb::SBProcess
419 LaunchSimple (const char **argv,
420 const char **envp,
421 const char *working_directory);
422
Greg Clayton0e615682012-02-24 05:03:03 +0000423 lldb::SBProcess
424 Launch (lldb::SBLaunchInfo &launch_info, lldb::SBError& error);
Greg Clayton4d8ad552013-03-25 22:40:51 +0000425
426 %feature("docstring", "
427 //------------------------------------------------------------------
428 /// Load a core file
429 ///
430 /// @param[in] core_file
431 /// File path of the core dump.
432 ///
433 /// @return
434 /// A process object for the newly created core file.
435 //------------------------------------------------------------------
436
437 For example,
438
439 process = target.LoadCore('./a.out.core')
440
441 loads a new core file and returns the process object.
442 ") LoadCore;
443 lldb::SBProcess
444 LoadCore(const char *core_file);
Greg Clayton0e615682012-02-24 05:03:03 +0000445
446 lldb::SBProcess
447 Attach (lldb::SBAttachInfo &attach_info, lldb::SBError& error);
448
449
Johnny Chendc7d3c12011-07-16 21:15:39 +0000450 %feature("docstring", "
451 //------------------------------------------------------------------
452 /// Attach to process with pid.
453 ///
454 /// @param[in] listener
455 /// An optional listener that will receive all process events.
456 /// If \a listener is valid then \a listener will listen to all
457 /// process events. If not valid, then this target's debugger
458 /// (SBTarget::GetDebugger()) will listen to all process events.
459 ///
460 /// @param[in] pid
461 /// The process ID to attach to.
462 ///
463 /// @param[out]
464 /// An error explaining what went wrong if attach fails.
465 ///
466 /// @return
467 /// A process object for the attached process.
468 //------------------------------------------------------------------
469 ") AttachToProcessWithID;
470 lldb::SBProcess
471 AttachToProcessWithID (SBListener &listener,
472 lldb::pid_t pid,
473 lldb::SBError& error);
474
475 %feature("docstring", "
476 //------------------------------------------------------------------
477 /// Attach to process with name.
478 ///
479 /// @param[in] listener
480 /// An optional listener that will receive all process events.
481 /// If \a listener is valid then \a listener will listen to all
482 /// process events. If not valid, then this target's debugger
483 /// (SBTarget::GetDebugger()) will listen to all process events.
484 ///
485 /// @param[in] name
486 /// Basename of process to attach to.
487 ///
488 /// @param[in] wait_for
489 /// If true wait for a new instance of 'name' to be launched.
490 ///
491 /// @param[out]
492 /// An error explaining what went wrong if attach fails.
493 ///
494 /// @return
495 /// A process object for the attached process.
496 //------------------------------------------------------------------
497 ") AttachToProcessWithName;
498 lldb::SBProcess
499 AttachToProcessWithName (SBListener &listener,
500 const char *name,
501 bool wait_for,
502 lldb::SBError& error);
503
504 %feature("docstring", "
505 //------------------------------------------------------------------
506 /// Connect to a remote debug server with url.
507 ///
508 /// @param[in] listener
509 /// An optional listener that will receive all process events.
510 /// If \a listener is valid then \a listener will listen to all
511 /// process events. If not valid, then this target's debugger
512 /// (SBTarget::GetDebugger()) will listen to all process events.
513 ///
514 /// @param[in] url
515 /// The url to connect to, e.g., 'connect://localhost:12345'.
516 ///
517 /// @param[in] plugin_name
518 /// The plugin name to be used; can be NULL.
519 ///
520 /// @param[out]
521 /// An error explaining what went wrong if the connect fails.
522 ///
523 /// @return
524 /// A process object for the connected process.
525 //------------------------------------------------------------------
526 ") ConnectRemote;
527 lldb::SBProcess
528 ConnectRemote (SBListener &listener,
529 const char *url,
530 const char *plugin_name,
531 SBError& error);
532
533 lldb::SBFileSpec
534 GetExecutable ();
535
Greg Claytoncac9c5f2011-09-24 00:52:29 +0000536 bool
537 AddModule (lldb::SBModule &module);
538
539 lldb::SBModule
540 AddModule (const char *path,
541 const char *triple,
542 const char *uuid);
543
Greg Claytonb210aec2012-04-23 20:23:39 +0000544 lldb::SBModule
545 AddModule (const char *path,
546 const char *triple,
547 const char *uuid_cstr,
548 const char *symfile);
549
Greg Clayton226cce22013-07-08 22:22:41 +0000550 lldb::SBModule
551 AddModule (const SBModuleSpec &module_spec);
552
Johnny Chendc7d3c12011-07-16 21:15:39 +0000553 uint32_t
554 GetNumModules () const;
555
556 lldb::SBModule
557 GetModuleAtIndex (uint32_t idx);
558
Greg Claytoncac9c5f2011-09-24 00:52:29 +0000559 bool
560 RemoveModule (lldb::SBModule module);
561
Johnny Chendc7d3c12011-07-16 21:15:39 +0000562 lldb::SBDebugger
563 GetDebugger() const;
564
565 lldb::SBModule
566 FindModule (const lldb::SBFileSpec &file_spec);
567
Greg Clayton13d19502012-01-29 06:07:39 +0000568 lldb::ByteOrder
569 GetByteOrder ();
570
571 uint32_t
572 GetAddressByteSize();
573
574 const char *
575 GetTriple ();
576
Greg Claytoncac9c5f2011-09-24 00:52:29 +0000577 lldb::SBError
578 SetSectionLoadAddress (lldb::SBSection section,
579 lldb::addr_t section_base_addr);
580
581 lldb::SBError
582 ClearSectionLoadAddress (lldb::SBSection section);
583
584 lldb::SBError
585 SetModuleLoadAddress (lldb::SBModule module,
586 int64_t sections_offset);
587
588 lldb::SBError
589 ClearModuleLoadAddress (lldb::SBModule module);
590
Johnny Chendc7d3c12011-07-16 21:15:39 +0000591 %feature("docstring", "
592 //------------------------------------------------------------------
593 /// Find functions by name.
594 ///
595 /// @param[in] name
596 /// The name of the function we are looking for.
597 ///
598 /// @param[in] name_type_mask
599 /// A logical OR of one or more FunctionNameType enum bits that
600 /// indicate what kind of names should be used when doing the
601 /// lookup. Bits include fully qualified names, base names,
602 /// C++ methods, or ObjC selectors.
603 /// See FunctionNameType for more details.
604 ///
Johnny Chendc7d3c12011-07-16 21:15:39 +0000605 /// @return
Greg Clayton5569e642012-02-06 01:44:54 +0000606 /// A lldb::SBSymbolContextList that gets filled in with all of
607 /// the symbol contexts for all the matches.
Johnny Chendc7d3c12011-07-16 21:15:39 +0000608 //------------------------------------------------------------------
609 ") FindFunctions;
Greg Clayton5569e642012-02-06 01:44:54 +0000610 lldb::SBSymbolContextList
Johnny Chendc7d3c12011-07-16 21:15:39 +0000611 FindFunctions (const char *name,
Greg Clayton5569e642012-02-06 01:44:54 +0000612 uint32_t name_type_mask = lldb::eFunctionNameTypeAny);
Enrico Granata6f3533f2011-07-29 19:53:35 +0000613
614 lldb::SBType
615 FindFirstType (const char* type);
616
617 lldb::SBTypeList
618 FindTypes (const char* type);
Johnny Chendc7d3c12011-07-16 21:15:39 +0000619
Greg Claytonb43165b2012-12-05 21:24:42 +0000620 lldb::SBType
621 GetBasicType(lldb::BasicType type);
622
Jim Inghame37d6052011-09-13 00:29:56 +0000623 lldb::SBSourceManager
624 GetSourceManager ();
625
Johnny Chendc7d3c12011-07-16 21:15:39 +0000626 %feature("docstring", "
627 //------------------------------------------------------------------
628 /// Find global and static variables by name.
629 ///
630 /// @param[in] name
631 /// The name of the global or static variable we are looking
632 /// for.
633 ///
634 /// @param[in] max_matches
635 /// Allow the number of matches to be limited to \a max_matches.
636 ///
637 /// @return
638 /// A list of matched variables in an SBValueList.
639 //------------------------------------------------------------------
640 ") FindGlobalVariables;
641 lldb::SBValueList
642 FindGlobalVariables (const char *name,
643 uint32_t max_matches);
644
Enrico Granatabcd80b42013-01-16 18:53:52 +0000645 %feature("docstring", "
646 //------------------------------------------------------------------
647 /// Find the first global (or static) variable by name.
648 ///
649 /// @param[in] name
650 /// The name of the global or static variable we are looking
651 /// for.
652 ///
653 /// @return
654 /// An SBValue that gets filled in with the found variable (if any).
655 //------------------------------------------------------------------
656 ") FindFirstGlobalVariable;
657 lldb::SBValue
658 FindFirstGlobalVariable (const char* name);
659
Johnny Chendc7d3c12011-07-16 21:15:39 +0000660 void
661 Clear ();
662
Greg Clayton00e6fbf2011-07-22 16:46:35 +0000663 lldb::SBAddress
664 ResolveLoadAddress (lldb::addr_t vm_addr);
Greg Claytond5944cd2013-12-06 01:12:00 +0000665
666 lldb::SBAddress
667 ResolvePastLoadAddress (uint32_t stop_id, lldb::addr_t vm_addr);
Johnny Chendc7d3c12011-07-16 21:15:39 +0000668
669 SBSymbolContext
670 ResolveSymbolContextForAddress (const SBAddress& addr,
671 uint32_t resolve_scope);
672
673 lldb::SBBreakpoint
674 BreakpointCreateByLocation (const char *file, uint32_t line);
675
676 lldb::SBBreakpoint
677 BreakpointCreateByLocation (const lldb::SBFileSpec &file_spec, uint32_t line);
678
679 lldb::SBBreakpoint
680 BreakpointCreateByName (const char *symbol_name, const char *module_name = NULL);
681
682 lldb::SBBreakpoint
Jim Ingham2dd7f7f2011-10-11 01:18:55 +0000683 BreakpointCreateByName (const char *symbol_name,
684 uint32_t func_name_type, // Logical OR one or more FunctionNameType enum bits
685 const SBFileSpecList &module_list,
686 const SBFileSpecList &comp_unit_list);
687
688 lldb::SBBreakpoint
Jim Inghamfab10e82012-03-06 00:37:27 +0000689 BreakpointCreateByNames (const char *symbol_name[],
690 uint32_t num_names,
691 uint32_t name_type_mask, // Logical OR one or more FunctionNameType enum bits
692 const SBFileSpecList &module_list,
693 const SBFileSpecList &comp_unit_list);
694
695 lldb::SBBreakpoint
Johnny Chendc7d3c12011-07-16 21:15:39 +0000696 BreakpointCreateByRegex (const char *symbol_name_regex, const char *module_name = NULL);
697
698 lldb::SBBreakpoint
Jim Ingham969795f2011-09-21 01:17:13 +0000699 BreakpointCreateBySourceRegex (const char *source_regex, const lldb::SBFileSpec &source_file, const char *module_name = NULL);
700
701 lldb::SBBreakpoint
Jim Inghamfab10e82012-03-06 00:37:27 +0000702 BreakpointCreateForException (lldb::LanguageType language,
703 bool catch_bp,
704 bool throw_bp);
705
706 lldb::SBBreakpoint
Johnny Chendc7d3c12011-07-16 21:15:39 +0000707 BreakpointCreateByAddress (addr_t address);
708
709 uint32_t
710 GetNumBreakpoints () const;
711
712 lldb::SBBreakpoint
713 GetBreakpointAtIndex (uint32_t idx) const;
714
715 bool
716 BreakpointDelete (break_id_t break_id);
717
718 lldb::SBBreakpoint
719 FindBreakpointByID (break_id_t break_id);
720
721 bool
722 EnableAllBreakpoints ();
723
724 bool
725 DisableAllBreakpoints ();
726
727 bool
728 DeleteAllBreakpoints ();
729
Johnny Chend4dd7992011-09-27 01:19:20 +0000730 uint32_t
Greg Clayton1b282f92011-10-13 18:08:26 +0000731 GetNumWatchpoints () const;
732
733 lldb::SBWatchpoint
734 GetWatchpointAtIndex (uint32_t idx) const;
735
Johnny Chend4dd7992011-09-27 01:19:20 +0000736 bool
Greg Clayton1b282f92011-10-13 18:08:26 +0000737 DeleteWatchpoint (lldb::watch_id_t watch_id);
738
739 lldb::SBWatchpoint
740 FindWatchpointByID (lldb::watch_id_t watch_id);
741
Johnny Chend4dd7992011-09-27 01:19:20 +0000742 bool
Greg Clayton1b282f92011-10-13 18:08:26 +0000743 EnableAllWatchpoints ();
744
Johnny Chend4dd7992011-09-27 01:19:20 +0000745 bool
Greg Clayton1b282f92011-10-13 18:08:26 +0000746 DisableAllWatchpoints ();
747
Johnny Chend4dd7992011-09-27 01:19:20 +0000748 bool
Greg Clayton1b282f92011-10-13 18:08:26 +0000749 DeleteAllWatchpoints ();
750
751 lldb::SBWatchpoint
752 WatchAddress (lldb::addr_t addr,
753 size_t size,
754 bool read,
Johnny Chenb90827e2012-06-04 23:19:54 +0000755 bool write,
756 SBError &error);
Greg Clayton1b282f92011-10-13 18:08:26 +0000757
Johnny Chend4dd7992011-09-27 01:19:20 +0000758
Johnny Chendc7d3c12011-07-16 21:15:39 +0000759 lldb::SBBroadcaster
760 GetBroadcaster () const;
Enrico Granata347c2aa2013-10-08 21:49:02 +0000761
762 lldb::SBValue
763 CreateValueFromAddress (const char *name, lldb::SBAddress addr, lldb::SBType type);
Sean Callanan50952e92011-12-14 23:49:37 +0000764
765 lldb::SBInstructionList
Greg Clayton9c766112012-03-06 22:24:44 +0000766 ReadInstructions (lldb::SBAddress base_addr, uint32_t count);
767
768 lldb::SBInstructionList
Jim Ingham0f063ba2013-03-02 00:26:47 +0000769 ReadInstructions (lldb::SBAddress base_addr, uint32_t count, const char *flavor_string);
770
771 lldb::SBInstructionList
Sean Callanan50952e92011-12-14 23:49:37 +0000772 GetInstructions (lldb::SBAddress base_addr, const void *buf, size_t size);
773
Jim Ingham0f063ba2013-03-02 00:26:47 +0000774 lldb::SBInstructionList
775 GetInstructionsWithFlavor (lldb::SBAddress base_addr, const char *flavor_string, const void *buf, size_t size);
776
Greg Claytone14e1922012-12-04 02:22:16 +0000777 lldb::SBSymbolContextList
778 FindSymbols (const char *name, lldb::SymbolType type = eSymbolTypeAny);
779
Johnny Chendc7d3c12011-07-16 21:15:39 +0000780 bool
Greg Claytonda7bc7d2011-11-13 06:57:31 +0000781 GetDescription (lldb::SBStream &description, lldb::DescriptionLevel description_level);
Greg Clayton13d19502012-01-29 06:07:39 +0000782
Greg Clayton13fbb992013-02-01 00:47:49 +0000783 lldb::addr_t
784 GetStackRedZoneSize();
785
Enrico Granatac3387332013-05-03 01:29:27 +0000786 bool
787 operator == (const lldb::SBTarget &rhs) const;
788
789 bool
790 operator != (const lldb::SBTarget &rhs) const;
791
Greg Clayton4b63a5c2013-01-04 18:10:18 +0000792 lldb::SBValue
793 EvaluateExpression (const char *expr, const lldb::SBExpressionOptions &options);
Greg Clayton13d19502012-01-29 06:07:39 +0000794 %pythoncode %{
Greg Clayton6b2bd932012-02-01 08:09:32 +0000795 class modules_access(object):
796 '''A helper object that will lazily hand out lldb.SBModule objects for a target when supplied an index, or by full or partial path.'''
797 def __init__(self, sbtarget):
798 self.sbtarget = sbtarget
799
800 def __len__(self):
801 if self.sbtarget:
Filipe Cabecinhas1a96ef82012-05-11 20:39:42 +0000802 return int(self.sbtarget.GetNumModules())
Greg Clayton6b2bd932012-02-01 08:09:32 +0000803 return 0
804
805 def __getitem__(self, key):
806 num_modules = self.sbtarget.GetNumModules()
807 if type(key) is int:
808 if key < num_modules:
809 return self.sbtarget.GetModuleAtIndex(key)
810 elif type(key) is str:
811 if key.find('/') == -1:
812 for idx in range(num_modules):
813 module = self.sbtarget.GetModuleAtIndex(idx)
814 if module.file.basename == key:
815 return module
816 else:
817 for idx in range(num_modules):
818 module = self.sbtarget.GetModuleAtIndex(idx)
819 if module.file.fullpath == key:
820 return module
821 # See if the string is a UUID
Greg Clayton1fb7c622013-03-07 02:58:47 +0000822 try:
823 the_uuid = uuid.UUID(key)
824 if the_uuid:
825 for idx in range(num_modules):
826 module = self.sbtarget.GetModuleAtIndex(idx)
827 if module.uuid == the_uuid:
828 return module
829 except:
830 return None
Greg Clayton6b2bd932012-02-01 08:09:32 +0000831 elif type(key) is uuid.UUID:
832 for idx in range(num_modules):
833 module = self.sbtarget.GetModuleAtIndex(idx)
834 if module.uuid == key:
835 return module
836 elif type(key) is re.SRE_Pattern:
837 matching_modules = []
838 for idx in range(num_modules):
839 module = self.sbtarget.GetModuleAtIndex(idx)
840 re_match = key.search(module.path.fullpath)
841 if re_match:
842 matching_modules.append(module)
843 return matching_modules
844 else:
845 print "error: unsupported item type: %s" % type(key)
846 return None
847
848 def get_modules_access_object(self):
Greg Claytonb62bb8c2012-02-03 03:22:53 +0000849 '''An accessor function that returns a modules_access() object which allows lazy module access from a lldb.SBTarget object.'''
Greg Clayton6b2bd932012-02-01 08:09:32 +0000850 return self.modules_access (self)
851
852 def get_modules_array(self):
Greg Claytonb62bb8c2012-02-03 03:22:53 +0000853 '''An accessor function that returns a list() that contains all modules in a lldb.SBTarget object.'''
Greg Clayton6b2bd932012-02-01 08:09:32 +0000854 modules = []
855 for idx in range(self.GetNumModules()):
856 modules.append(self.GetModuleAtIndex(idx))
857 return modules
858
859 __swig_getmethods__["modules"] = get_modules_array
Greg Clayton5ef31a92012-06-29 22:00:42 +0000860 if _newclass: modules = property(get_modules_array, None, doc='''A read only property that returns a list() of lldb.SBModule objects contained in this target. This list is a list all modules that the target currently is tracking (the main executable and all dependent shared libraries).''')
Greg Clayton6b2bd932012-02-01 08:09:32 +0000861
862 __swig_getmethods__["module"] = get_modules_access_object
Greg Clayton5ef31a92012-06-29 22:00:42 +0000863 if _newclass: module = property(get_modules_access_object, None, doc=r'''A read only property that returns an object that implements python operator overloading with the square brackets().\n target.module[<int>] allows array access to any modules.\n target.module[<str>] allows access to modules by basename, full path, or uuid string value.\n target.module[uuid.UUID()] allows module access by UUID.\n target.module[re] allows module access using a regular expression that matches the module full path.''')
Greg Clayton6b2bd932012-02-01 08:09:32 +0000864
Greg Clayton13d19502012-01-29 06:07:39 +0000865 __swig_getmethods__["process"] = GetProcess
Greg Clayton5ef31a92012-06-29 22:00:42 +0000866 if _newclass: process = property(GetProcess, None, doc='''A read only property that returns an lldb object that represents the process (lldb.SBProcess) that this target owns.''')
Greg Clayton13d19502012-01-29 06:07:39 +0000867
868 __swig_getmethods__["executable"] = GetExecutable
Greg Clayton5ef31a92012-06-29 22:00:42 +0000869 if _newclass: executable = property(GetExecutable, None, doc='''A read only property that returns an lldb object that represents the main executable module (lldb.SBModule) for this target.''')
Greg Clayton13d19502012-01-29 06:07:39 +0000870
871 __swig_getmethods__["debugger"] = GetDebugger
Greg Clayton5ef31a92012-06-29 22:00:42 +0000872 if _newclass: debugger = property(GetDebugger, None, doc='''A read only property that returns an lldb object that represents the debugger (lldb.SBDebugger) that owns this target.''')
Greg Clayton13d19502012-01-29 06:07:39 +0000873
Greg Clayton13d19502012-01-29 06:07:39 +0000874 __swig_getmethods__["num_breakpoints"] = GetNumBreakpoints
Greg Clayton5ef31a92012-06-29 22:00:42 +0000875 if _newclass: num_breakpoints = property(GetNumBreakpoints, None, doc='''A read only property that returns the number of breakpoints that this target has as an integer.''')
Greg Clayton13d19502012-01-29 06:07:39 +0000876
877 __swig_getmethods__["num_watchpoints"] = GetNumWatchpoints
Greg Clayton5ef31a92012-06-29 22:00:42 +0000878 if _newclass: num_watchpoints = property(GetNumWatchpoints, None, doc='''A read only property that returns the number of watchpoints that this target has as an integer.''')
Greg Clayton13d19502012-01-29 06:07:39 +0000879
880 __swig_getmethods__["broadcaster"] = GetBroadcaster
Greg Clayton5ef31a92012-06-29 22:00:42 +0000881 if _newclass: broadcaster = property(GetBroadcaster, None, doc='''A read only property that an lldb object that represents the broadcaster (lldb.SBBroadcaster) for this target.''')
Greg Clayton13d19502012-01-29 06:07:39 +0000882
883 __swig_getmethods__["byte_order"] = GetByteOrder
Greg Clayton5ef31a92012-06-29 22:00:42 +0000884 if _newclass: byte_order = property(GetByteOrder, None, doc='''A read only property that returns an lldb enumeration value (lldb.eByteOrderLittle, lldb.eByteOrderBig, lldb.eByteOrderInvalid) that represents the byte order for this target.''')
Greg Clayton13d19502012-01-29 06:07:39 +0000885
886 __swig_getmethods__["addr_size"] = GetAddressByteSize
Greg Clayton5ef31a92012-06-29 22:00:42 +0000887 if _newclass: addr_size = property(GetAddressByteSize, None, doc='''A read only property that returns the size in bytes of an address for this target.''')
Greg Clayton13d19502012-01-29 06:07:39 +0000888
889 __swig_getmethods__["triple"] = GetTriple
Greg Clayton5ef31a92012-06-29 22:00:42 +0000890 if _newclass: triple = property(GetTriple, None, doc='''A read only property that returns the target triple (arch-vendor-os) for this target as a string.''')
Greg Clayton13d19502012-01-29 06:07:39 +0000891 %}
892
Johnny Chendc7d3c12011-07-16 21:15:39 +0000893};
894
895} // namespace lldb