blob: 92518fee6020ae3a917075e437c553fd49149070 [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);
97};
98
99class SBAttachInfo
100{
101public:
102 SBAttachInfo ();
103
104 SBAttachInfo (lldb::pid_t pid);
105
106 SBAttachInfo (const char *path, bool wait_for);
107
108 SBAttachInfo (const lldb::SBAttachInfo &rhs);
109
110 lldb::pid_t
111 GetProcessID ();
112
113 void
114 SetProcessID (lldb::pid_t pid);
115
116 void
117 SetExecutable (const char *path);
118
119 void
120 SetExecutable (lldb::SBFileSpec exe_file);
121
122 bool
123 GetWaitForLaunch ();
124
125 void
126 SetWaitForLaunch (bool b);
127
Jim Inghamcd16df92012-07-20 21:37:13 +0000128 bool
129 GetIgnoreExisting ();
130
131 void
132 SetIgnoreExisting (bool b);
133
Greg Clayton0e615682012-02-24 05:03:03 +0000134 uint32_t
135 GetResumeCount ();
136
137 void
138 SetResumeCount (uint32_t c);
139
140 const char *
141 GetProcessPluginName ();
142
143 void
144 SetProcessPluginName (const char *plugin_name);
145
146 uint32_t
Greg Clayton41bd8ac2012-02-24 23:56:06 +0000147 GetUserID();
148
149 uint32_t
150 GetGroupID();
151
152 bool
153 UserIDIsValid ();
154
155 bool
156 GroupIDIsValid ();
157
158 void
159 SetUserID (uint32_t uid);
160
161 void
162 SetGroupID (uint32_t gid);
163
164 uint32_t
Greg Clayton0e615682012-02-24 05:03:03 +0000165 GetEffectiveUserID();
166
167 uint32_t
168 GetEffectiveGroupID();
169
170 bool
171 EffectiveUserIDIsValid ();
172
173 bool
174 EffectiveGroupIDIsValid ();
175
176 void
177 SetEffectiveUserID (uint32_t uid);
178
179 void
180 SetEffectiveGroupID (uint32_t gid);
181
182 lldb::pid_t
183 GetParentProcessID ();
184
185 void
186 SetParentProcessID (lldb::pid_t pid);
187
188 bool
189 ParentProcessIDIsValid();
190};
191
192
Johnny Chendc7d3c12011-07-16 21:15:39 +0000193%feature("docstring",
194"Represents the target program running under the debugger.
195
Johnny Chen01a67862011-10-14 00:42:25 +0000196SBTarget supports module, breakpoint, and watchpoint iterations. For example,
Johnny Chendc7d3c12011-07-16 21:15:39 +0000197
198 for m in target.module_iter():
199 print m
200
201produces:
202
203(x86_64) /Volumes/data/lldb/svn/trunk/test/python_api/lldbutil/iter/a.out
204(x86_64) /usr/lib/dyld
205(x86_64) /usr/lib/libstdc++.6.dylib
206(x86_64) /usr/lib/libSystem.B.dylib
207(x86_64) /usr/lib/system/libmathCommon.A.dylib
208(x86_64) /usr/lib/libSystem.B.dylib(__commpage)
209
210and,
211
212 for b in target.breakpoint_iter():
213 print b
214
215produces:
216
217SBBreakpoint: id = 1, file ='main.cpp', line = 66, locations = 1
Johnny Chend4dd7992011-09-27 01:19:20 +0000218SBBreakpoint: id = 2, file ='main.cpp', line = 85, locations = 1
219
220and,
221
Johnny Chen01a67862011-10-14 00:42:25 +0000222 for wp_loc in target.watchpoint_iter():
Johnny Chend4dd7992011-09-27 01:19:20 +0000223 print wp_loc
224
225produces:
226
Johnny Chen01a67862011-10-14 00:42:25 +0000227Watchpoint 1: addr = 0x1034ca048 size = 4 state = enabled type = rw
Johnny Chend4dd7992011-09-27 01:19:20 +0000228 declare @ '/Volumes/data/lldb/svn/trunk/test/python_api/watchpoint/main.c:12'
Johnny Chen01a67862011-10-14 00:42:25 +0000229 hw_index = 0 hit_count = 2 ignore_count = 0"
Johnny Chen357033b2011-07-18 20:13:38 +0000230) SBTarget;
Johnny Chendc7d3c12011-07-16 21:15:39 +0000231class SBTarget
232{
Johnny Chendc7d3c12011-07-16 21:15:39 +0000233public:
234 //------------------------------------------------------------------
235 // Broadcaster bits.
236 //------------------------------------------------------------------
237 enum
238 {
239 eBroadcastBitBreakpointChanged = (1 << 0),
240 eBroadcastBitModulesLoaded = (1 << 1),
Jim Ingham1b5792e2012-12-18 02:03:49 +0000241 eBroadcastBitModulesUnloaded = (1 << 2),
Enrico Granataf15ee4e2013-04-05 18:49:06 +0000242 eBroadcastBitWatchpointChanged = (1 << 3),
243 eBroadcastBitSymbolsLoaded = (1 << 4)
Johnny Chendc7d3c12011-07-16 21:15:39 +0000244 };
245
246 //------------------------------------------------------------------
247 // Constructors
248 //------------------------------------------------------------------
249 SBTarget ();
250
251 SBTarget (const lldb::SBTarget& rhs);
252
Johnny Chendc7d3c12011-07-16 21:15:39 +0000253 //------------------------------------------------------------------
254 // Destructor
255 //------------------------------------------------------------------
256 ~SBTarget();
257
Jim Ingham4bddaeb2012-02-16 06:50:00 +0000258 static const char *
259 GetBroadcasterClassName ();
260
Johnny Chendc7d3c12011-07-16 21:15:39 +0000261 bool
262 IsValid() const;
263
264 lldb::SBProcess
265 GetProcess ();
266
267 %feature("docstring", "
268 //------------------------------------------------------------------
Greg Claytonfbb76342013-11-20 21:07:01 +0000269 /// Install any binaries that need to be installed.
270 ///
271 /// This function does nothing when debugging on the host system.
272 /// When connected to remote platforms, the target's main executable
273 /// and any modules that have their install path set will be
274 /// installed on the remote platform. If the main executable doesn't
275 /// have an install location set, it will be installed in the remote
276 /// platform's working directory.
277 ///
278 /// @return
279 /// An error describing anything that went wrong during
280 /// installation.
281 //------------------------------------------------------------------
282 ") Install;
283 lldb::SBError
284 Install();
285
286 %feature("docstring", "
287 //------------------------------------------------------------------
Johnny Chendc7d3c12011-07-16 21:15:39 +0000288 /// Launch a new process.
289 ///
290 /// Launch a new process by spawning a new process using the
291 /// target object's executable module's file as the file to launch.
292 /// Arguments are given in \a argv, and the environment variables
293 /// are in \a envp. Standard input and output files can be
294 /// optionally re-directed to \a stdin_path, \a stdout_path, and
295 /// \a stderr_path.
296 ///
297 /// @param[in] listener
298 /// An optional listener that will receive all process events.
299 /// If \a listener is valid then \a listener will listen to all
300 /// process events. If not valid, then this target's debugger
301 /// (SBTarget::GetDebugger()) will listen to all process events.
302 ///
303 /// @param[in] argv
304 /// The argument array.
305 ///
306 /// @param[in] envp
307 /// The environment array.
308 ///
309 /// @param[in] launch_flags
310 /// Flags to modify the launch (@see lldb::LaunchFlags)
311 ///
312 /// @param[in] stdin_path
313 /// The path to use when re-directing the STDIN of the new
314 /// process. If all stdXX_path arguments are NULL, a pseudo
315 /// terminal will be used.
316 ///
317 /// @param[in] stdout_path
318 /// The path to use when re-directing the STDOUT of the new
319 /// process. If all stdXX_path arguments are NULL, a pseudo
320 /// terminal will be used.
321 ///
322 /// @param[in] stderr_path
323 /// The path to use when re-directing the STDERR of the new
324 /// process. If all stdXX_path arguments are NULL, a pseudo
325 /// terminal will be used.
326 ///
327 /// @param[in] working_directory
328 /// The working directory to have the child process run in
329 ///
330 /// @param[in] launch_flags
331 /// Some launch options specified by logical OR'ing
332 /// lldb::LaunchFlags enumeration values together.
333 ///
334 /// @param[in] stop_at_endtry
335 /// If false do not stop the inferior at the entry point.
336 ///
337 /// @param[out]
338 /// An error object. Contains the reason if there is some failure.
339 ///
340 /// @return
341 /// A process object for the newly created process.
342 //------------------------------------------------------------------
343
344 For example,
345
346 process = target.Launch(self.dbg.GetListener(), None, None,
347 None, '/tmp/stdout.txt', None,
348 None, 0, False, error)
349
350 launches a new process by passing nothing for both the args and the envs
351 and redirect the standard output of the inferior to the /tmp/stdout.txt
352 file. It does not specify a working directory so that the debug server
353 will use its idea of what the current working directory is for the
354 inferior. Also, we ask the debugger not to stop the inferior at the
355 entry point. If no breakpoint is specified for the inferior, it should
356 run to completion if no user interaction is required.
357 ") Launch;
358 lldb::SBProcess
359 Launch (SBListener &listener,
360 char const **argv,
361 char const **envp,
362 const char *stdin_path,
363 const char *stdout_path,
364 const char *stderr_path,
365 const char *working_directory,
366 uint32_t launch_flags, // See LaunchFlags
367 bool stop_at_entry,
368 lldb::SBError& error);
369
370 %feature("docstring", "
371 //------------------------------------------------------------------
372 /// Launch a new process with sensible defaults.
373 ///
374 /// @param[in] argv
375 /// The argument array.
376 ///
377 /// @param[in] envp
378 /// The environment array.
379 ///
380 /// @param[in] working_directory
381 /// The working directory to have the child process run in
382 ///
383 /// Default: listener
384 /// Set to the target's debugger (SBTarget::GetDebugger())
385 ///
386 /// Default: launch_flags
387 /// Empty launch flags
388 ///
389 /// Default: stdin_path
390 /// Default: stdout_path
391 /// Default: stderr_path
392 /// A pseudo terminal will be used.
393 ///
394 /// @return
395 /// A process object for the newly created process.
396 //------------------------------------------------------------------
397
398 For example,
399
400 process = target.LaunchSimple(['X', 'Y', 'Z'], None, os.getcwd())
401
402 launches a new process by passing 'X', 'Y', 'Z' as the args to the
403 executable.
404 ") LaunchSimple;
405 lldb::SBProcess
406 LaunchSimple (const char **argv,
407 const char **envp,
408 const char *working_directory);
409
Greg Clayton0e615682012-02-24 05:03:03 +0000410 lldb::SBProcess
411 Launch (lldb::SBLaunchInfo &launch_info, lldb::SBError& error);
Greg Clayton4d8ad552013-03-25 22:40:51 +0000412
413 %feature("docstring", "
414 //------------------------------------------------------------------
415 /// Load a core file
416 ///
417 /// @param[in] core_file
418 /// File path of the core dump.
419 ///
420 /// @return
421 /// A process object for the newly created core file.
422 //------------------------------------------------------------------
423
424 For example,
425
426 process = target.LoadCore('./a.out.core')
427
428 loads a new core file and returns the process object.
429 ") LoadCore;
430 lldb::SBProcess
431 LoadCore(const char *core_file);
Greg Clayton0e615682012-02-24 05:03:03 +0000432
433 lldb::SBProcess
434 Attach (lldb::SBAttachInfo &attach_info, lldb::SBError& error);
435
436
Johnny Chendc7d3c12011-07-16 21:15:39 +0000437 %feature("docstring", "
438 //------------------------------------------------------------------
439 /// Attach to process with pid.
440 ///
441 /// @param[in] listener
442 /// An optional listener that will receive all process events.
443 /// If \a listener is valid then \a listener will listen to all
444 /// process events. If not valid, then this target's debugger
445 /// (SBTarget::GetDebugger()) will listen to all process events.
446 ///
447 /// @param[in] pid
448 /// The process ID to attach to.
449 ///
450 /// @param[out]
451 /// An error explaining what went wrong if attach fails.
452 ///
453 /// @return
454 /// A process object for the attached process.
455 //------------------------------------------------------------------
456 ") AttachToProcessWithID;
457 lldb::SBProcess
458 AttachToProcessWithID (SBListener &listener,
459 lldb::pid_t pid,
460 lldb::SBError& error);
461
462 %feature("docstring", "
463 //------------------------------------------------------------------
464 /// Attach to process with name.
465 ///
466 /// @param[in] listener
467 /// An optional listener that will receive all process events.
468 /// If \a listener is valid then \a listener will listen to all
469 /// process events. If not valid, then this target's debugger
470 /// (SBTarget::GetDebugger()) will listen to all process events.
471 ///
472 /// @param[in] name
473 /// Basename of process to attach to.
474 ///
475 /// @param[in] wait_for
476 /// If true wait for a new instance of 'name' to be launched.
477 ///
478 /// @param[out]
479 /// An error explaining what went wrong if attach fails.
480 ///
481 /// @return
482 /// A process object for the attached process.
483 //------------------------------------------------------------------
484 ") AttachToProcessWithName;
485 lldb::SBProcess
486 AttachToProcessWithName (SBListener &listener,
487 const char *name,
488 bool wait_for,
489 lldb::SBError& error);
490
491 %feature("docstring", "
492 //------------------------------------------------------------------
493 /// Connect to a remote debug server with url.
494 ///
495 /// @param[in] listener
496 /// An optional listener that will receive all process events.
497 /// If \a listener is valid then \a listener will listen to all
498 /// process events. If not valid, then this target's debugger
499 /// (SBTarget::GetDebugger()) will listen to all process events.
500 ///
501 /// @param[in] url
502 /// The url to connect to, e.g., 'connect://localhost:12345'.
503 ///
504 /// @param[in] plugin_name
505 /// The plugin name to be used; can be NULL.
506 ///
507 /// @param[out]
508 /// An error explaining what went wrong if the connect fails.
509 ///
510 /// @return
511 /// A process object for the connected process.
512 //------------------------------------------------------------------
513 ") ConnectRemote;
514 lldb::SBProcess
515 ConnectRemote (SBListener &listener,
516 const char *url,
517 const char *plugin_name,
518 SBError& error);
519
520 lldb::SBFileSpec
521 GetExecutable ();
522
Greg Claytoncac9c5f2011-09-24 00:52:29 +0000523 bool
524 AddModule (lldb::SBModule &module);
525
526 lldb::SBModule
527 AddModule (const char *path,
528 const char *triple,
529 const char *uuid);
530
Greg Claytonb210aec2012-04-23 20:23:39 +0000531 lldb::SBModule
532 AddModule (const char *path,
533 const char *triple,
534 const char *uuid_cstr,
535 const char *symfile);
536
Greg Clayton226cce22013-07-08 22:22:41 +0000537 lldb::SBModule
538 AddModule (const SBModuleSpec &module_spec);
539
Johnny Chendc7d3c12011-07-16 21:15:39 +0000540 uint32_t
541 GetNumModules () const;
542
543 lldb::SBModule
544 GetModuleAtIndex (uint32_t idx);
545
Greg Claytoncac9c5f2011-09-24 00:52:29 +0000546 bool
547 RemoveModule (lldb::SBModule module);
548
Johnny Chendc7d3c12011-07-16 21:15:39 +0000549 lldb::SBDebugger
550 GetDebugger() const;
551
552 lldb::SBModule
553 FindModule (const lldb::SBFileSpec &file_spec);
554
Greg Clayton13d19502012-01-29 06:07:39 +0000555 lldb::ByteOrder
556 GetByteOrder ();
557
558 uint32_t
559 GetAddressByteSize();
560
561 const char *
562 GetTriple ();
563
Greg Claytoncac9c5f2011-09-24 00:52:29 +0000564 lldb::SBError
565 SetSectionLoadAddress (lldb::SBSection section,
566 lldb::addr_t section_base_addr);
567
568 lldb::SBError
569 ClearSectionLoadAddress (lldb::SBSection section);
570
571 lldb::SBError
572 SetModuleLoadAddress (lldb::SBModule module,
573 int64_t sections_offset);
574
575 lldb::SBError
576 ClearModuleLoadAddress (lldb::SBModule module);
577
Johnny Chendc7d3c12011-07-16 21:15:39 +0000578 %feature("docstring", "
579 //------------------------------------------------------------------
580 /// Find functions by name.
581 ///
582 /// @param[in] name
583 /// The name of the function we are looking for.
584 ///
585 /// @param[in] name_type_mask
586 /// A logical OR of one or more FunctionNameType enum bits that
587 /// indicate what kind of names should be used when doing the
588 /// lookup. Bits include fully qualified names, base names,
589 /// C++ methods, or ObjC selectors.
590 /// See FunctionNameType for more details.
591 ///
Johnny Chendc7d3c12011-07-16 21:15:39 +0000592 /// @return
Greg Clayton5569e642012-02-06 01:44:54 +0000593 /// A lldb::SBSymbolContextList that gets filled in with all of
594 /// the symbol contexts for all the matches.
Johnny Chendc7d3c12011-07-16 21:15:39 +0000595 //------------------------------------------------------------------
596 ") FindFunctions;
Greg Clayton5569e642012-02-06 01:44:54 +0000597 lldb::SBSymbolContextList
Johnny Chendc7d3c12011-07-16 21:15:39 +0000598 FindFunctions (const char *name,
Greg Clayton5569e642012-02-06 01:44:54 +0000599 uint32_t name_type_mask = lldb::eFunctionNameTypeAny);
Enrico Granata6f3533f2011-07-29 19:53:35 +0000600
601 lldb::SBType
602 FindFirstType (const char* type);
603
604 lldb::SBTypeList
605 FindTypes (const char* type);
Johnny Chendc7d3c12011-07-16 21:15:39 +0000606
Greg Claytonb43165b2012-12-05 21:24:42 +0000607 lldb::SBType
608 GetBasicType(lldb::BasicType type);
609
Jim Inghame37d6052011-09-13 00:29:56 +0000610 lldb::SBSourceManager
611 GetSourceManager ();
612
Johnny Chendc7d3c12011-07-16 21:15:39 +0000613 %feature("docstring", "
614 //------------------------------------------------------------------
615 /// Find global and static variables by name.
616 ///
617 /// @param[in] name
618 /// The name of the global or static variable we are looking
619 /// for.
620 ///
621 /// @param[in] max_matches
622 /// Allow the number of matches to be limited to \a max_matches.
623 ///
624 /// @return
625 /// A list of matched variables in an SBValueList.
626 //------------------------------------------------------------------
627 ") FindGlobalVariables;
628 lldb::SBValueList
629 FindGlobalVariables (const char *name,
630 uint32_t max_matches);
631
Enrico Granatabcd80b42013-01-16 18:53:52 +0000632 %feature("docstring", "
633 //------------------------------------------------------------------
634 /// Find the first global (or static) variable by name.
635 ///
636 /// @param[in] name
637 /// The name of the global or static variable we are looking
638 /// for.
639 ///
640 /// @return
641 /// An SBValue that gets filled in with the found variable (if any).
642 //------------------------------------------------------------------
643 ") FindFirstGlobalVariable;
644 lldb::SBValue
645 FindFirstGlobalVariable (const char* name);
646
Johnny Chendc7d3c12011-07-16 21:15:39 +0000647 void
648 Clear ();
649
Greg Clayton00e6fbf2011-07-22 16:46:35 +0000650 lldb::SBAddress
651 ResolveLoadAddress (lldb::addr_t vm_addr);
Johnny Chendc7d3c12011-07-16 21:15:39 +0000652
653 SBSymbolContext
654 ResolveSymbolContextForAddress (const SBAddress& addr,
655 uint32_t resolve_scope);
656
657 lldb::SBBreakpoint
658 BreakpointCreateByLocation (const char *file, uint32_t line);
659
660 lldb::SBBreakpoint
661 BreakpointCreateByLocation (const lldb::SBFileSpec &file_spec, uint32_t line);
662
663 lldb::SBBreakpoint
664 BreakpointCreateByName (const char *symbol_name, const char *module_name = NULL);
665
666 lldb::SBBreakpoint
Jim Ingham2dd7f7f2011-10-11 01:18:55 +0000667 BreakpointCreateByName (const char *symbol_name,
668 uint32_t func_name_type, // Logical OR one or more FunctionNameType enum bits
669 const SBFileSpecList &module_list,
670 const SBFileSpecList &comp_unit_list);
671
672 lldb::SBBreakpoint
Jim Inghamfab10e82012-03-06 00:37:27 +0000673 BreakpointCreateByNames (const char *symbol_name[],
674 uint32_t num_names,
675 uint32_t name_type_mask, // Logical OR one or more FunctionNameType enum bits
676 const SBFileSpecList &module_list,
677 const SBFileSpecList &comp_unit_list);
678
679 lldb::SBBreakpoint
Johnny Chendc7d3c12011-07-16 21:15:39 +0000680 BreakpointCreateByRegex (const char *symbol_name_regex, const char *module_name = NULL);
681
682 lldb::SBBreakpoint
Jim Ingham969795f2011-09-21 01:17:13 +0000683 BreakpointCreateBySourceRegex (const char *source_regex, const lldb::SBFileSpec &source_file, const char *module_name = NULL);
684
685 lldb::SBBreakpoint
Jim Inghamfab10e82012-03-06 00:37:27 +0000686 BreakpointCreateForException (lldb::LanguageType language,
687 bool catch_bp,
688 bool throw_bp);
689
690 lldb::SBBreakpoint
Johnny Chendc7d3c12011-07-16 21:15:39 +0000691 BreakpointCreateByAddress (addr_t address);
692
693 uint32_t
694 GetNumBreakpoints () const;
695
696 lldb::SBBreakpoint
697 GetBreakpointAtIndex (uint32_t idx) const;
698
699 bool
700 BreakpointDelete (break_id_t break_id);
701
702 lldb::SBBreakpoint
703 FindBreakpointByID (break_id_t break_id);
704
705 bool
706 EnableAllBreakpoints ();
707
708 bool
709 DisableAllBreakpoints ();
710
711 bool
712 DeleteAllBreakpoints ();
713
Johnny Chend4dd7992011-09-27 01:19:20 +0000714 uint32_t
Greg Clayton1b282f92011-10-13 18:08:26 +0000715 GetNumWatchpoints () const;
716
717 lldb::SBWatchpoint
718 GetWatchpointAtIndex (uint32_t idx) const;
719
Johnny Chend4dd7992011-09-27 01:19:20 +0000720 bool
Greg Clayton1b282f92011-10-13 18:08:26 +0000721 DeleteWatchpoint (lldb::watch_id_t watch_id);
722
723 lldb::SBWatchpoint
724 FindWatchpointByID (lldb::watch_id_t watch_id);
725
Johnny Chend4dd7992011-09-27 01:19:20 +0000726 bool
Greg Clayton1b282f92011-10-13 18:08:26 +0000727 EnableAllWatchpoints ();
728
Johnny Chend4dd7992011-09-27 01:19:20 +0000729 bool
Greg Clayton1b282f92011-10-13 18:08:26 +0000730 DisableAllWatchpoints ();
731
Johnny Chend4dd7992011-09-27 01:19:20 +0000732 bool
Greg Clayton1b282f92011-10-13 18:08:26 +0000733 DeleteAllWatchpoints ();
734
735 lldb::SBWatchpoint
736 WatchAddress (lldb::addr_t addr,
737 size_t size,
738 bool read,
Johnny Chenb90827e2012-06-04 23:19:54 +0000739 bool write,
740 SBError &error);
Greg Clayton1b282f92011-10-13 18:08:26 +0000741
Johnny Chend4dd7992011-09-27 01:19:20 +0000742
Johnny Chendc7d3c12011-07-16 21:15:39 +0000743 lldb::SBBroadcaster
744 GetBroadcaster () const;
Enrico Granata347c2aa2013-10-08 21:49:02 +0000745
746 lldb::SBValue
747 CreateValueFromAddress (const char *name, lldb::SBAddress addr, lldb::SBType type);
Sean Callanan50952e92011-12-14 23:49:37 +0000748
749 lldb::SBInstructionList
Greg Clayton9c766112012-03-06 22:24:44 +0000750 ReadInstructions (lldb::SBAddress base_addr, uint32_t count);
751
752 lldb::SBInstructionList
Jim Ingham0f063ba2013-03-02 00:26:47 +0000753 ReadInstructions (lldb::SBAddress base_addr, uint32_t count, const char *flavor_string);
754
755 lldb::SBInstructionList
Sean Callanan50952e92011-12-14 23:49:37 +0000756 GetInstructions (lldb::SBAddress base_addr, const void *buf, size_t size);
757
Jim Ingham0f063ba2013-03-02 00:26:47 +0000758 lldb::SBInstructionList
759 GetInstructionsWithFlavor (lldb::SBAddress base_addr, const char *flavor_string, const void *buf, size_t size);
760
Greg Claytone14e1922012-12-04 02:22:16 +0000761 lldb::SBSymbolContextList
762 FindSymbols (const char *name, lldb::SymbolType type = eSymbolTypeAny);
763
Johnny Chendc7d3c12011-07-16 21:15:39 +0000764 bool
Greg Claytonda7bc7d2011-11-13 06:57:31 +0000765 GetDescription (lldb::SBStream &description, lldb::DescriptionLevel description_level);
Greg Clayton13d19502012-01-29 06:07:39 +0000766
Greg Clayton13fbb992013-02-01 00:47:49 +0000767 lldb::addr_t
768 GetStackRedZoneSize();
769
Enrico Granatac3387332013-05-03 01:29:27 +0000770 bool
771 operator == (const lldb::SBTarget &rhs) const;
772
773 bool
774 operator != (const lldb::SBTarget &rhs) const;
775
Greg Clayton4b63a5c2013-01-04 18:10:18 +0000776 lldb::SBValue
777 EvaluateExpression (const char *expr, const lldb::SBExpressionOptions &options);
Greg Clayton13d19502012-01-29 06:07:39 +0000778 %pythoncode %{
Greg Clayton6b2bd932012-02-01 08:09:32 +0000779 class modules_access(object):
780 '''A helper object that will lazily hand out lldb.SBModule objects for a target when supplied an index, or by full or partial path.'''
781 def __init__(self, sbtarget):
782 self.sbtarget = sbtarget
783
784 def __len__(self):
785 if self.sbtarget:
Filipe Cabecinhas1a96ef82012-05-11 20:39:42 +0000786 return int(self.sbtarget.GetNumModules())
Greg Clayton6b2bd932012-02-01 08:09:32 +0000787 return 0
788
789 def __getitem__(self, key):
790 num_modules = self.sbtarget.GetNumModules()
791 if type(key) is int:
792 if key < num_modules:
793 return self.sbtarget.GetModuleAtIndex(key)
794 elif type(key) is str:
795 if key.find('/') == -1:
796 for idx in range(num_modules):
797 module = self.sbtarget.GetModuleAtIndex(idx)
798 if module.file.basename == key:
799 return module
800 else:
801 for idx in range(num_modules):
802 module = self.sbtarget.GetModuleAtIndex(idx)
803 if module.file.fullpath == key:
804 return module
805 # See if the string is a UUID
Greg Clayton1fb7c622013-03-07 02:58:47 +0000806 try:
807 the_uuid = uuid.UUID(key)
808 if the_uuid:
809 for idx in range(num_modules):
810 module = self.sbtarget.GetModuleAtIndex(idx)
811 if module.uuid == the_uuid:
812 return module
813 except:
814 return None
Greg Clayton6b2bd932012-02-01 08:09:32 +0000815 elif type(key) is uuid.UUID:
816 for idx in range(num_modules):
817 module = self.sbtarget.GetModuleAtIndex(idx)
818 if module.uuid == key:
819 return module
820 elif type(key) is re.SRE_Pattern:
821 matching_modules = []
822 for idx in range(num_modules):
823 module = self.sbtarget.GetModuleAtIndex(idx)
824 re_match = key.search(module.path.fullpath)
825 if re_match:
826 matching_modules.append(module)
827 return matching_modules
828 else:
829 print "error: unsupported item type: %s" % type(key)
830 return None
831
832 def get_modules_access_object(self):
Greg Claytonb62bb8c2012-02-03 03:22:53 +0000833 '''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 +0000834 return self.modules_access (self)
835
836 def get_modules_array(self):
Greg Claytonb62bb8c2012-02-03 03:22:53 +0000837 '''An accessor function that returns a list() that contains all modules in a lldb.SBTarget object.'''
Greg Clayton6b2bd932012-02-01 08:09:32 +0000838 modules = []
839 for idx in range(self.GetNumModules()):
840 modules.append(self.GetModuleAtIndex(idx))
841 return modules
842
843 __swig_getmethods__["modules"] = get_modules_array
Greg Clayton5ef31a92012-06-29 22:00:42 +0000844 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 +0000845
846 __swig_getmethods__["module"] = get_modules_access_object
Greg Clayton5ef31a92012-06-29 22:00:42 +0000847 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 +0000848
Greg Clayton13d19502012-01-29 06:07:39 +0000849 __swig_getmethods__["process"] = GetProcess
Greg Clayton5ef31a92012-06-29 22:00:42 +0000850 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 +0000851
852 __swig_getmethods__["executable"] = GetExecutable
Greg Clayton5ef31a92012-06-29 22:00:42 +0000853 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 +0000854
855 __swig_getmethods__["debugger"] = GetDebugger
Greg Clayton5ef31a92012-06-29 22:00:42 +0000856 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 +0000857
Greg Clayton13d19502012-01-29 06:07:39 +0000858 __swig_getmethods__["num_breakpoints"] = GetNumBreakpoints
Greg Clayton5ef31a92012-06-29 22:00:42 +0000859 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 +0000860
861 __swig_getmethods__["num_watchpoints"] = GetNumWatchpoints
Greg Clayton5ef31a92012-06-29 22:00:42 +0000862 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 +0000863
864 __swig_getmethods__["broadcaster"] = GetBroadcaster
Greg Clayton5ef31a92012-06-29 22:00:42 +0000865 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 +0000866
867 __swig_getmethods__["byte_order"] = GetByteOrder
Greg Clayton5ef31a92012-06-29 22:00:42 +0000868 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 +0000869
870 __swig_getmethods__["addr_size"] = GetAddressByteSize
Greg Clayton5ef31a92012-06-29 22:00:42 +0000871 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 +0000872
873 __swig_getmethods__["triple"] = GetTriple
Greg Clayton5ef31a92012-06-29 22:00:42 +0000874 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 +0000875 %}
876
Johnny Chendc7d3c12011-07-16 21:15:39 +0000877};
878
879} // namespace lldb