blob: 345929a80dc68131b002885941cfd1f3899aa279 [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
Jim Ingham106d0282014-06-25 02:32:56 +0000110 bool
111 GetDetachOnError() const;
112
113 void
114 SetDetachOnError(bool enable);
Greg Clayton0e615682012-02-24 05:03:03 +0000115};
116
117class SBAttachInfo
118{
119public:
120 SBAttachInfo ();
121
122 SBAttachInfo (lldb::pid_t pid);
123
124 SBAttachInfo (const char *path, bool wait_for);
125
126 SBAttachInfo (const lldb::SBAttachInfo &rhs);
127
128 lldb::pid_t
129 GetProcessID ();
130
131 void
132 SetProcessID (lldb::pid_t pid);
133
134 void
135 SetExecutable (const char *path);
136
137 void
138 SetExecutable (lldb::SBFileSpec exe_file);
139
140 bool
141 GetWaitForLaunch ();
142
143 void
144 SetWaitForLaunch (bool b);
145
Jim Inghamcd16df92012-07-20 21:37:13 +0000146 bool
147 GetIgnoreExisting ();
148
149 void
150 SetIgnoreExisting (bool b);
151
Greg Clayton0e615682012-02-24 05:03:03 +0000152 uint32_t
153 GetResumeCount ();
154
155 void
156 SetResumeCount (uint32_t c);
157
158 const char *
159 GetProcessPluginName ();
160
161 void
162 SetProcessPluginName (const char *plugin_name);
163
164 uint32_t
Greg Clayton41bd8ac2012-02-24 23:56:06 +0000165 GetUserID();
166
167 uint32_t
168 GetGroupID();
169
170 bool
171 UserIDIsValid ();
172
173 bool
174 GroupIDIsValid ();
175
176 void
177 SetUserID (uint32_t uid);
178
179 void
180 SetGroupID (uint32_t gid);
181
182 uint32_t
Greg Clayton0e615682012-02-24 05:03:03 +0000183 GetEffectiveUserID();
184
185 uint32_t
186 GetEffectiveGroupID();
187
188 bool
189 EffectiveUserIDIsValid ();
190
191 bool
192 EffectiveGroupIDIsValid ();
193
194 void
195 SetEffectiveUserID (uint32_t uid);
196
197 void
198 SetEffectiveGroupID (uint32_t gid);
199
200 lldb::pid_t
201 GetParentProcessID ();
202
203 void
204 SetParentProcessID (lldb::pid_t pid);
205
206 bool
207 ParentProcessIDIsValid();
208};
209
210
Johnny Chendc7d3c12011-07-16 21:15:39 +0000211%feature("docstring",
212"Represents the target program running under the debugger.
213
Johnny Chen01a67862011-10-14 00:42:25 +0000214SBTarget supports module, breakpoint, and watchpoint iterations. For example,
Johnny Chendc7d3c12011-07-16 21:15:39 +0000215
216 for m in target.module_iter():
217 print m
218
219produces:
220
221(x86_64) /Volumes/data/lldb/svn/trunk/test/python_api/lldbutil/iter/a.out
222(x86_64) /usr/lib/dyld
223(x86_64) /usr/lib/libstdc++.6.dylib
224(x86_64) /usr/lib/libSystem.B.dylib
225(x86_64) /usr/lib/system/libmathCommon.A.dylib
226(x86_64) /usr/lib/libSystem.B.dylib(__commpage)
227
228and,
229
230 for b in target.breakpoint_iter():
231 print b
232
233produces:
234
235SBBreakpoint: id = 1, file ='main.cpp', line = 66, locations = 1
Johnny Chend4dd7992011-09-27 01:19:20 +0000236SBBreakpoint: id = 2, file ='main.cpp', line = 85, locations = 1
237
238and,
239
Johnny Chen01a67862011-10-14 00:42:25 +0000240 for wp_loc in target.watchpoint_iter():
Johnny Chend4dd7992011-09-27 01:19:20 +0000241 print wp_loc
242
243produces:
244
Johnny Chen01a67862011-10-14 00:42:25 +0000245Watchpoint 1: addr = 0x1034ca048 size = 4 state = enabled type = rw
Johnny Chend4dd7992011-09-27 01:19:20 +0000246 declare @ '/Volumes/data/lldb/svn/trunk/test/python_api/watchpoint/main.c:12'
Johnny Chen01a67862011-10-14 00:42:25 +0000247 hw_index = 0 hit_count = 2 ignore_count = 0"
Johnny Chen357033b2011-07-18 20:13:38 +0000248) SBTarget;
Johnny Chendc7d3c12011-07-16 21:15:39 +0000249class SBTarget
250{
Johnny Chendc7d3c12011-07-16 21:15:39 +0000251public:
252 //------------------------------------------------------------------
253 // Broadcaster bits.
254 //------------------------------------------------------------------
255 enum
256 {
257 eBroadcastBitBreakpointChanged = (1 << 0),
258 eBroadcastBitModulesLoaded = (1 << 1),
Jim Ingham1b5792e2012-12-18 02:03:49 +0000259 eBroadcastBitModulesUnloaded = (1 << 2),
Enrico Granataf15ee4e2013-04-05 18:49:06 +0000260 eBroadcastBitWatchpointChanged = (1 << 3),
261 eBroadcastBitSymbolsLoaded = (1 << 4)
Johnny Chendc7d3c12011-07-16 21:15:39 +0000262 };
263
264 //------------------------------------------------------------------
265 // Constructors
266 //------------------------------------------------------------------
267 SBTarget ();
268
269 SBTarget (const lldb::SBTarget& rhs);
270
Johnny Chendc7d3c12011-07-16 21:15:39 +0000271 //------------------------------------------------------------------
272 // Destructor
273 //------------------------------------------------------------------
274 ~SBTarget();
275
Jim Ingham4bddaeb2012-02-16 06:50:00 +0000276 static const char *
277 GetBroadcasterClassName ();
278
Johnny Chendc7d3c12011-07-16 21:15:39 +0000279 bool
280 IsValid() const;
281
282 lldb::SBProcess
283 GetProcess ();
284
285 %feature("docstring", "
286 //------------------------------------------------------------------
Greg Claytonfbb76342013-11-20 21:07:01 +0000287 /// Install any binaries that need to be installed.
288 ///
289 /// This function does nothing when debugging on the host system.
290 /// When connected to remote platforms, the target's main executable
291 /// and any modules that have their install path set will be
292 /// installed on the remote platform. If the main executable doesn't
293 /// have an install location set, it will be installed in the remote
294 /// platform's working directory.
295 ///
296 /// @return
297 /// An error describing anything that went wrong during
298 /// installation.
299 //------------------------------------------------------------------
300 ") Install;
301 lldb::SBError
302 Install();
303
304 %feature("docstring", "
305 //------------------------------------------------------------------
Johnny Chendc7d3c12011-07-16 21:15:39 +0000306 /// Launch a new process.
307 ///
308 /// Launch a new process by spawning a new process using the
309 /// target object's executable module's file as the file to launch.
310 /// Arguments are given in \a argv, and the environment variables
311 /// are in \a envp. Standard input and output files can be
312 /// optionally re-directed to \a stdin_path, \a stdout_path, and
313 /// \a stderr_path.
314 ///
315 /// @param[in] listener
316 /// An optional listener that will receive all process events.
317 /// If \a listener is valid then \a listener will listen to all
318 /// process events. If not valid, then this target's debugger
319 /// (SBTarget::GetDebugger()) will listen to all process events.
320 ///
321 /// @param[in] argv
322 /// The argument array.
323 ///
324 /// @param[in] envp
325 /// The environment array.
326 ///
327 /// @param[in] launch_flags
328 /// Flags to modify the launch (@see lldb::LaunchFlags)
329 ///
330 /// @param[in] stdin_path
331 /// The path to use when re-directing the STDIN of the new
332 /// process. If all stdXX_path arguments are NULL, a pseudo
333 /// terminal will be used.
334 ///
335 /// @param[in] stdout_path
336 /// The path to use when re-directing the STDOUT of the new
337 /// process. If all stdXX_path arguments are NULL, a pseudo
338 /// terminal will be used.
339 ///
340 /// @param[in] stderr_path
341 /// The path to use when re-directing the STDERR of the new
342 /// process. If all stdXX_path arguments are NULL, a pseudo
343 /// terminal will be used.
344 ///
345 /// @param[in] working_directory
346 /// The working directory to have the child process run in
347 ///
348 /// @param[in] launch_flags
349 /// Some launch options specified by logical OR'ing
350 /// lldb::LaunchFlags enumeration values together.
351 ///
352 /// @param[in] stop_at_endtry
353 /// If false do not stop the inferior at the entry point.
354 ///
355 /// @param[out]
356 /// An error object. Contains the reason if there is some failure.
357 ///
358 /// @return
359 /// A process object for the newly created process.
360 //------------------------------------------------------------------
361
362 For example,
363
364 process = target.Launch(self.dbg.GetListener(), None, None,
365 None, '/tmp/stdout.txt', None,
366 None, 0, False, error)
367
368 launches a new process by passing nothing for both the args and the envs
369 and redirect the standard output of the inferior to the /tmp/stdout.txt
370 file. It does not specify a working directory so that the debug server
371 will use its idea of what the current working directory is for the
372 inferior. Also, we ask the debugger not to stop the inferior at the
373 entry point. If no breakpoint is specified for the inferior, it should
374 run to completion if no user interaction is required.
375 ") Launch;
376 lldb::SBProcess
377 Launch (SBListener &listener,
378 char const **argv,
379 char const **envp,
380 const char *stdin_path,
381 const char *stdout_path,
382 const char *stderr_path,
383 const char *working_directory,
384 uint32_t launch_flags, // See LaunchFlags
385 bool stop_at_entry,
386 lldb::SBError& error);
387
388 %feature("docstring", "
389 //------------------------------------------------------------------
390 /// Launch a new process with sensible defaults.
391 ///
392 /// @param[in] argv
393 /// The argument array.
394 ///
395 /// @param[in] envp
396 /// The environment array.
397 ///
398 /// @param[in] working_directory
399 /// The working directory to have the child process run in
400 ///
401 /// Default: listener
402 /// Set to the target's debugger (SBTarget::GetDebugger())
403 ///
404 /// Default: launch_flags
405 /// Empty launch flags
406 ///
407 /// Default: stdin_path
408 /// Default: stdout_path
409 /// Default: stderr_path
410 /// A pseudo terminal will be used.
411 ///
412 /// @return
413 /// A process object for the newly created process.
414 //------------------------------------------------------------------
415
416 For example,
417
418 process = target.LaunchSimple(['X', 'Y', 'Z'], None, os.getcwd())
419
420 launches a new process by passing 'X', 'Y', 'Z' as the args to the
421 executable.
422 ") LaunchSimple;
423 lldb::SBProcess
424 LaunchSimple (const char **argv,
425 const char **envp,
426 const char *working_directory);
427
Greg Clayton0e615682012-02-24 05:03:03 +0000428 lldb::SBProcess
429 Launch (lldb::SBLaunchInfo &launch_info, lldb::SBError& error);
Greg Clayton4d8ad552013-03-25 22:40:51 +0000430
431 %feature("docstring", "
432 //------------------------------------------------------------------
433 /// Load a core file
434 ///
435 /// @param[in] core_file
436 /// File path of the core dump.
437 ///
438 /// @return
439 /// A process object for the newly created core file.
440 //------------------------------------------------------------------
441
442 For example,
443
444 process = target.LoadCore('./a.out.core')
445
446 loads a new core file and returns the process object.
447 ") LoadCore;
448 lldb::SBProcess
449 LoadCore(const char *core_file);
Greg Clayton0e615682012-02-24 05:03:03 +0000450
451 lldb::SBProcess
452 Attach (lldb::SBAttachInfo &attach_info, lldb::SBError& error);
453
454
Johnny Chendc7d3c12011-07-16 21:15:39 +0000455 %feature("docstring", "
456 //------------------------------------------------------------------
457 /// Attach to process with pid.
458 ///
459 /// @param[in] listener
460 /// An optional listener that will receive all process events.
461 /// If \a listener is valid then \a listener will listen to all
462 /// process events. If not valid, then this target's debugger
463 /// (SBTarget::GetDebugger()) will listen to all process events.
464 ///
465 /// @param[in] pid
466 /// The process ID to attach to.
467 ///
468 /// @param[out]
469 /// An error explaining what went wrong if attach fails.
470 ///
471 /// @return
472 /// A process object for the attached process.
473 //------------------------------------------------------------------
474 ") AttachToProcessWithID;
475 lldb::SBProcess
476 AttachToProcessWithID (SBListener &listener,
477 lldb::pid_t pid,
478 lldb::SBError& error);
479
480 %feature("docstring", "
481 //------------------------------------------------------------------
482 /// Attach to process with name.
483 ///
484 /// @param[in] listener
485 /// An optional listener that will receive all process events.
486 /// If \a listener is valid then \a listener will listen to all
487 /// process events. If not valid, then this target's debugger
488 /// (SBTarget::GetDebugger()) will listen to all process events.
489 ///
490 /// @param[in] name
491 /// Basename of process to attach to.
492 ///
493 /// @param[in] wait_for
494 /// If true wait for a new instance of 'name' to be launched.
495 ///
496 /// @param[out]
497 /// An error explaining what went wrong if attach fails.
498 ///
499 /// @return
500 /// A process object for the attached process.
501 //------------------------------------------------------------------
502 ") AttachToProcessWithName;
503 lldb::SBProcess
504 AttachToProcessWithName (SBListener &listener,
505 const char *name,
506 bool wait_for,
507 lldb::SBError& error);
508
509 %feature("docstring", "
510 //------------------------------------------------------------------
511 /// Connect to a remote debug server with url.
512 ///
513 /// @param[in] listener
514 /// An optional listener that will receive all process events.
515 /// If \a listener is valid then \a listener will listen to all
516 /// process events. If not valid, then this target's debugger
517 /// (SBTarget::GetDebugger()) will listen to all process events.
518 ///
519 /// @param[in] url
520 /// The url to connect to, e.g., 'connect://localhost:12345'.
521 ///
522 /// @param[in] plugin_name
523 /// The plugin name to be used; can be NULL.
524 ///
525 /// @param[out]
526 /// An error explaining what went wrong if the connect fails.
527 ///
528 /// @return
529 /// A process object for the connected process.
530 //------------------------------------------------------------------
531 ") ConnectRemote;
532 lldb::SBProcess
533 ConnectRemote (SBListener &listener,
534 const char *url,
535 const char *plugin_name,
536 SBError& error);
537
538 lldb::SBFileSpec
539 GetExecutable ();
540
Greg Claytoncac9c5f2011-09-24 00:52:29 +0000541 bool
542 AddModule (lldb::SBModule &module);
543
544 lldb::SBModule
545 AddModule (const char *path,
546 const char *triple,
547 const char *uuid);
548
Greg Claytonb210aec2012-04-23 20:23:39 +0000549 lldb::SBModule
550 AddModule (const char *path,
551 const char *triple,
552 const char *uuid_cstr,
553 const char *symfile);
554
Greg Clayton226cce22013-07-08 22:22:41 +0000555 lldb::SBModule
556 AddModule (const SBModuleSpec &module_spec);
557
Johnny Chendc7d3c12011-07-16 21:15:39 +0000558 uint32_t
559 GetNumModules () const;
560
561 lldb::SBModule
562 GetModuleAtIndex (uint32_t idx);
563
Greg Claytoncac9c5f2011-09-24 00:52:29 +0000564 bool
565 RemoveModule (lldb::SBModule module);
566
Johnny Chendc7d3c12011-07-16 21:15:39 +0000567 lldb::SBDebugger
568 GetDebugger() const;
569
570 lldb::SBModule
571 FindModule (const lldb::SBFileSpec &file_spec);
572
Greg Clayton13d19502012-01-29 06:07:39 +0000573 lldb::ByteOrder
574 GetByteOrder ();
575
576 uint32_t
577 GetAddressByteSize();
578
579 const char *
580 GetTriple ();
581
Greg Claytoncac9c5f2011-09-24 00:52:29 +0000582 lldb::SBError
583 SetSectionLoadAddress (lldb::SBSection section,
584 lldb::addr_t section_base_addr);
585
586 lldb::SBError
587 ClearSectionLoadAddress (lldb::SBSection section);
588
589 lldb::SBError
590 SetModuleLoadAddress (lldb::SBModule module,
591 int64_t sections_offset);
592
593 lldb::SBError
594 ClearModuleLoadAddress (lldb::SBModule module);
595
Johnny Chendc7d3c12011-07-16 21:15:39 +0000596 %feature("docstring", "
597 //------------------------------------------------------------------
598 /// Find functions by name.
599 ///
600 /// @param[in] name
601 /// The name of the function we are looking for.
602 ///
603 /// @param[in] name_type_mask
604 /// A logical OR of one or more FunctionNameType enum bits that
605 /// indicate what kind of names should be used when doing the
606 /// lookup. Bits include fully qualified names, base names,
607 /// C++ methods, or ObjC selectors.
608 /// See FunctionNameType for more details.
609 ///
Johnny Chendc7d3c12011-07-16 21:15:39 +0000610 /// @return
Greg Clayton5569e642012-02-06 01:44:54 +0000611 /// A lldb::SBSymbolContextList that gets filled in with all of
612 /// the symbol contexts for all the matches.
Johnny Chendc7d3c12011-07-16 21:15:39 +0000613 //------------------------------------------------------------------
614 ") FindFunctions;
Greg Clayton5569e642012-02-06 01:44:54 +0000615 lldb::SBSymbolContextList
Johnny Chendc7d3c12011-07-16 21:15:39 +0000616 FindFunctions (const char *name,
Greg Clayton5569e642012-02-06 01:44:54 +0000617 uint32_t name_type_mask = lldb::eFunctionNameTypeAny);
Enrico Granata6f3533f2011-07-29 19:53:35 +0000618
619 lldb::SBType
620 FindFirstType (const char* type);
621
622 lldb::SBTypeList
623 FindTypes (const char* type);
Johnny Chendc7d3c12011-07-16 21:15:39 +0000624
Greg Claytonb43165b2012-12-05 21:24:42 +0000625 lldb::SBType
626 GetBasicType(lldb::BasicType type);
627
Jim Inghame37d6052011-09-13 00:29:56 +0000628 lldb::SBSourceManager
629 GetSourceManager ();
630
Johnny Chendc7d3c12011-07-16 21:15:39 +0000631 %feature("docstring", "
632 //------------------------------------------------------------------
633 /// Find global and static variables by name.
634 ///
635 /// @param[in] name
636 /// The name of the global or static variable we are looking
637 /// for.
638 ///
639 /// @param[in] max_matches
640 /// Allow the number of matches to be limited to \a max_matches.
641 ///
642 /// @return
643 /// A list of matched variables in an SBValueList.
644 //------------------------------------------------------------------
645 ") FindGlobalVariables;
646 lldb::SBValueList
647 FindGlobalVariables (const char *name,
648 uint32_t max_matches);
649
Enrico Granatabcd80b42013-01-16 18:53:52 +0000650 %feature("docstring", "
651 //------------------------------------------------------------------
652 /// Find the first global (or static) variable by name.
653 ///
654 /// @param[in] name
655 /// The name of the global or static variable we are looking
656 /// for.
657 ///
658 /// @return
659 /// An SBValue that gets filled in with the found variable (if any).
660 //------------------------------------------------------------------
661 ") FindFirstGlobalVariable;
662 lldb::SBValue
663 FindFirstGlobalVariable (const char* name);
664
Carlo Kokb77aba72014-09-19 20:12:24 +0000665
666 lldb::SBValueList
667 FindGlobalVariables(const char *name,
668 uint32_t max_matches,
669 MatchType matchtype);
670
671 lldb::SBSymbolContextList
672 FindGlobalFunctions(const char *name,
673 uint32_t max_matches,
674 MatchType matchtype);
675
Johnny Chendc7d3c12011-07-16 21:15:39 +0000676 void
677 Clear ();
678
Greg Clayton00e6fbf2011-07-22 16:46:35 +0000679 lldb::SBAddress
680 ResolveLoadAddress (lldb::addr_t vm_addr);
Greg Claytond5944cd2013-12-06 01:12:00 +0000681
682 lldb::SBAddress
683 ResolvePastLoadAddress (uint32_t stop_id, lldb::addr_t vm_addr);
Johnny Chendc7d3c12011-07-16 21:15:39 +0000684
685 SBSymbolContext
686 ResolveSymbolContextForAddress (const SBAddress& addr,
687 uint32_t resolve_scope);
688
689 lldb::SBBreakpoint
690 BreakpointCreateByLocation (const char *file, uint32_t line);
691
692 lldb::SBBreakpoint
693 BreakpointCreateByLocation (const lldb::SBFileSpec &file_spec, uint32_t line);
694
695 lldb::SBBreakpoint
696 BreakpointCreateByName (const char *symbol_name, const char *module_name = NULL);
697
698 lldb::SBBreakpoint
Jim Ingham2dd7f7f2011-10-11 01:18:55 +0000699 BreakpointCreateByName (const char *symbol_name,
700 uint32_t func_name_type, // Logical OR one or more FunctionNameType enum bits
701 const SBFileSpecList &module_list,
702 const SBFileSpecList &comp_unit_list);
703
704 lldb::SBBreakpoint
Jim Inghamfab10e82012-03-06 00:37:27 +0000705 BreakpointCreateByNames (const char *symbol_name[],
706 uint32_t num_names,
707 uint32_t name_type_mask, // Logical OR one or more FunctionNameType enum bits
708 const SBFileSpecList &module_list,
709 const SBFileSpecList &comp_unit_list);
710
711 lldb::SBBreakpoint
Johnny Chendc7d3c12011-07-16 21:15:39 +0000712 BreakpointCreateByRegex (const char *symbol_name_regex, const char *module_name = NULL);
713
714 lldb::SBBreakpoint
Jim Ingham969795f2011-09-21 01:17:13 +0000715 BreakpointCreateBySourceRegex (const char *source_regex, const lldb::SBFileSpec &source_file, const char *module_name = NULL);
716
717 lldb::SBBreakpoint
Jim Inghamfab10e82012-03-06 00:37:27 +0000718 BreakpointCreateForException (lldb::LanguageType language,
719 bool catch_bp,
720 bool throw_bp);
721
722 lldb::SBBreakpoint
Johnny Chendc7d3c12011-07-16 21:15:39 +0000723 BreakpointCreateByAddress (addr_t address);
724
725 uint32_t
726 GetNumBreakpoints () const;
727
728 lldb::SBBreakpoint
729 GetBreakpointAtIndex (uint32_t idx) const;
730
731 bool
732 BreakpointDelete (break_id_t break_id);
733
734 lldb::SBBreakpoint
735 FindBreakpointByID (break_id_t break_id);
736
737 bool
738 EnableAllBreakpoints ();
739
740 bool
741 DisableAllBreakpoints ();
742
743 bool
744 DeleteAllBreakpoints ();
745
Johnny Chend4dd7992011-09-27 01:19:20 +0000746 uint32_t
Greg Clayton1b282f92011-10-13 18:08:26 +0000747 GetNumWatchpoints () const;
748
749 lldb::SBWatchpoint
750 GetWatchpointAtIndex (uint32_t idx) const;
751
Johnny Chend4dd7992011-09-27 01:19:20 +0000752 bool
Greg Clayton1b282f92011-10-13 18:08:26 +0000753 DeleteWatchpoint (lldb::watch_id_t watch_id);
754
755 lldb::SBWatchpoint
756 FindWatchpointByID (lldb::watch_id_t watch_id);
757
Johnny Chend4dd7992011-09-27 01:19:20 +0000758 bool
Greg Clayton1b282f92011-10-13 18:08:26 +0000759 EnableAllWatchpoints ();
760
Johnny Chend4dd7992011-09-27 01:19:20 +0000761 bool
Greg Clayton1b282f92011-10-13 18:08:26 +0000762 DisableAllWatchpoints ();
763
Johnny Chend4dd7992011-09-27 01:19:20 +0000764 bool
Greg Clayton1b282f92011-10-13 18:08:26 +0000765 DeleteAllWatchpoints ();
766
767 lldb::SBWatchpoint
768 WatchAddress (lldb::addr_t addr,
769 size_t size,
770 bool read,
Johnny Chenb90827e2012-06-04 23:19:54 +0000771 bool write,
772 SBError &error);
Greg Clayton1b282f92011-10-13 18:08:26 +0000773
Johnny Chend4dd7992011-09-27 01:19:20 +0000774
Johnny Chendc7d3c12011-07-16 21:15:39 +0000775 lldb::SBBroadcaster
776 GetBroadcaster () const;
Enrico Granata347c2aa2013-10-08 21:49:02 +0000777
778 lldb::SBValue
779 CreateValueFromAddress (const char *name, lldb::SBAddress addr, lldb::SBType type);
Sean Callanan50952e92011-12-14 23:49:37 +0000780
781 lldb::SBInstructionList
Greg Clayton9c766112012-03-06 22:24:44 +0000782 ReadInstructions (lldb::SBAddress base_addr, uint32_t count);
783
784 lldb::SBInstructionList
Jim Ingham0f063ba2013-03-02 00:26:47 +0000785 ReadInstructions (lldb::SBAddress base_addr, uint32_t count, const char *flavor_string);
786
787 lldb::SBInstructionList
Sean Callanan50952e92011-12-14 23:49:37 +0000788 GetInstructions (lldb::SBAddress base_addr, const void *buf, size_t size);
789
Jim Ingham0f063ba2013-03-02 00:26:47 +0000790 lldb::SBInstructionList
791 GetInstructionsWithFlavor (lldb::SBAddress base_addr, const char *flavor_string, const void *buf, size_t size);
792
Greg Claytone14e1922012-12-04 02:22:16 +0000793 lldb::SBSymbolContextList
794 FindSymbols (const char *name, lldb::SymbolType type = eSymbolTypeAny);
795
Johnny Chendc7d3c12011-07-16 21:15:39 +0000796 bool
Greg Claytonda7bc7d2011-11-13 06:57:31 +0000797 GetDescription (lldb::SBStream &description, lldb::DescriptionLevel description_level);
Greg Clayton13d19502012-01-29 06:07:39 +0000798
Greg Clayton13fbb992013-02-01 00:47:49 +0000799 lldb::addr_t
800 GetStackRedZoneSize();
801
Enrico Granatac3387332013-05-03 01:29:27 +0000802 bool
803 operator == (const lldb::SBTarget &rhs) const;
804
805 bool
806 operator != (const lldb::SBTarget &rhs) const;
807
Greg Clayton4b63a5c2013-01-04 18:10:18 +0000808 lldb::SBValue
809 EvaluateExpression (const char *expr, const lldb::SBExpressionOptions &options);
Greg Clayton13d19502012-01-29 06:07:39 +0000810 %pythoncode %{
Greg Clayton6b2bd932012-02-01 08:09:32 +0000811 class modules_access(object):
812 '''A helper object that will lazily hand out lldb.SBModule objects for a target when supplied an index, or by full or partial path.'''
813 def __init__(self, sbtarget):
814 self.sbtarget = sbtarget
815
816 def __len__(self):
817 if self.sbtarget:
Filipe Cabecinhas1a96ef82012-05-11 20:39:42 +0000818 return int(self.sbtarget.GetNumModules())
Greg Clayton6b2bd932012-02-01 08:09:32 +0000819 return 0
820
821 def __getitem__(self, key):
822 num_modules = self.sbtarget.GetNumModules()
823 if type(key) is int:
824 if key < num_modules:
825 return self.sbtarget.GetModuleAtIndex(key)
826 elif type(key) is str:
827 if key.find('/') == -1:
828 for idx in range(num_modules):
829 module = self.sbtarget.GetModuleAtIndex(idx)
830 if module.file.basename == key:
831 return module
832 else:
833 for idx in range(num_modules):
834 module = self.sbtarget.GetModuleAtIndex(idx)
835 if module.file.fullpath == key:
836 return module
837 # See if the string is a UUID
Greg Clayton1fb7c622013-03-07 02:58:47 +0000838 try:
839 the_uuid = uuid.UUID(key)
840 if the_uuid:
841 for idx in range(num_modules):
842 module = self.sbtarget.GetModuleAtIndex(idx)
843 if module.uuid == the_uuid:
844 return module
845 except:
846 return None
Greg Clayton6b2bd932012-02-01 08:09:32 +0000847 elif type(key) is uuid.UUID:
848 for idx in range(num_modules):
849 module = self.sbtarget.GetModuleAtIndex(idx)
850 if module.uuid == key:
851 return module
852 elif type(key) is re.SRE_Pattern:
853 matching_modules = []
854 for idx in range(num_modules):
855 module = self.sbtarget.GetModuleAtIndex(idx)
856 re_match = key.search(module.path.fullpath)
857 if re_match:
858 matching_modules.append(module)
859 return matching_modules
860 else:
861 print "error: unsupported item type: %s" % type(key)
862 return None
863
864 def get_modules_access_object(self):
Greg Claytonb62bb8c2012-02-03 03:22:53 +0000865 '''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 +0000866 return self.modules_access (self)
867
868 def get_modules_array(self):
Greg Claytonb62bb8c2012-02-03 03:22:53 +0000869 '''An accessor function that returns a list() that contains all modules in a lldb.SBTarget object.'''
Greg Clayton6b2bd932012-02-01 08:09:32 +0000870 modules = []
871 for idx in range(self.GetNumModules()):
872 modules.append(self.GetModuleAtIndex(idx))
873 return modules
874
875 __swig_getmethods__["modules"] = get_modules_array
Greg Clayton5ef31a92012-06-29 22:00:42 +0000876 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 +0000877
878 __swig_getmethods__["module"] = get_modules_access_object
Greg Clayton5ef31a92012-06-29 22:00:42 +0000879 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 +0000880
Greg Clayton13d19502012-01-29 06:07:39 +0000881 __swig_getmethods__["process"] = GetProcess
Greg Clayton5ef31a92012-06-29 22:00:42 +0000882 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 +0000883
884 __swig_getmethods__["executable"] = GetExecutable
Greg Clayton5ef31a92012-06-29 22:00:42 +0000885 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 +0000886
887 __swig_getmethods__["debugger"] = GetDebugger
Greg Clayton5ef31a92012-06-29 22:00:42 +0000888 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 +0000889
Greg Clayton13d19502012-01-29 06:07:39 +0000890 __swig_getmethods__["num_breakpoints"] = GetNumBreakpoints
Greg Clayton5ef31a92012-06-29 22:00:42 +0000891 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 +0000892
893 __swig_getmethods__["num_watchpoints"] = GetNumWatchpoints
Greg Clayton5ef31a92012-06-29 22:00:42 +0000894 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 +0000895
896 __swig_getmethods__["broadcaster"] = GetBroadcaster
Greg Clayton5ef31a92012-06-29 22:00:42 +0000897 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 +0000898
899 __swig_getmethods__["byte_order"] = GetByteOrder
Greg Clayton5ef31a92012-06-29 22:00:42 +0000900 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 +0000901
902 __swig_getmethods__["addr_size"] = GetAddressByteSize
Greg Clayton5ef31a92012-06-29 22:00:42 +0000903 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 +0000904
905 __swig_getmethods__["triple"] = GetTriple
Greg Clayton5ef31a92012-06-29 22:00:42 +0000906 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 +0000907 %}
908
Johnny Chendc7d3c12011-07-16 21:15:39 +0000909};
910
911} // namespace lldb