blob: bbf1f74faa5d736c43c975a1eb3eb2899a610601 [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);
115
Greg Clayton0e615682012-02-24 05:03:03 +0000116};
117
118class SBAttachInfo
119{
120public:
121 SBAttachInfo ();
122
123 SBAttachInfo (lldb::pid_t pid);
124
125 SBAttachInfo (const char *path, bool wait_for);
126
127 SBAttachInfo (const lldb::SBAttachInfo &rhs);
128
129 lldb::pid_t
130 GetProcessID ();
131
132 void
133 SetProcessID (lldb::pid_t pid);
134
135 void
136 SetExecutable (const char *path);
137
138 void
139 SetExecutable (lldb::SBFileSpec exe_file);
140
141 bool
142 GetWaitForLaunch ();
143
144 void
145 SetWaitForLaunch (bool b);
146
Jim Inghamcd16df92012-07-20 21:37:13 +0000147 bool
148 GetIgnoreExisting ();
149
150 void
151 SetIgnoreExisting (bool b);
152
Greg Clayton0e615682012-02-24 05:03:03 +0000153 uint32_t
154 GetResumeCount ();
155
156 void
157 SetResumeCount (uint32_t c);
158
159 const char *
160 GetProcessPluginName ();
161
162 void
163 SetProcessPluginName (const char *plugin_name);
164
165 uint32_t
Greg Clayton41bd8ac2012-02-24 23:56:06 +0000166 GetUserID();
167
168 uint32_t
169 GetGroupID();
170
171 bool
172 UserIDIsValid ();
173
174 bool
175 GroupIDIsValid ();
176
177 void
178 SetUserID (uint32_t uid);
179
180 void
181 SetGroupID (uint32_t gid);
182
183 uint32_t
Greg Clayton0e615682012-02-24 05:03:03 +0000184 GetEffectiveUserID();
185
186 uint32_t
187 GetEffectiveGroupID();
188
189 bool
190 EffectiveUserIDIsValid ();
191
192 bool
193 EffectiveGroupIDIsValid ();
194
195 void
196 SetEffectiveUserID (uint32_t uid);
197
198 void
199 SetEffectiveGroupID (uint32_t gid);
200
201 lldb::pid_t
202 GetParentProcessID ();
203
204 void
205 SetParentProcessID (lldb::pid_t pid);
206
207 bool
208 ParentProcessIDIsValid();
209};
210
211
Johnny Chendc7d3c12011-07-16 21:15:39 +0000212%feature("docstring",
213"Represents the target program running under the debugger.
214
Johnny Chen01a67862011-10-14 00:42:25 +0000215SBTarget supports module, breakpoint, and watchpoint iterations. For example,
Johnny Chendc7d3c12011-07-16 21:15:39 +0000216
217 for m in target.module_iter():
218 print m
219
220produces:
221
222(x86_64) /Volumes/data/lldb/svn/trunk/test/python_api/lldbutil/iter/a.out
223(x86_64) /usr/lib/dyld
224(x86_64) /usr/lib/libstdc++.6.dylib
225(x86_64) /usr/lib/libSystem.B.dylib
226(x86_64) /usr/lib/system/libmathCommon.A.dylib
227(x86_64) /usr/lib/libSystem.B.dylib(__commpage)
228
229and,
230
231 for b in target.breakpoint_iter():
232 print b
233
234produces:
235
236SBBreakpoint: id = 1, file ='main.cpp', line = 66, locations = 1
Johnny Chend4dd7992011-09-27 01:19:20 +0000237SBBreakpoint: id = 2, file ='main.cpp', line = 85, locations = 1
238
239and,
240
Johnny Chen01a67862011-10-14 00:42:25 +0000241 for wp_loc in target.watchpoint_iter():
Johnny Chend4dd7992011-09-27 01:19:20 +0000242 print wp_loc
243
244produces:
245
Johnny Chen01a67862011-10-14 00:42:25 +0000246Watchpoint 1: addr = 0x1034ca048 size = 4 state = enabled type = rw
Johnny Chend4dd7992011-09-27 01:19:20 +0000247 declare @ '/Volumes/data/lldb/svn/trunk/test/python_api/watchpoint/main.c:12'
Johnny Chen01a67862011-10-14 00:42:25 +0000248 hw_index = 0 hit_count = 2 ignore_count = 0"
Johnny Chen357033b2011-07-18 20:13:38 +0000249) SBTarget;
Johnny Chendc7d3c12011-07-16 21:15:39 +0000250class SBTarget
251{
Johnny Chendc7d3c12011-07-16 21:15:39 +0000252public:
253 //------------------------------------------------------------------
254 // Broadcaster bits.
255 //------------------------------------------------------------------
256 enum
257 {
258 eBroadcastBitBreakpointChanged = (1 << 0),
259 eBroadcastBitModulesLoaded = (1 << 1),
Jim Ingham1b5792e2012-12-18 02:03:49 +0000260 eBroadcastBitModulesUnloaded = (1 << 2),
Enrico Granataf15ee4e2013-04-05 18:49:06 +0000261 eBroadcastBitWatchpointChanged = (1 << 3),
262 eBroadcastBitSymbolsLoaded = (1 << 4)
Johnny Chendc7d3c12011-07-16 21:15:39 +0000263 };
264
265 //------------------------------------------------------------------
266 // Constructors
267 //------------------------------------------------------------------
268 SBTarget ();
269
270 SBTarget (const lldb::SBTarget& rhs);
271
Johnny Chendc7d3c12011-07-16 21:15:39 +0000272 //------------------------------------------------------------------
273 // Destructor
274 //------------------------------------------------------------------
275 ~SBTarget();
276
Jim Ingham4bddaeb2012-02-16 06:50:00 +0000277 static const char *
278 GetBroadcasterClassName ();
279
Johnny Chendc7d3c12011-07-16 21:15:39 +0000280 bool
281 IsValid() const;
282
283 lldb::SBProcess
284 GetProcess ();
285
286 %feature("docstring", "
287 //------------------------------------------------------------------
Greg Claytonfbb76342013-11-20 21:07:01 +0000288 /// Install any binaries that need to be installed.
289 ///
290 /// This function does nothing when debugging on the host system.
291 /// When connected to remote platforms, the target's main executable
292 /// and any modules that have their install path set will be
293 /// installed on the remote platform. If the main executable doesn't
294 /// have an install location set, it will be installed in the remote
295 /// platform's working directory.
296 ///
297 /// @return
298 /// An error describing anything that went wrong during
299 /// installation.
300 //------------------------------------------------------------------
301 ") Install;
302 lldb::SBError
303 Install();
304
305 %feature("docstring", "
306 //------------------------------------------------------------------
Johnny Chendc7d3c12011-07-16 21:15:39 +0000307 /// Launch a new process.
308 ///
309 /// Launch a new process by spawning a new process using the
310 /// target object's executable module's file as the file to launch.
311 /// Arguments are given in \a argv, and the environment variables
312 /// are in \a envp. Standard input and output files can be
313 /// optionally re-directed to \a stdin_path, \a stdout_path, and
314 /// \a stderr_path.
315 ///
316 /// @param[in] listener
317 /// An optional listener that will receive all process events.
318 /// If \a listener is valid then \a listener will listen to all
319 /// process events. If not valid, then this target's debugger
320 /// (SBTarget::GetDebugger()) will listen to all process events.
321 ///
322 /// @param[in] argv
323 /// The argument array.
324 ///
325 /// @param[in] envp
326 /// The environment array.
327 ///
328 /// @param[in] launch_flags
329 /// Flags to modify the launch (@see lldb::LaunchFlags)
330 ///
331 /// @param[in] stdin_path
332 /// The path to use when re-directing the STDIN of the new
333 /// process. If all stdXX_path arguments are NULL, a pseudo
334 /// terminal will be used.
335 ///
336 /// @param[in] stdout_path
337 /// The path to use when re-directing the STDOUT of the new
338 /// process. If all stdXX_path arguments are NULL, a pseudo
339 /// terminal will be used.
340 ///
341 /// @param[in] stderr_path
342 /// The path to use when re-directing the STDERR of the new
343 /// process. If all stdXX_path arguments are NULL, a pseudo
344 /// terminal will be used.
345 ///
346 /// @param[in] working_directory
347 /// The working directory to have the child process run in
348 ///
349 /// @param[in] launch_flags
350 /// Some launch options specified by logical OR'ing
351 /// lldb::LaunchFlags enumeration values together.
352 ///
353 /// @param[in] stop_at_endtry
354 /// If false do not stop the inferior at the entry point.
355 ///
356 /// @param[out]
357 /// An error object. Contains the reason if there is some failure.
358 ///
359 /// @return
360 /// A process object for the newly created process.
361 //------------------------------------------------------------------
362
363 For example,
364
365 process = target.Launch(self.dbg.GetListener(), None, None,
366 None, '/tmp/stdout.txt', None,
367 None, 0, False, error)
368
369 launches a new process by passing nothing for both the args and the envs
370 and redirect the standard output of the inferior to the /tmp/stdout.txt
371 file. It does not specify a working directory so that the debug server
372 will use its idea of what the current working directory is for the
373 inferior. Also, we ask the debugger not to stop the inferior at the
374 entry point. If no breakpoint is specified for the inferior, it should
375 run to completion if no user interaction is required.
376 ") Launch;
377 lldb::SBProcess
378 Launch (SBListener &listener,
379 char const **argv,
380 char const **envp,
381 const char *stdin_path,
382 const char *stdout_path,
383 const char *stderr_path,
384 const char *working_directory,
385 uint32_t launch_flags, // See LaunchFlags
386 bool stop_at_entry,
387 lldb::SBError& error);
388
389 %feature("docstring", "
390 //------------------------------------------------------------------
391 /// Launch a new process with sensible defaults.
392 ///
393 /// @param[in] argv
394 /// The argument array.
395 ///
396 /// @param[in] envp
397 /// The environment array.
398 ///
399 /// @param[in] working_directory
400 /// The working directory to have the child process run in
401 ///
402 /// Default: listener
403 /// Set to the target's debugger (SBTarget::GetDebugger())
404 ///
405 /// Default: launch_flags
406 /// Empty launch flags
407 ///
408 /// Default: stdin_path
409 /// Default: stdout_path
410 /// Default: stderr_path
411 /// A pseudo terminal will be used.
412 ///
413 /// @return
414 /// A process object for the newly created process.
415 //------------------------------------------------------------------
416
417 For example,
418
419 process = target.LaunchSimple(['X', 'Y', 'Z'], None, os.getcwd())
420
421 launches a new process by passing 'X', 'Y', 'Z' as the args to the
422 executable.
423 ") LaunchSimple;
424 lldb::SBProcess
425 LaunchSimple (const char **argv,
426 const char **envp,
427 const char *working_directory);
428
Greg Clayton0e615682012-02-24 05:03:03 +0000429 lldb::SBProcess
430 Launch (lldb::SBLaunchInfo &launch_info, lldb::SBError& error);
Greg Clayton4d8ad552013-03-25 22:40:51 +0000431
432 %feature("docstring", "
433 //------------------------------------------------------------------
434 /// Load a core file
435 ///
436 /// @param[in] core_file
437 /// File path of the core dump.
438 ///
439 /// @return
440 /// A process object for the newly created core file.
441 //------------------------------------------------------------------
442
443 For example,
444
445 process = target.LoadCore('./a.out.core')
446
447 loads a new core file and returns the process object.
448 ") LoadCore;
449 lldb::SBProcess
450 LoadCore(const char *core_file);
Greg Clayton0e615682012-02-24 05:03:03 +0000451
452 lldb::SBProcess
453 Attach (lldb::SBAttachInfo &attach_info, lldb::SBError& error);
454
455
Johnny Chendc7d3c12011-07-16 21:15:39 +0000456 %feature("docstring", "
457 //------------------------------------------------------------------
458 /// Attach to process with pid.
459 ///
460 /// @param[in] listener
461 /// An optional listener that will receive all process events.
462 /// If \a listener is valid then \a listener will listen to all
463 /// process events. If not valid, then this target's debugger
464 /// (SBTarget::GetDebugger()) will listen to all process events.
465 ///
466 /// @param[in] pid
467 /// The process ID to attach to.
468 ///
469 /// @param[out]
470 /// An error explaining what went wrong if attach fails.
471 ///
472 /// @return
473 /// A process object for the attached process.
474 //------------------------------------------------------------------
475 ") AttachToProcessWithID;
476 lldb::SBProcess
477 AttachToProcessWithID (SBListener &listener,
478 lldb::pid_t pid,
479 lldb::SBError& error);
480
481 %feature("docstring", "
482 //------------------------------------------------------------------
483 /// Attach to process with name.
484 ///
485 /// @param[in] listener
486 /// An optional listener that will receive all process events.
487 /// If \a listener is valid then \a listener will listen to all
488 /// process events. If not valid, then this target's debugger
489 /// (SBTarget::GetDebugger()) will listen to all process events.
490 ///
491 /// @param[in] name
492 /// Basename of process to attach to.
493 ///
494 /// @param[in] wait_for
495 /// If true wait for a new instance of 'name' to be launched.
496 ///
497 /// @param[out]
498 /// An error explaining what went wrong if attach fails.
499 ///
500 /// @return
501 /// A process object for the attached process.
502 //------------------------------------------------------------------
503 ") AttachToProcessWithName;
504 lldb::SBProcess
505 AttachToProcessWithName (SBListener &listener,
506 const char *name,
507 bool wait_for,
508 lldb::SBError& error);
509
510 %feature("docstring", "
511 //------------------------------------------------------------------
512 /// Connect to a remote debug server with url.
513 ///
514 /// @param[in] listener
515 /// An optional listener that will receive all process events.
516 /// If \a listener is valid then \a listener will listen to all
517 /// process events. If not valid, then this target's debugger
518 /// (SBTarget::GetDebugger()) will listen to all process events.
519 ///
520 /// @param[in] url
521 /// The url to connect to, e.g., 'connect://localhost:12345'.
522 ///
523 /// @param[in] plugin_name
524 /// The plugin name to be used; can be NULL.
525 ///
526 /// @param[out]
527 /// An error explaining what went wrong if the connect fails.
528 ///
529 /// @return
530 /// A process object for the connected process.
531 //------------------------------------------------------------------
532 ") ConnectRemote;
533 lldb::SBProcess
534 ConnectRemote (SBListener &listener,
535 const char *url,
536 const char *plugin_name,
537 SBError& error);
538
539 lldb::SBFileSpec
540 GetExecutable ();
541
Greg Claytoncac9c5f2011-09-24 00:52:29 +0000542 bool
543 AddModule (lldb::SBModule &module);
544
545 lldb::SBModule
546 AddModule (const char *path,
547 const char *triple,
548 const char *uuid);
549
Greg Claytonb210aec2012-04-23 20:23:39 +0000550 lldb::SBModule
551 AddModule (const char *path,
552 const char *triple,
553 const char *uuid_cstr,
554 const char *symfile);
555
Greg Clayton226cce22013-07-08 22:22:41 +0000556 lldb::SBModule
557 AddModule (const SBModuleSpec &module_spec);
558
Johnny Chendc7d3c12011-07-16 21:15:39 +0000559 uint32_t
560 GetNumModules () const;
561
562 lldb::SBModule
563 GetModuleAtIndex (uint32_t idx);
564
Greg Claytoncac9c5f2011-09-24 00:52:29 +0000565 bool
566 RemoveModule (lldb::SBModule module);
567
Johnny Chendc7d3c12011-07-16 21:15:39 +0000568 lldb::SBDebugger
569 GetDebugger() const;
570
571 lldb::SBModule
572 FindModule (const lldb::SBFileSpec &file_spec);
573
Greg Clayton13d19502012-01-29 06:07:39 +0000574 lldb::ByteOrder
575 GetByteOrder ();
576
577 uint32_t
578 GetAddressByteSize();
579
580 const char *
581 GetTriple ();
582
Greg Claytoncac9c5f2011-09-24 00:52:29 +0000583 lldb::SBError
584 SetSectionLoadAddress (lldb::SBSection section,
585 lldb::addr_t section_base_addr);
586
587 lldb::SBError
588 ClearSectionLoadAddress (lldb::SBSection section);
589
590 lldb::SBError
591 SetModuleLoadAddress (lldb::SBModule module,
592 int64_t sections_offset);
593
594 lldb::SBError
595 ClearModuleLoadAddress (lldb::SBModule module);
596
Johnny Chendc7d3c12011-07-16 21:15:39 +0000597 %feature("docstring", "
598 //------------------------------------------------------------------
599 /// Find functions by name.
600 ///
601 /// @param[in] name
602 /// The name of the function we are looking for.
603 ///
604 /// @param[in] name_type_mask
605 /// A logical OR of one or more FunctionNameType enum bits that
606 /// indicate what kind of names should be used when doing the
607 /// lookup. Bits include fully qualified names, base names,
608 /// C++ methods, or ObjC selectors.
609 /// See FunctionNameType for more details.
610 ///
Johnny Chendc7d3c12011-07-16 21:15:39 +0000611 /// @return
Greg Clayton5569e642012-02-06 01:44:54 +0000612 /// A lldb::SBSymbolContextList that gets filled in with all of
613 /// the symbol contexts for all the matches.
Johnny Chendc7d3c12011-07-16 21:15:39 +0000614 //------------------------------------------------------------------
615 ") FindFunctions;
Greg Clayton5569e642012-02-06 01:44:54 +0000616 lldb::SBSymbolContextList
Johnny Chendc7d3c12011-07-16 21:15:39 +0000617 FindFunctions (const char *name,
Greg Clayton5569e642012-02-06 01:44:54 +0000618 uint32_t name_type_mask = lldb::eFunctionNameTypeAny);
Enrico Granata6f3533f2011-07-29 19:53:35 +0000619
620 lldb::SBType
621 FindFirstType (const char* type);
622
623 lldb::SBTypeList
624 FindTypes (const char* type);
Johnny Chendc7d3c12011-07-16 21:15:39 +0000625
Greg Claytonb43165b2012-12-05 21:24:42 +0000626 lldb::SBType
627 GetBasicType(lldb::BasicType type);
628
Jim Inghame37d6052011-09-13 00:29:56 +0000629 lldb::SBSourceManager
630 GetSourceManager ();
631
Johnny Chendc7d3c12011-07-16 21:15:39 +0000632 %feature("docstring", "
633 //------------------------------------------------------------------
634 /// Find global and static variables by name.
635 ///
636 /// @param[in] name
637 /// The name of the global or static variable we are looking
638 /// for.
639 ///
640 /// @param[in] max_matches
641 /// Allow the number of matches to be limited to \a max_matches.
642 ///
643 /// @return
644 /// A list of matched variables in an SBValueList.
645 //------------------------------------------------------------------
646 ") FindGlobalVariables;
647 lldb::SBValueList
648 FindGlobalVariables (const char *name,
649 uint32_t max_matches);
650
Enrico Granatabcd80b42013-01-16 18:53:52 +0000651 %feature("docstring", "
652 //------------------------------------------------------------------
653 /// Find the first global (or static) variable by name.
654 ///
655 /// @param[in] name
656 /// The name of the global or static variable we are looking
657 /// for.
658 ///
659 /// @return
660 /// An SBValue that gets filled in with the found variable (if any).
661 //------------------------------------------------------------------
662 ") FindFirstGlobalVariable;
663 lldb::SBValue
664 FindFirstGlobalVariable (const char* name);
665
Johnny Chendc7d3c12011-07-16 21:15:39 +0000666 void
667 Clear ();
668
Greg Clayton00e6fbf2011-07-22 16:46:35 +0000669 lldb::SBAddress
670 ResolveLoadAddress (lldb::addr_t vm_addr);
Greg Claytond5944cd2013-12-06 01:12:00 +0000671
672 lldb::SBAddress
673 ResolvePastLoadAddress (uint32_t stop_id, lldb::addr_t vm_addr);
Johnny Chendc7d3c12011-07-16 21:15:39 +0000674
675 SBSymbolContext
676 ResolveSymbolContextForAddress (const SBAddress& addr,
677 uint32_t resolve_scope);
678
679 lldb::SBBreakpoint
680 BreakpointCreateByLocation (const char *file, uint32_t line);
681
682 lldb::SBBreakpoint
683 BreakpointCreateByLocation (const lldb::SBFileSpec &file_spec, uint32_t line);
684
685 lldb::SBBreakpoint
686 BreakpointCreateByName (const char *symbol_name, const char *module_name = NULL);
687
688 lldb::SBBreakpoint
Jim Ingham2dd7f7f2011-10-11 01:18:55 +0000689 BreakpointCreateByName (const char *symbol_name,
690 uint32_t func_name_type, // Logical OR one or more FunctionNameType enum bits
691 const SBFileSpecList &module_list,
692 const SBFileSpecList &comp_unit_list);
693
694 lldb::SBBreakpoint
Jim Inghamfab10e82012-03-06 00:37:27 +0000695 BreakpointCreateByNames (const char *symbol_name[],
696 uint32_t num_names,
697 uint32_t name_type_mask, // Logical OR one or more FunctionNameType enum bits
698 const SBFileSpecList &module_list,
699 const SBFileSpecList &comp_unit_list);
700
701 lldb::SBBreakpoint
Johnny Chendc7d3c12011-07-16 21:15:39 +0000702 BreakpointCreateByRegex (const char *symbol_name_regex, const char *module_name = NULL);
703
704 lldb::SBBreakpoint
Jim Ingham969795f2011-09-21 01:17:13 +0000705 BreakpointCreateBySourceRegex (const char *source_regex, const lldb::SBFileSpec &source_file, const char *module_name = NULL);
706
707 lldb::SBBreakpoint
Jim Inghamfab10e82012-03-06 00:37:27 +0000708 BreakpointCreateForException (lldb::LanguageType language,
709 bool catch_bp,
710 bool throw_bp);
711
712 lldb::SBBreakpoint
Johnny Chendc7d3c12011-07-16 21:15:39 +0000713 BreakpointCreateByAddress (addr_t address);
714
715 uint32_t
716 GetNumBreakpoints () const;
717
718 lldb::SBBreakpoint
719 GetBreakpointAtIndex (uint32_t idx) const;
720
721 bool
722 BreakpointDelete (break_id_t break_id);
723
724 lldb::SBBreakpoint
725 FindBreakpointByID (break_id_t break_id);
726
727 bool
728 EnableAllBreakpoints ();
729
730 bool
731 DisableAllBreakpoints ();
732
733 bool
734 DeleteAllBreakpoints ();
735
Johnny Chend4dd7992011-09-27 01:19:20 +0000736 uint32_t
Greg Clayton1b282f92011-10-13 18:08:26 +0000737 GetNumWatchpoints () const;
738
739 lldb::SBWatchpoint
740 GetWatchpointAtIndex (uint32_t idx) const;
741
Johnny Chend4dd7992011-09-27 01:19:20 +0000742 bool
Greg Clayton1b282f92011-10-13 18:08:26 +0000743 DeleteWatchpoint (lldb::watch_id_t watch_id);
744
745 lldb::SBWatchpoint
746 FindWatchpointByID (lldb::watch_id_t watch_id);
747
Johnny Chend4dd7992011-09-27 01:19:20 +0000748 bool
Greg Clayton1b282f92011-10-13 18:08:26 +0000749 EnableAllWatchpoints ();
750
Johnny Chend4dd7992011-09-27 01:19:20 +0000751 bool
Greg Clayton1b282f92011-10-13 18:08:26 +0000752 DisableAllWatchpoints ();
753
Johnny Chend4dd7992011-09-27 01:19:20 +0000754 bool
Greg Clayton1b282f92011-10-13 18:08:26 +0000755 DeleteAllWatchpoints ();
756
757 lldb::SBWatchpoint
758 WatchAddress (lldb::addr_t addr,
759 size_t size,
760 bool read,
Johnny Chenb90827e2012-06-04 23:19:54 +0000761 bool write,
762 SBError &error);
Greg Clayton1b282f92011-10-13 18:08:26 +0000763
Johnny Chend4dd7992011-09-27 01:19:20 +0000764
Johnny Chendc7d3c12011-07-16 21:15:39 +0000765 lldb::SBBroadcaster
766 GetBroadcaster () const;
Enrico Granata347c2aa2013-10-08 21:49:02 +0000767
768 lldb::SBValue
769 CreateValueFromAddress (const char *name, lldb::SBAddress addr, lldb::SBType type);
Sean Callanan50952e92011-12-14 23:49:37 +0000770
771 lldb::SBInstructionList
Greg Clayton9c766112012-03-06 22:24:44 +0000772 ReadInstructions (lldb::SBAddress base_addr, uint32_t count);
773
774 lldb::SBInstructionList
Jim Ingham0f063ba2013-03-02 00:26:47 +0000775 ReadInstructions (lldb::SBAddress base_addr, uint32_t count, const char *flavor_string);
776
777 lldb::SBInstructionList
Sean Callanan50952e92011-12-14 23:49:37 +0000778 GetInstructions (lldb::SBAddress base_addr, const void *buf, size_t size);
779
Jim Ingham0f063ba2013-03-02 00:26:47 +0000780 lldb::SBInstructionList
781 GetInstructionsWithFlavor (lldb::SBAddress base_addr, const char *flavor_string, const void *buf, size_t size);
782
Greg Claytone14e1922012-12-04 02:22:16 +0000783 lldb::SBSymbolContextList
784 FindSymbols (const char *name, lldb::SymbolType type = eSymbolTypeAny);
785
Johnny Chendc7d3c12011-07-16 21:15:39 +0000786 bool
Greg Claytonda7bc7d2011-11-13 06:57:31 +0000787 GetDescription (lldb::SBStream &description, lldb::DescriptionLevel description_level);
Greg Clayton13d19502012-01-29 06:07:39 +0000788
Greg Clayton13fbb992013-02-01 00:47:49 +0000789 lldb::addr_t
790 GetStackRedZoneSize();
791
Enrico Granatac3387332013-05-03 01:29:27 +0000792 bool
793 operator == (const lldb::SBTarget &rhs) const;
794
795 bool
796 operator != (const lldb::SBTarget &rhs) const;
797
Greg Clayton4b63a5c2013-01-04 18:10:18 +0000798 lldb::SBValue
799 EvaluateExpression (const char *expr, const lldb::SBExpressionOptions &options);
Greg Clayton13d19502012-01-29 06:07:39 +0000800 %pythoncode %{
Greg Clayton6b2bd932012-02-01 08:09:32 +0000801 class modules_access(object):
802 '''A helper object that will lazily hand out lldb.SBModule objects for a target when supplied an index, or by full or partial path.'''
803 def __init__(self, sbtarget):
804 self.sbtarget = sbtarget
805
806 def __len__(self):
807 if self.sbtarget:
Filipe Cabecinhas1a96ef82012-05-11 20:39:42 +0000808 return int(self.sbtarget.GetNumModules())
Greg Clayton6b2bd932012-02-01 08:09:32 +0000809 return 0
810
811 def __getitem__(self, key):
812 num_modules = self.sbtarget.GetNumModules()
813 if type(key) is int:
814 if key < num_modules:
815 return self.sbtarget.GetModuleAtIndex(key)
816 elif type(key) is str:
817 if key.find('/') == -1:
818 for idx in range(num_modules):
819 module = self.sbtarget.GetModuleAtIndex(idx)
820 if module.file.basename == key:
821 return module
822 else:
823 for idx in range(num_modules):
824 module = self.sbtarget.GetModuleAtIndex(idx)
825 if module.file.fullpath == key:
826 return module
827 # See if the string is a UUID
Greg Clayton1fb7c622013-03-07 02:58:47 +0000828 try:
829 the_uuid = uuid.UUID(key)
830 if the_uuid:
831 for idx in range(num_modules):
832 module = self.sbtarget.GetModuleAtIndex(idx)
833 if module.uuid == the_uuid:
834 return module
835 except:
836 return None
Greg Clayton6b2bd932012-02-01 08:09:32 +0000837 elif type(key) is uuid.UUID:
838 for idx in range(num_modules):
839 module = self.sbtarget.GetModuleAtIndex(idx)
840 if module.uuid == key:
841 return module
842 elif type(key) is re.SRE_Pattern:
843 matching_modules = []
844 for idx in range(num_modules):
845 module = self.sbtarget.GetModuleAtIndex(idx)
846 re_match = key.search(module.path.fullpath)
847 if re_match:
848 matching_modules.append(module)
849 return matching_modules
850 else:
851 print "error: unsupported item type: %s" % type(key)
852 return None
853
854 def get_modules_access_object(self):
Greg Claytonb62bb8c2012-02-03 03:22:53 +0000855 '''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 +0000856 return self.modules_access (self)
857
858 def get_modules_array(self):
Greg Claytonb62bb8c2012-02-03 03:22:53 +0000859 '''An accessor function that returns a list() that contains all modules in a lldb.SBTarget object.'''
Greg Clayton6b2bd932012-02-01 08:09:32 +0000860 modules = []
861 for idx in range(self.GetNumModules()):
862 modules.append(self.GetModuleAtIndex(idx))
863 return modules
864
865 __swig_getmethods__["modules"] = get_modules_array
Greg Clayton5ef31a92012-06-29 22:00:42 +0000866 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 +0000867
868 __swig_getmethods__["module"] = get_modules_access_object
Greg Clayton5ef31a92012-06-29 22:00:42 +0000869 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 +0000870
Greg Clayton13d19502012-01-29 06:07:39 +0000871 __swig_getmethods__["process"] = GetProcess
Greg Clayton5ef31a92012-06-29 22:00:42 +0000872 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 +0000873
874 __swig_getmethods__["executable"] = GetExecutable
Greg Clayton5ef31a92012-06-29 22:00:42 +0000875 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 +0000876
877 __swig_getmethods__["debugger"] = GetDebugger
Greg Clayton5ef31a92012-06-29 22:00:42 +0000878 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 +0000879
Greg Clayton13d19502012-01-29 06:07:39 +0000880 __swig_getmethods__["num_breakpoints"] = GetNumBreakpoints
Greg Clayton5ef31a92012-06-29 22:00:42 +0000881 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 +0000882
883 __swig_getmethods__["num_watchpoints"] = GetNumWatchpoints
Greg Clayton5ef31a92012-06-29 22:00:42 +0000884 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 +0000885
886 __swig_getmethods__["broadcaster"] = GetBroadcaster
Greg Clayton5ef31a92012-06-29 22:00:42 +0000887 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 +0000888
889 __swig_getmethods__["byte_order"] = GetByteOrder
Greg Clayton5ef31a92012-06-29 22:00:42 +0000890 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 +0000891
892 __swig_getmethods__["addr_size"] = GetAddressByteSize
Greg Clayton5ef31a92012-06-29 22:00:42 +0000893 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 +0000894
895 __swig_getmethods__["triple"] = GetTriple
Greg Clayton5ef31a92012-06-29 22:00:42 +0000896 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 +0000897 %}
898
Johnny Chendc7d3c12011-07-16 21:15:39 +0000899};
900
901} // namespace lldb