blob: d26b3faacee229d3229dd4b20faf0d33e9abfbfc [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);
Greg Claytond5944cd2013-12-06 01:12:00 +0000652
653 lldb::SBAddress
654 ResolvePastLoadAddress (uint32_t stop_id, lldb::addr_t vm_addr);
Johnny Chendc7d3c12011-07-16 21:15:39 +0000655
656 SBSymbolContext
657 ResolveSymbolContextForAddress (const SBAddress& addr,
658 uint32_t resolve_scope);
659
660 lldb::SBBreakpoint
661 BreakpointCreateByLocation (const char *file, uint32_t line);
662
663 lldb::SBBreakpoint
664 BreakpointCreateByLocation (const lldb::SBFileSpec &file_spec, uint32_t line);
665
666 lldb::SBBreakpoint
667 BreakpointCreateByName (const char *symbol_name, const char *module_name = NULL);
668
669 lldb::SBBreakpoint
Jim Ingham2dd7f7f2011-10-11 01:18:55 +0000670 BreakpointCreateByName (const char *symbol_name,
671 uint32_t func_name_type, // Logical OR one or more FunctionNameType enum bits
672 const SBFileSpecList &module_list,
673 const SBFileSpecList &comp_unit_list);
674
675 lldb::SBBreakpoint
Jim Inghamfab10e82012-03-06 00:37:27 +0000676 BreakpointCreateByNames (const char *symbol_name[],
677 uint32_t num_names,
678 uint32_t name_type_mask, // Logical OR one or more FunctionNameType enum bits
679 const SBFileSpecList &module_list,
680 const SBFileSpecList &comp_unit_list);
681
682 lldb::SBBreakpoint
Johnny Chendc7d3c12011-07-16 21:15:39 +0000683 BreakpointCreateByRegex (const char *symbol_name_regex, const char *module_name = NULL);
684
685 lldb::SBBreakpoint
Jim Ingham969795f2011-09-21 01:17:13 +0000686 BreakpointCreateBySourceRegex (const char *source_regex, const lldb::SBFileSpec &source_file, const char *module_name = NULL);
687
688 lldb::SBBreakpoint
Jim Inghamfab10e82012-03-06 00:37:27 +0000689 BreakpointCreateForException (lldb::LanguageType language,
690 bool catch_bp,
691 bool throw_bp);
692
693 lldb::SBBreakpoint
Johnny Chendc7d3c12011-07-16 21:15:39 +0000694 BreakpointCreateByAddress (addr_t address);
695
696 uint32_t
697 GetNumBreakpoints () const;
698
699 lldb::SBBreakpoint
700 GetBreakpointAtIndex (uint32_t idx) const;
701
702 bool
703 BreakpointDelete (break_id_t break_id);
704
705 lldb::SBBreakpoint
706 FindBreakpointByID (break_id_t break_id);
707
708 bool
709 EnableAllBreakpoints ();
710
711 bool
712 DisableAllBreakpoints ();
713
714 bool
715 DeleteAllBreakpoints ();
716
Johnny Chend4dd7992011-09-27 01:19:20 +0000717 uint32_t
Greg Clayton1b282f92011-10-13 18:08:26 +0000718 GetNumWatchpoints () const;
719
720 lldb::SBWatchpoint
721 GetWatchpointAtIndex (uint32_t idx) const;
722
Johnny Chend4dd7992011-09-27 01:19:20 +0000723 bool
Greg Clayton1b282f92011-10-13 18:08:26 +0000724 DeleteWatchpoint (lldb::watch_id_t watch_id);
725
726 lldb::SBWatchpoint
727 FindWatchpointByID (lldb::watch_id_t watch_id);
728
Johnny Chend4dd7992011-09-27 01:19:20 +0000729 bool
Greg Clayton1b282f92011-10-13 18:08:26 +0000730 EnableAllWatchpoints ();
731
Johnny Chend4dd7992011-09-27 01:19:20 +0000732 bool
Greg Clayton1b282f92011-10-13 18:08:26 +0000733 DisableAllWatchpoints ();
734
Johnny Chend4dd7992011-09-27 01:19:20 +0000735 bool
Greg Clayton1b282f92011-10-13 18:08:26 +0000736 DeleteAllWatchpoints ();
737
738 lldb::SBWatchpoint
739 WatchAddress (lldb::addr_t addr,
740 size_t size,
741 bool read,
Johnny Chenb90827e2012-06-04 23:19:54 +0000742 bool write,
743 SBError &error);
Greg Clayton1b282f92011-10-13 18:08:26 +0000744
Johnny Chend4dd7992011-09-27 01:19:20 +0000745
Johnny Chendc7d3c12011-07-16 21:15:39 +0000746 lldb::SBBroadcaster
747 GetBroadcaster () const;
Enrico Granata347c2aa2013-10-08 21:49:02 +0000748
749 lldb::SBValue
750 CreateValueFromAddress (const char *name, lldb::SBAddress addr, lldb::SBType type);
Sean Callanan50952e92011-12-14 23:49:37 +0000751
752 lldb::SBInstructionList
Greg Clayton9c766112012-03-06 22:24:44 +0000753 ReadInstructions (lldb::SBAddress base_addr, uint32_t count);
754
755 lldb::SBInstructionList
Jim Ingham0f063ba2013-03-02 00:26:47 +0000756 ReadInstructions (lldb::SBAddress base_addr, uint32_t count, const char *flavor_string);
757
758 lldb::SBInstructionList
Sean Callanan50952e92011-12-14 23:49:37 +0000759 GetInstructions (lldb::SBAddress base_addr, const void *buf, size_t size);
760
Jim Ingham0f063ba2013-03-02 00:26:47 +0000761 lldb::SBInstructionList
762 GetInstructionsWithFlavor (lldb::SBAddress base_addr, const char *flavor_string, const void *buf, size_t size);
763
Greg Claytone14e1922012-12-04 02:22:16 +0000764 lldb::SBSymbolContextList
765 FindSymbols (const char *name, lldb::SymbolType type = eSymbolTypeAny);
766
Johnny Chendc7d3c12011-07-16 21:15:39 +0000767 bool
Greg Claytonda7bc7d2011-11-13 06:57:31 +0000768 GetDescription (lldb::SBStream &description, lldb::DescriptionLevel description_level);
Greg Clayton13d19502012-01-29 06:07:39 +0000769
Greg Clayton13fbb992013-02-01 00:47:49 +0000770 lldb::addr_t
771 GetStackRedZoneSize();
772
Enrico Granatac3387332013-05-03 01:29:27 +0000773 bool
774 operator == (const lldb::SBTarget &rhs) const;
775
776 bool
777 operator != (const lldb::SBTarget &rhs) const;
778
Greg Clayton4b63a5c2013-01-04 18:10:18 +0000779 lldb::SBValue
780 EvaluateExpression (const char *expr, const lldb::SBExpressionOptions &options);
Greg Clayton13d19502012-01-29 06:07:39 +0000781 %pythoncode %{
Greg Clayton6b2bd932012-02-01 08:09:32 +0000782 class modules_access(object):
783 '''A helper object that will lazily hand out lldb.SBModule objects for a target when supplied an index, or by full or partial path.'''
784 def __init__(self, sbtarget):
785 self.sbtarget = sbtarget
786
787 def __len__(self):
788 if self.sbtarget:
Filipe Cabecinhas1a96ef82012-05-11 20:39:42 +0000789 return int(self.sbtarget.GetNumModules())
Greg Clayton6b2bd932012-02-01 08:09:32 +0000790 return 0
791
792 def __getitem__(self, key):
793 num_modules = self.sbtarget.GetNumModules()
794 if type(key) is int:
795 if key < num_modules:
796 return self.sbtarget.GetModuleAtIndex(key)
797 elif type(key) is str:
798 if key.find('/') == -1:
799 for idx in range(num_modules):
800 module = self.sbtarget.GetModuleAtIndex(idx)
801 if module.file.basename == key:
802 return module
803 else:
804 for idx in range(num_modules):
805 module = self.sbtarget.GetModuleAtIndex(idx)
806 if module.file.fullpath == key:
807 return module
808 # See if the string is a UUID
Greg Clayton1fb7c622013-03-07 02:58:47 +0000809 try:
810 the_uuid = uuid.UUID(key)
811 if the_uuid:
812 for idx in range(num_modules):
813 module = self.sbtarget.GetModuleAtIndex(idx)
814 if module.uuid == the_uuid:
815 return module
816 except:
817 return None
Greg Clayton6b2bd932012-02-01 08:09:32 +0000818 elif type(key) is uuid.UUID:
819 for idx in range(num_modules):
820 module = self.sbtarget.GetModuleAtIndex(idx)
821 if module.uuid == key:
822 return module
823 elif type(key) is re.SRE_Pattern:
824 matching_modules = []
825 for idx in range(num_modules):
826 module = self.sbtarget.GetModuleAtIndex(idx)
827 re_match = key.search(module.path.fullpath)
828 if re_match:
829 matching_modules.append(module)
830 return matching_modules
831 else:
832 print "error: unsupported item type: %s" % type(key)
833 return None
834
835 def get_modules_access_object(self):
Greg Claytonb62bb8c2012-02-03 03:22:53 +0000836 '''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 +0000837 return self.modules_access (self)
838
839 def get_modules_array(self):
Greg Claytonb62bb8c2012-02-03 03:22:53 +0000840 '''An accessor function that returns a list() that contains all modules in a lldb.SBTarget object.'''
Greg Clayton6b2bd932012-02-01 08:09:32 +0000841 modules = []
842 for idx in range(self.GetNumModules()):
843 modules.append(self.GetModuleAtIndex(idx))
844 return modules
845
846 __swig_getmethods__["modules"] = get_modules_array
Greg Clayton5ef31a92012-06-29 22:00:42 +0000847 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 +0000848
849 __swig_getmethods__["module"] = get_modules_access_object
Greg Clayton5ef31a92012-06-29 22:00:42 +0000850 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 +0000851
Greg Clayton13d19502012-01-29 06:07:39 +0000852 __swig_getmethods__["process"] = GetProcess
Greg Clayton5ef31a92012-06-29 22:00:42 +0000853 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 +0000854
855 __swig_getmethods__["executable"] = GetExecutable
Greg Clayton5ef31a92012-06-29 22:00:42 +0000856 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 +0000857
858 __swig_getmethods__["debugger"] = GetDebugger
Greg Clayton5ef31a92012-06-29 22:00:42 +0000859 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 +0000860
Greg Clayton13d19502012-01-29 06:07:39 +0000861 __swig_getmethods__["num_breakpoints"] = GetNumBreakpoints
Greg Clayton5ef31a92012-06-29 22:00:42 +0000862 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 +0000863
864 __swig_getmethods__["num_watchpoints"] = GetNumWatchpoints
Greg Clayton5ef31a92012-06-29 22:00:42 +0000865 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 +0000866
867 __swig_getmethods__["broadcaster"] = GetBroadcaster
Greg Clayton5ef31a92012-06-29 22:00:42 +0000868 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 +0000869
870 __swig_getmethods__["byte_order"] = GetByteOrder
Greg Clayton5ef31a92012-06-29 22:00:42 +0000871 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 +0000872
873 __swig_getmethods__["addr_size"] = GetAddressByteSize
Greg Clayton5ef31a92012-06-29 22:00:42 +0000874 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 +0000875
876 __swig_getmethods__["triple"] = GetTriple
Greg Clayton5ef31a92012-06-29 22:00:42 +0000877 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 +0000878 %}
879
Johnny Chendc7d3c12011-07-16 21:15:39 +0000880};
881
882} // namespace lldb