blob: 87d5c5b13b0c599bc13b6886d8a120183b7e7e46 [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 Clayton0e615682012-02-24 05:03:03 +000035 uint32_t
36 GetNumArguments ();
37
38 const char *
39 GetArgumentAtIndex (uint32_t idx);
40
41 void
42 SetArguments (const char **argv, bool append);
43
44 uint32_t
45 GetNumEnvironmentEntries ();
46
47 const char *
48 GetEnvironmentEntryAtIndex (uint32_t idx);
49
50 void
51 SetEnvironmentEntries (const char **envp, bool append);
52
53 void
54 Clear ();
55
56 const char *
57 GetWorkingDirectory () const;
58
59 void
60 SetWorkingDirectory (const char *working_dir);
61
62 uint32_t
63 GetLaunchFlags ();
64
65 void
66 SetLaunchFlags (uint32_t flags);
67
68 const char *
69 GetProcessPluginName ();
70
71 void
72 SetProcessPluginName (const char *plugin_name);
73
74 const char *
75 GetShell ();
76
77 void
78 SetShell (const char * path);
79
80 uint32_t
81 GetResumeCount ();
82
83 void
84 SetResumeCount (uint32_t c);
85
86 bool
87 AddCloseFileAction (int fd);
88
89 bool
90 AddDuplicateFileAction (int fd, int dup_fd);
91
92 bool
93 AddOpenFileAction (int fd, const char *path, bool read, bool write);
94
95 bool
96 AddSuppressFileAction (int fd, bool read, bool write);
Jason Molendaa3329782014-03-29 18:54:20 +000097
98 void
99 SetLaunchEventData (const char *data);
100
101 const char *
102 GetLaunchEventData () const;
103
Greg Clayton0e615682012-02-24 05:03:03 +0000104};
105
106class SBAttachInfo
107{
108public:
109 SBAttachInfo ();
110
111 SBAttachInfo (lldb::pid_t pid);
112
113 SBAttachInfo (const char *path, bool wait_for);
114
115 SBAttachInfo (const lldb::SBAttachInfo &rhs);
116
117 lldb::pid_t
118 GetProcessID ();
119
120 void
121 SetProcessID (lldb::pid_t pid);
122
123 void
124 SetExecutable (const char *path);
125
126 void
127 SetExecutable (lldb::SBFileSpec exe_file);
128
129 bool
130 GetWaitForLaunch ();
131
132 void
133 SetWaitForLaunch (bool b);
134
Jim Inghamcd16df92012-07-20 21:37:13 +0000135 bool
136 GetIgnoreExisting ();
137
138 void
139 SetIgnoreExisting (bool b);
140
Greg Clayton0e615682012-02-24 05:03:03 +0000141 uint32_t
142 GetResumeCount ();
143
144 void
145 SetResumeCount (uint32_t c);
146
147 const char *
148 GetProcessPluginName ();
149
150 void
151 SetProcessPluginName (const char *plugin_name);
152
153 uint32_t
Greg Clayton41bd8ac2012-02-24 23:56:06 +0000154 GetUserID();
155
156 uint32_t
157 GetGroupID();
158
159 bool
160 UserIDIsValid ();
161
162 bool
163 GroupIDIsValid ();
164
165 void
166 SetUserID (uint32_t uid);
167
168 void
169 SetGroupID (uint32_t gid);
170
171 uint32_t
Greg Clayton0e615682012-02-24 05:03:03 +0000172 GetEffectiveUserID();
173
174 uint32_t
175 GetEffectiveGroupID();
176
177 bool
178 EffectiveUserIDIsValid ();
179
180 bool
181 EffectiveGroupIDIsValid ();
182
183 void
184 SetEffectiveUserID (uint32_t uid);
185
186 void
187 SetEffectiveGroupID (uint32_t gid);
188
189 lldb::pid_t
190 GetParentProcessID ();
191
192 void
193 SetParentProcessID (lldb::pid_t pid);
194
195 bool
196 ParentProcessIDIsValid();
197};
198
199
Johnny Chendc7d3c12011-07-16 21:15:39 +0000200%feature("docstring",
201"Represents the target program running under the debugger.
202
Johnny Chen01a67862011-10-14 00:42:25 +0000203SBTarget supports module, breakpoint, and watchpoint iterations. For example,
Johnny Chendc7d3c12011-07-16 21:15:39 +0000204
205 for m in target.module_iter():
206 print m
207
208produces:
209
210(x86_64) /Volumes/data/lldb/svn/trunk/test/python_api/lldbutil/iter/a.out
211(x86_64) /usr/lib/dyld
212(x86_64) /usr/lib/libstdc++.6.dylib
213(x86_64) /usr/lib/libSystem.B.dylib
214(x86_64) /usr/lib/system/libmathCommon.A.dylib
215(x86_64) /usr/lib/libSystem.B.dylib(__commpage)
216
217and,
218
219 for b in target.breakpoint_iter():
220 print b
221
222produces:
223
224SBBreakpoint: id = 1, file ='main.cpp', line = 66, locations = 1
Johnny Chend4dd7992011-09-27 01:19:20 +0000225SBBreakpoint: id = 2, file ='main.cpp', line = 85, locations = 1
226
227and,
228
Johnny Chen01a67862011-10-14 00:42:25 +0000229 for wp_loc in target.watchpoint_iter():
Johnny Chend4dd7992011-09-27 01:19:20 +0000230 print wp_loc
231
232produces:
233
Johnny Chen01a67862011-10-14 00:42:25 +0000234Watchpoint 1: addr = 0x1034ca048 size = 4 state = enabled type = rw
Johnny Chend4dd7992011-09-27 01:19:20 +0000235 declare @ '/Volumes/data/lldb/svn/trunk/test/python_api/watchpoint/main.c:12'
Johnny Chen01a67862011-10-14 00:42:25 +0000236 hw_index = 0 hit_count = 2 ignore_count = 0"
Johnny Chen357033b2011-07-18 20:13:38 +0000237) SBTarget;
Johnny Chendc7d3c12011-07-16 21:15:39 +0000238class SBTarget
239{
Johnny Chendc7d3c12011-07-16 21:15:39 +0000240public:
241 //------------------------------------------------------------------
242 // Broadcaster bits.
243 //------------------------------------------------------------------
244 enum
245 {
246 eBroadcastBitBreakpointChanged = (1 << 0),
247 eBroadcastBitModulesLoaded = (1 << 1),
Jim Ingham1b5792e2012-12-18 02:03:49 +0000248 eBroadcastBitModulesUnloaded = (1 << 2),
Enrico Granataf15ee4e2013-04-05 18:49:06 +0000249 eBroadcastBitWatchpointChanged = (1 << 3),
250 eBroadcastBitSymbolsLoaded = (1 << 4)
Johnny Chendc7d3c12011-07-16 21:15:39 +0000251 };
252
253 //------------------------------------------------------------------
254 // Constructors
255 //------------------------------------------------------------------
256 SBTarget ();
257
258 SBTarget (const lldb::SBTarget& rhs);
259
Johnny Chendc7d3c12011-07-16 21:15:39 +0000260 //------------------------------------------------------------------
261 // Destructor
262 //------------------------------------------------------------------
263 ~SBTarget();
264
Jim Ingham4bddaeb2012-02-16 06:50:00 +0000265 static const char *
266 GetBroadcasterClassName ();
267
Johnny Chendc7d3c12011-07-16 21:15:39 +0000268 bool
269 IsValid() const;
270
271 lldb::SBProcess
272 GetProcess ();
273
274 %feature("docstring", "
275 //------------------------------------------------------------------
Greg Claytonfbb76342013-11-20 21:07:01 +0000276 /// Install any binaries that need to be installed.
277 ///
278 /// This function does nothing when debugging on the host system.
279 /// When connected to remote platforms, the target's main executable
280 /// and any modules that have their install path set will be
281 /// installed on the remote platform. If the main executable doesn't
282 /// have an install location set, it will be installed in the remote
283 /// platform's working directory.
284 ///
285 /// @return
286 /// An error describing anything that went wrong during
287 /// installation.
288 //------------------------------------------------------------------
289 ") Install;
290 lldb::SBError
291 Install();
292
293 %feature("docstring", "
294 //------------------------------------------------------------------
Johnny Chendc7d3c12011-07-16 21:15:39 +0000295 /// Launch a new process.
296 ///
297 /// Launch a new process by spawning a new process using the
298 /// target object's executable module's file as the file to launch.
299 /// Arguments are given in \a argv, and the environment variables
300 /// are in \a envp. Standard input and output files can be
301 /// optionally re-directed to \a stdin_path, \a stdout_path, and
302 /// \a stderr_path.
303 ///
304 /// @param[in] listener
305 /// An optional listener that will receive all process events.
306 /// If \a listener is valid then \a listener will listen to all
307 /// process events. If not valid, then this target's debugger
308 /// (SBTarget::GetDebugger()) will listen to all process events.
309 ///
310 /// @param[in] argv
311 /// The argument array.
312 ///
313 /// @param[in] envp
314 /// The environment array.
315 ///
316 /// @param[in] launch_flags
317 /// Flags to modify the launch (@see lldb::LaunchFlags)
318 ///
319 /// @param[in] stdin_path
320 /// The path to use when re-directing the STDIN of the new
321 /// process. If all stdXX_path arguments are NULL, a pseudo
322 /// terminal will be used.
323 ///
324 /// @param[in] stdout_path
325 /// The path to use when re-directing the STDOUT of the new
326 /// process. If all stdXX_path arguments are NULL, a pseudo
327 /// terminal will be used.
328 ///
329 /// @param[in] stderr_path
330 /// The path to use when re-directing the STDERR of the new
331 /// process. If all stdXX_path arguments are NULL, a pseudo
332 /// terminal will be used.
333 ///
334 /// @param[in] working_directory
335 /// The working directory to have the child process run in
336 ///
337 /// @param[in] launch_flags
338 /// Some launch options specified by logical OR'ing
339 /// lldb::LaunchFlags enumeration values together.
340 ///
341 /// @param[in] stop_at_endtry
342 /// If false do not stop the inferior at the entry point.
343 ///
344 /// @param[out]
345 /// An error object. Contains the reason if there is some failure.
346 ///
347 /// @return
348 /// A process object for the newly created process.
349 //------------------------------------------------------------------
350
351 For example,
352
353 process = target.Launch(self.dbg.GetListener(), None, None,
354 None, '/tmp/stdout.txt', None,
355 None, 0, False, error)
356
357 launches a new process by passing nothing for both the args and the envs
358 and redirect the standard output of the inferior to the /tmp/stdout.txt
359 file. It does not specify a working directory so that the debug server
360 will use its idea of what the current working directory is for the
361 inferior. Also, we ask the debugger not to stop the inferior at the
362 entry point. If no breakpoint is specified for the inferior, it should
363 run to completion if no user interaction is required.
364 ") Launch;
365 lldb::SBProcess
366 Launch (SBListener &listener,
367 char const **argv,
368 char const **envp,
369 const char *stdin_path,
370 const char *stdout_path,
371 const char *stderr_path,
372 const char *working_directory,
373 uint32_t launch_flags, // See LaunchFlags
374 bool stop_at_entry,
375 lldb::SBError& error);
376
377 %feature("docstring", "
378 //------------------------------------------------------------------
379 /// Launch a new process with sensible defaults.
380 ///
381 /// @param[in] argv
382 /// The argument array.
383 ///
384 /// @param[in] envp
385 /// The environment array.
386 ///
387 /// @param[in] working_directory
388 /// The working directory to have the child process run in
389 ///
390 /// Default: listener
391 /// Set to the target's debugger (SBTarget::GetDebugger())
392 ///
393 /// Default: launch_flags
394 /// Empty launch flags
395 ///
396 /// Default: stdin_path
397 /// Default: stdout_path
398 /// Default: stderr_path
399 /// A pseudo terminal will be used.
400 ///
401 /// @return
402 /// A process object for the newly created process.
403 //------------------------------------------------------------------
404
405 For example,
406
407 process = target.LaunchSimple(['X', 'Y', 'Z'], None, os.getcwd())
408
409 launches a new process by passing 'X', 'Y', 'Z' as the args to the
410 executable.
411 ") LaunchSimple;
412 lldb::SBProcess
413 LaunchSimple (const char **argv,
414 const char **envp,
415 const char *working_directory);
416
Greg Clayton0e615682012-02-24 05:03:03 +0000417 lldb::SBProcess
418 Launch (lldb::SBLaunchInfo &launch_info, lldb::SBError& error);
Greg Clayton4d8ad552013-03-25 22:40:51 +0000419
420 %feature("docstring", "
421 //------------------------------------------------------------------
422 /// Load a core file
423 ///
424 /// @param[in] core_file
425 /// File path of the core dump.
426 ///
427 /// @return
428 /// A process object for the newly created core file.
429 //------------------------------------------------------------------
430
431 For example,
432
433 process = target.LoadCore('./a.out.core')
434
435 loads a new core file and returns the process object.
436 ") LoadCore;
437 lldb::SBProcess
438 LoadCore(const char *core_file);
Greg Clayton0e615682012-02-24 05:03:03 +0000439
440 lldb::SBProcess
441 Attach (lldb::SBAttachInfo &attach_info, lldb::SBError& error);
442
443
Johnny Chendc7d3c12011-07-16 21:15:39 +0000444 %feature("docstring", "
445 //------------------------------------------------------------------
446 /// Attach to process with pid.
447 ///
448 /// @param[in] listener
449 /// An optional listener that will receive all process events.
450 /// If \a listener is valid then \a listener will listen to all
451 /// process events. If not valid, then this target's debugger
452 /// (SBTarget::GetDebugger()) will listen to all process events.
453 ///
454 /// @param[in] pid
455 /// The process ID to attach to.
456 ///
457 /// @param[out]
458 /// An error explaining what went wrong if attach fails.
459 ///
460 /// @return
461 /// A process object for the attached process.
462 //------------------------------------------------------------------
463 ") AttachToProcessWithID;
464 lldb::SBProcess
465 AttachToProcessWithID (SBListener &listener,
466 lldb::pid_t pid,
467 lldb::SBError& error);
468
469 %feature("docstring", "
470 //------------------------------------------------------------------
471 /// Attach to process with name.
472 ///
473 /// @param[in] listener
474 /// An optional listener that will receive all process events.
475 /// If \a listener is valid then \a listener will listen to all
476 /// process events. If not valid, then this target's debugger
477 /// (SBTarget::GetDebugger()) will listen to all process events.
478 ///
479 /// @param[in] name
480 /// Basename of process to attach to.
481 ///
482 /// @param[in] wait_for
483 /// If true wait for a new instance of 'name' to be launched.
484 ///
485 /// @param[out]
486 /// An error explaining what went wrong if attach fails.
487 ///
488 /// @return
489 /// A process object for the attached process.
490 //------------------------------------------------------------------
491 ") AttachToProcessWithName;
492 lldb::SBProcess
493 AttachToProcessWithName (SBListener &listener,
494 const char *name,
495 bool wait_for,
496 lldb::SBError& error);
497
498 %feature("docstring", "
499 //------------------------------------------------------------------
500 /// Connect to a remote debug server with url.
501 ///
502 /// @param[in] listener
503 /// An optional listener that will receive all process events.
504 /// If \a listener is valid then \a listener will listen to all
505 /// process events. If not valid, then this target's debugger
506 /// (SBTarget::GetDebugger()) will listen to all process events.
507 ///
508 /// @param[in] url
509 /// The url to connect to, e.g., 'connect://localhost:12345'.
510 ///
511 /// @param[in] plugin_name
512 /// The plugin name to be used; can be NULL.
513 ///
514 /// @param[out]
515 /// An error explaining what went wrong if the connect fails.
516 ///
517 /// @return
518 /// A process object for the connected process.
519 //------------------------------------------------------------------
520 ") ConnectRemote;
521 lldb::SBProcess
522 ConnectRemote (SBListener &listener,
523 const char *url,
524 const char *plugin_name,
525 SBError& error);
526
527 lldb::SBFileSpec
528 GetExecutable ();
529
Greg Claytoncac9c5f2011-09-24 00:52:29 +0000530 bool
531 AddModule (lldb::SBModule &module);
532
533 lldb::SBModule
534 AddModule (const char *path,
535 const char *triple,
536 const char *uuid);
537
Greg Claytonb210aec2012-04-23 20:23:39 +0000538 lldb::SBModule
539 AddModule (const char *path,
540 const char *triple,
541 const char *uuid_cstr,
542 const char *symfile);
543
Greg Clayton226cce22013-07-08 22:22:41 +0000544 lldb::SBModule
545 AddModule (const SBModuleSpec &module_spec);
546
Johnny Chendc7d3c12011-07-16 21:15:39 +0000547 uint32_t
548 GetNumModules () const;
549
550 lldb::SBModule
551 GetModuleAtIndex (uint32_t idx);
552
Greg Claytoncac9c5f2011-09-24 00:52:29 +0000553 bool
554 RemoveModule (lldb::SBModule module);
555
Johnny Chendc7d3c12011-07-16 21:15:39 +0000556 lldb::SBDebugger
557 GetDebugger() const;
558
559 lldb::SBModule
560 FindModule (const lldb::SBFileSpec &file_spec);
561
Greg Clayton13d19502012-01-29 06:07:39 +0000562 lldb::ByteOrder
563 GetByteOrder ();
564
565 uint32_t
566 GetAddressByteSize();
567
568 const char *
569 GetTriple ();
570
Greg Claytoncac9c5f2011-09-24 00:52:29 +0000571 lldb::SBError
572 SetSectionLoadAddress (lldb::SBSection section,
573 lldb::addr_t section_base_addr);
574
575 lldb::SBError
576 ClearSectionLoadAddress (lldb::SBSection section);
577
578 lldb::SBError
579 SetModuleLoadAddress (lldb::SBModule module,
580 int64_t sections_offset);
581
582 lldb::SBError
583 ClearModuleLoadAddress (lldb::SBModule module);
584
Johnny Chendc7d3c12011-07-16 21:15:39 +0000585 %feature("docstring", "
586 //------------------------------------------------------------------
587 /// Find functions by name.
588 ///
589 /// @param[in] name
590 /// The name of the function we are looking for.
591 ///
592 /// @param[in] name_type_mask
593 /// A logical OR of one or more FunctionNameType enum bits that
594 /// indicate what kind of names should be used when doing the
595 /// lookup. Bits include fully qualified names, base names,
596 /// C++ methods, or ObjC selectors.
597 /// See FunctionNameType for more details.
598 ///
Johnny Chendc7d3c12011-07-16 21:15:39 +0000599 /// @return
Greg Clayton5569e642012-02-06 01:44:54 +0000600 /// A lldb::SBSymbolContextList that gets filled in with all of
601 /// the symbol contexts for all the matches.
Johnny Chendc7d3c12011-07-16 21:15:39 +0000602 //------------------------------------------------------------------
603 ") FindFunctions;
Greg Clayton5569e642012-02-06 01:44:54 +0000604 lldb::SBSymbolContextList
Johnny Chendc7d3c12011-07-16 21:15:39 +0000605 FindFunctions (const char *name,
Greg Clayton5569e642012-02-06 01:44:54 +0000606 uint32_t name_type_mask = lldb::eFunctionNameTypeAny);
Enrico Granata6f3533f2011-07-29 19:53:35 +0000607
608 lldb::SBType
609 FindFirstType (const char* type);
610
611 lldb::SBTypeList
612 FindTypes (const char* type);
Johnny Chendc7d3c12011-07-16 21:15:39 +0000613
Greg Claytonb43165b2012-12-05 21:24:42 +0000614 lldb::SBType
615 GetBasicType(lldb::BasicType type);
616
Jim Inghame37d6052011-09-13 00:29:56 +0000617 lldb::SBSourceManager
618 GetSourceManager ();
619
Johnny Chendc7d3c12011-07-16 21:15:39 +0000620 %feature("docstring", "
621 //------------------------------------------------------------------
622 /// Find global and static variables by name.
623 ///
624 /// @param[in] name
625 /// The name of the global or static variable we are looking
626 /// for.
627 ///
628 /// @param[in] max_matches
629 /// Allow the number of matches to be limited to \a max_matches.
630 ///
631 /// @return
632 /// A list of matched variables in an SBValueList.
633 //------------------------------------------------------------------
634 ") FindGlobalVariables;
635 lldb::SBValueList
636 FindGlobalVariables (const char *name,
637 uint32_t max_matches);
638
Enrico Granatabcd80b42013-01-16 18:53:52 +0000639 %feature("docstring", "
640 //------------------------------------------------------------------
641 /// Find the first global (or static) variable by name.
642 ///
643 /// @param[in] name
644 /// The name of the global or static variable we are looking
645 /// for.
646 ///
647 /// @return
648 /// An SBValue that gets filled in with the found variable (if any).
649 //------------------------------------------------------------------
650 ") FindFirstGlobalVariable;
651 lldb::SBValue
652 FindFirstGlobalVariable (const char* name);
653
Johnny Chendc7d3c12011-07-16 21:15:39 +0000654 void
655 Clear ();
656
Greg Clayton00e6fbf2011-07-22 16:46:35 +0000657 lldb::SBAddress
658 ResolveLoadAddress (lldb::addr_t vm_addr);
Greg Claytond5944cd2013-12-06 01:12:00 +0000659
660 lldb::SBAddress
661 ResolvePastLoadAddress (uint32_t stop_id, lldb::addr_t vm_addr);
Johnny Chendc7d3c12011-07-16 21:15:39 +0000662
663 SBSymbolContext
664 ResolveSymbolContextForAddress (const SBAddress& addr,
665 uint32_t resolve_scope);
666
667 lldb::SBBreakpoint
668 BreakpointCreateByLocation (const char *file, uint32_t line);
669
670 lldb::SBBreakpoint
671 BreakpointCreateByLocation (const lldb::SBFileSpec &file_spec, uint32_t line);
672
673 lldb::SBBreakpoint
674 BreakpointCreateByName (const char *symbol_name, const char *module_name = NULL);
675
676 lldb::SBBreakpoint
Jim Ingham2dd7f7f2011-10-11 01:18:55 +0000677 BreakpointCreateByName (const char *symbol_name,
678 uint32_t func_name_type, // Logical OR one or more FunctionNameType enum bits
679 const SBFileSpecList &module_list,
680 const SBFileSpecList &comp_unit_list);
681
682 lldb::SBBreakpoint
Jim Inghamfab10e82012-03-06 00:37:27 +0000683 BreakpointCreateByNames (const char *symbol_name[],
684 uint32_t num_names,
685 uint32_t name_type_mask, // Logical OR one or more FunctionNameType enum bits
686 const SBFileSpecList &module_list,
687 const SBFileSpecList &comp_unit_list);
688
689 lldb::SBBreakpoint
Johnny Chendc7d3c12011-07-16 21:15:39 +0000690 BreakpointCreateByRegex (const char *symbol_name_regex, const char *module_name = NULL);
691
692 lldb::SBBreakpoint
Jim Ingham969795f2011-09-21 01:17:13 +0000693 BreakpointCreateBySourceRegex (const char *source_regex, const lldb::SBFileSpec &source_file, const char *module_name = NULL);
694
695 lldb::SBBreakpoint
Jim Inghamfab10e82012-03-06 00:37:27 +0000696 BreakpointCreateForException (lldb::LanguageType language,
697 bool catch_bp,
698 bool throw_bp);
699
700 lldb::SBBreakpoint
Johnny Chendc7d3c12011-07-16 21:15:39 +0000701 BreakpointCreateByAddress (addr_t address);
702
703 uint32_t
704 GetNumBreakpoints () const;
705
706 lldb::SBBreakpoint
707 GetBreakpointAtIndex (uint32_t idx) const;
708
709 bool
710 BreakpointDelete (break_id_t break_id);
711
712 lldb::SBBreakpoint
713 FindBreakpointByID (break_id_t break_id);
714
715 bool
716 EnableAllBreakpoints ();
717
718 bool
719 DisableAllBreakpoints ();
720
721 bool
722 DeleteAllBreakpoints ();
723
Johnny Chend4dd7992011-09-27 01:19:20 +0000724 uint32_t
Greg Clayton1b282f92011-10-13 18:08:26 +0000725 GetNumWatchpoints () const;
726
727 lldb::SBWatchpoint
728 GetWatchpointAtIndex (uint32_t idx) const;
729
Johnny Chend4dd7992011-09-27 01:19:20 +0000730 bool
Greg Clayton1b282f92011-10-13 18:08:26 +0000731 DeleteWatchpoint (lldb::watch_id_t watch_id);
732
733 lldb::SBWatchpoint
734 FindWatchpointByID (lldb::watch_id_t watch_id);
735
Johnny Chend4dd7992011-09-27 01:19:20 +0000736 bool
Greg Clayton1b282f92011-10-13 18:08:26 +0000737 EnableAllWatchpoints ();
738
Johnny Chend4dd7992011-09-27 01:19:20 +0000739 bool
Greg Clayton1b282f92011-10-13 18:08:26 +0000740 DisableAllWatchpoints ();
741
Johnny Chend4dd7992011-09-27 01:19:20 +0000742 bool
Greg Clayton1b282f92011-10-13 18:08:26 +0000743 DeleteAllWatchpoints ();
744
745 lldb::SBWatchpoint
746 WatchAddress (lldb::addr_t addr,
747 size_t size,
748 bool read,
Johnny Chenb90827e2012-06-04 23:19:54 +0000749 bool write,
750 SBError &error);
Greg Clayton1b282f92011-10-13 18:08:26 +0000751
Johnny Chend4dd7992011-09-27 01:19:20 +0000752
Johnny Chendc7d3c12011-07-16 21:15:39 +0000753 lldb::SBBroadcaster
754 GetBroadcaster () const;
Enrico Granata347c2aa2013-10-08 21:49:02 +0000755
756 lldb::SBValue
757 CreateValueFromAddress (const char *name, lldb::SBAddress addr, lldb::SBType type);
Sean Callanan50952e92011-12-14 23:49:37 +0000758
759 lldb::SBInstructionList
Greg Clayton9c766112012-03-06 22:24:44 +0000760 ReadInstructions (lldb::SBAddress base_addr, uint32_t count);
761
762 lldb::SBInstructionList
Jim Ingham0f063ba2013-03-02 00:26:47 +0000763 ReadInstructions (lldb::SBAddress base_addr, uint32_t count, const char *flavor_string);
764
765 lldb::SBInstructionList
Sean Callanan50952e92011-12-14 23:49:37 +0000766 GetInstructions (lldb::SBAddress base_addr, const void *buf, size_t size);
767
Jim Ingham0f063ba2013-03-02 00:26:47 +0000768 lldb::SBInstructionList
769 GetInstructionsWithFlavor (lldb::SBAddress base_addr, const char *flavor_string, const void *buf, size_t size);
770
Greg Claytone14e1922012-12-04 02:22:16 +0000771 lldb::SBSymbolContextList
772 FindSymbols (const char *name, lldb::SymbolType type = eSymbolTypeAny);
773
Johnny Chendc7d3c12011-07-16 21:15:39 +0000774 bool
Greg Claytonda7bc7d2011-11-13 06:57:31 +0000775 GetDescription (lldb::SBStream &description, lldb::DescriptionLevel description_level);
Greg Clayton13d19502012-01-29 06:07:39 +0000776
Greg Clayton13fbb992013-02-01 00:47:49 +0000777 lldb::addr_t
778 GetStackRedZoneSize();
779
Enrico Granatac3387332013-05-03 01:29:27 +0000780 bool
781 operator == (const lldb::SBTarget &rhs) const;
782
783 bool
784 operator != (const lldb::SBTarget &rhs) const;
785
Greg Clayton4b63a5c2013-01-04 18:10:18 +0000786 lldb::SBValue
787 EvaluateExpression (const char *expr, const lldb::SBExpressionOptions &options);
Greg Clayton13d19502012-01-29 06:07:39 +0000788 %pythoncode %{
Greg Clayton6b2bd932012-02-01 08:09:32 +0000789 class modules_access(object):
790 '''A helper object that will lazily hand out lldb.SBModule objects for a target when supplied an index, or by full or partial path.'''
791 def __init__(self, sbtarget):
792 self.sbtarget = sbtarget
793
794 def __len__(self):
795 if self.sbtarget:
Filipe Cabecinhas1a96ef82012-05-11 20:39:42 +0000796 return int(self.sbtarget.GetNumModules())
Greg Clayton6b2bd932012-02-01 08:09:32 +0000797 return 0
798
799 def __getitem__(self, key):
800 num_modules = self.sbtarget.GetNumModules()
801 if type(key) is int:
802 if key < num_modules:
803 return self.sbtarget.GetModuleAtIndex(key)
804 elif type(key) is str:
805 if key.find('/') == -1:
806 for idx in range(num_modules):
807 module = self.sbtarget.GetModuleAtIndex(idx)
808 if module.file.basename == key:
809 return module
810 else:
811 for idx in range(num_modules):
812 module = self.sbtarget.GetModuleAtIndex(idx)
813 if module.file.fullpath == key:
814 return module
815 # See if the string is a UUID
Greg Clayton1fb7c622013-03-07 02:58:47 +0000816 try:
817 the_uuid = uuid.UUID(key)
818 if the_uuid:
819 for idx in range(num_modules):
820 module = self.sbtarget.GetModuleAtIndex(idx)
821 if module.uuid == the_uuid:
822 return module
823 except:
824 return None
Greg Clayton6b2bd932012-02-01 08:09:32 +0000825 elif type(key) is uuid.UUID:
826 for idx in range(num_modules):
827 module = self.sbtarget.GetModuleAtIndex(idx)
828 if module.uuid == key:
829 return module
830 elif type(key) is re.SRE_Pattern:
831 matching_modules = []
832 for idx in range(num_modules):
833 module = self.sbtarget.GetModuleAtIndex(idx)
834 re_match = key.search(module.path.fullpath)
835 if re_match:
836 matching_modules.append(module)
837 return matching_modules
838 else:
839 print "error: unsupported item type: %s" % type(key)
840 return None
841
842 def get_modules_access_object(self):
Greg Claytonb62bb8c2012-02-03 03:22:53 +0000843 '''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 +0000844 return self.modules_access (self)
845
846 def get_modules_array(self):
Greg Claytonb62bb8c2012-02-03 03:22:53 +0000847 '''An accessor function that returns a list() that contains all modules in a lldb.SBTarget object.'''
Greg Clayton6b2bd932012-02-01 08:09:32 +0000848 modules = []
849 for idx in range(self.GetNumModules()):
850 modules.append(self.GetModuleAtIndex(idx))
851 return modules
852
853 __swig_getmethods__["modules"] = get_modules_array
Greg Clayton5ef31a92012-06-29 22:00:42 +0000854 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 +0000855
856 __swig_getmethods__["module"] = get_modules_access_object
Greg Clayton5ef31a92012-06-29 22:00:42 +0000857 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 +0000858
Greg Clayton13d19502012-01-29 06:07:39 +0000859 __swig_getmethods__["process"] = GetProcess
Greg Clayton5ef31a92012-06-29 22:00:42 +0000860 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 +0000861
862 __swig_getmethods__["executable"] = GetExecutable
Greg Clayton5ef31a92012-06-29 22:00:42 +0000863 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 +0000864
865 __swig_getmethods__["debugger"] = GetDebugger
Greg Clayton5ef31a92012-06-29 22:00:42 +0000866 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 +0000867
Greg Clayton13d19502012-01-29 06:07:39 +0000868 __swig_getmethods__["num_breakpoints"] = GetNumBreakpoints
Greg Clayton5ef31a92012-06-29 22:00:42 +0000869 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 +0000870
871 __swig_getmethods__["num_watchpoints"] = GetNumWatchpoints
Greg Clayton5ef31a92012-06-29 22:00:42 +0000872 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 +0000873
874 __swig_getmethods__["broadcaster"] = GetBroadcaster
Greg Clayton5ef31a92012-06-29 22:00:42 +0000875 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 +0000876
877 __swig_getmethods__["byte_order"] = GetByteOrder
Greg Clayton5ef31a92012-06-29 22:00:42 +0000878 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 +0000879
880 __swig_getmethods__["addr_size"] = GetAddressByteSize
Greg Clayton5ef31a92012-06-29 22:00:42 +0000881 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 +0000882
883 __swig_getmethods__["triple"] = GetTriple
Greg Clayton5ef31a92012-06-29 22:00:42 +0000884 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 +0000885 %}
886
Johnny Chendc7d3c12011-07-16 21:15:39 +0000887};
888
889} // namespace lldb