1 //===-- Target.h ------------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_Target_h_
11 #define liblldb_Target_h_
17 // Other libraries and framework includes
19 #include "lldb/lldb-public.h"
20 #include "lldb/Breakpoint/BreakpointList.h"
21 #include "lldb/Breakpoint/BreakpointLocationCollection.h"
22 #include "lldb/Breakpoint/WatchpointList.h"
23 #include "lldb/Core/ArchSpec.h"
24 #include "lldb/Core/Broadcaster.h"
25 #include "lldb/Core/Disassembler.h"
26 #include "lldb/Core/Event.h"
27 #include "lldb/Core/ModuleList.h"
28 #include "lldb/Core/UserSettingsController.h"
29 #include "lldb/Expression/ClangPersistentVariables.h"
30 #include "lldb/Interpreter/Args.h"
31 #include "lldb/Interpreter/OptionValueBoolean.h"
32 #include "lldb/Interpreter/OptionValueEnumeration.h"
33 #include "lldb/Interpreter/OptionValueFileSpec.h"
34 #include "lldb/Symbol/SymbolContext.h"
35 #include "lldb/Target/ABI.h"
36 #include "lldb/Target/ExecutionContextScope.h"
37 #include "lldb/Target/PathMappingList.h"
38 #include "lldb/Target/SectionLoadList.h"
40 namespace lldb_private {
42 extern OptionEnumValueElement g_dynamic_value_types[];
44 typedef enum InlineStrategy
46 eInlineBreakpointsNever = 0,
47 eInlineBreakpointsHeaders,
48 eInlineBreakpointsAlways
51 typedef enum LoadScriptFromSymFile
53 eLoadScriptFromSymFileTrue,
54 eLoadScriptFromSymFileFalse,
55 eLoadScriptFromSymFileWarn
56 } LoadScriptFromSymFile;
58 //----------------------------------------------------------------------
60 //----------------------------------------------------------------------
61 class TargetProperties : public Properties
64 TargetProperties(Target *target);
70 GetDefaultArchitecture () const;
73 SetDefaultArchitecture (const ArchSpec& arch);
75 lldb::DynamicValueType
76 GetPreferDynamicValue() const;
79 GetDisableASLR () const;
82 SetDisableASLR (bool b);
85 GetDisableSTDIO () const;
88 SetDisableSTDIO (bool b);
91 GetDisassemblyFlavor() const;
94 // SetDisassemblyFlavor(const char *flavor);
97 GetInlineStrategy () const;
103 SetArg0 (const char *arg);
106 GetRunArguments (Args &args) const;
109 SetRunArguments (const Args &args);
112 GetEnvironmentAsArgs (Args &env) const;
115 GetSkipPrologue() const;
118 GetSourcePathMap () const;
121 GetExecutableSearchPaths ();
124 GetDebugFileSearchPaths ();
127 GetEnableSyntheticValue () const;
130 GetMaximumNumberOfChildrenToDisplay() const;
133 GetMaximumSizeOfStringSummary() const;
136 GetMaximumMemReadSize () const;
139 GetStandardInputPath () const;
142 SetStandardInputPath (const char *path);
145 GetStandardOutputPath () const;
148 SetStandardOutputPath (const char *path);
151 GetStandardErrorPath () const;
154 SetStandardErrorPath (const char *path);
157 GetBreakpointsConsultPlatformAvoidList ();
160 GetExpressionPrefixContentsAsCString ();
163 GetUseHexImmediates() const;
166 GetUseFastStepping() const;
168 LoadScriptFromSymFile
169 GetLoadScriptFromSymbolFile() const;
171 Disassembler::HexImmediateStyle
172 GetHexImmediateStyle() const;
174 MemoryModuleLoadLevel
175 GetMemoryModuleLoadLevel() const;
179 typedef std::shared_ptr<TargetProperties> TargetPropertiesSP;
181 class EvaluateExpressionOptions
184 static const uint32_t default_timeout = 500000;
185 EvaluateExpressionOptions() :
186 m_execution_policy(eExecutionPolicyOnlyWhenNeeded),
187 m_coerce_to_id(false),
188 m_unwind_on_error(true),
189 m_ignore_breakpoints (false),
190 m_keep_in_memory(false),
192 m_use_dynamic(lldb::eNoDynamicValues),
193 m_timeout_usec(default_timeout)
197 GetExecutionPolicy () const
199 return m_execution_policy;
202 EvaluateExpressionOptions&
203 SetExecutionPolicy (ExecutionPolicy policy = eExecutionPolicyAlways)
205 m_execution_policy = policy;
210 DoesCoerceToId () const
212 return m_coerce_to_id;
215 EvaluateExpressionOptions&
216 SetCoerceToId (bool coerce = true)
218 m_coerce_to_id = coerce;
223 DoesUnwindOnError () const
225 return m_unwind_on_error;
228 EvaluateExpressionOptions&
229 SetUnwindOnError (bool unwind = false)
231 m_unwind_on_error = unwind;
236 DoesIgnoreBreakpoints () const
238 return m_ignore_breakpoints;
241 EvaluateExpressionOptions&
242 SetIgnoreBreakpoints (bool ignore = false)
244 m_ignore_breakpoints = ignore;
249 DoesKeepInMemory () const
251 return m_keep_in_memory;
254 EvaluateExpressionOptions&
255 SetKeepInMemory (bool keep = true)
257 m_keep_in_memory = keep;
261 lldb::DynamicValueType
262 GetUseDynamic () const
264 return m_use_dynamic;
267 EvaluateExpressionOptions&
268 SetUseDynamic (lldb::DynamicValueType dynamic = lldb::eDynamicCanRunTarget)
270 m_use_dynamic = dynamic;
275 GetTimeoutUsec () const
277 return m_timeout_usec;
280 EvaluateExpressionOptions&
281 SetTimeoutUsec (uint32_t timeout = 0)
283 m_timeout_usec = timeout;
288 GetRunOthers () const
293 EvaluateExpressionOptions&
294 SetRunOthers (bool run_others = true)
296 m_run_others = run_others;
301 ExecutionPolicy m_execution_policy;
303 bool m_unwind_on_error;
304 bool m_ignore_breakpoints;
305 bool m_keep_in_memory;
307 lldb::DynamicValueType m_use_dynamic;
308 uint32_t m_timeout_usec;
311 //----------------------------------------------------------------------
313 //----------------------------------------------------------------------
315 public std::enable_shared_from_this<Target>,
316 public TargetProperties,
318 public ExecutionContextScope,
319 public ModuleList::Notifier
322 friend class TargetList;
324 //------------------------------------------------------------------
325 /// Broadcaster event bits definitions.
326 //------------------------------------------------------------------
329 eBroadcastBitBreakpointChanged = (1 << 0),
330 eBroadcastBitModulesLoaded = (1 << 1),
331 eBroadcastBitModulesUnloaded = (1 << 2),
332 eBroadcastBitWatchpointChanged = (1 << 3),
333 eBroadcastBitSymbolsLoaded = (1 << 4)
336 // These two functions fill out the Broadcaster interface:
338 static ConstString &GetStaticBroadcasterClass ();
340 virtual ConstString &GetBroadcasterClass() const
342 return GetStaticBroadcasterClass();
345 // This event data class is for use by the TargetList to broadcast new target notifications.
346 class TargetEventData : public EventData
350 static const ConstString &
353 virtual const ConstString &
356 TargetEventData (const lldb::TargetSP &new_target_sp);
368 Dump (Stream *s) const;
370 static const lldb::TargetSP
371 GetTargetFromEvent (const lldb::EventSP &event_sp);
373 static const TargetEventData *
374 GetEventDataFromEvent (const Event *event_sp);
377 lldb::TargetSP m_target_sp;
379 DISALLOW_COPY_AND_ASSIGN (TargetEventData);
383 SettingsInitialize ();
386 SettingsTerminate ();
388 // static lldb::UserSettingsControllerSP &
389 // GetSettingsController ();
392 GetDefaultExecutableSearchPaths ();
395 GetDefaultDebugFileSearchPaths ();
398 GetDefaultArchitecture ();
401 SetDefaultArchitecture (const ArchSpec &arch);
404 // UpdateInstanceName ();
407 GetSharedModule (const ModuleSpec &module_spec,
408 Error *error_ptr = NULL);
410 //----------------------------------------------------------------------
411 // Settings accessors
412 //----------------------------------------------------------------------
414 static const TargetPropertiesSP &
415 GetGlobalProperties();
419 //------------------------------------------------------------------
420 /// Construct with optional file and arch.
422 /// This member is private. Clients must use
423 /// TargetList::CreateTarget(const FileSpec*, const ArchSpec*)
424 /// so all targets can be tracked from the central target list.
426 /// @see TargetList::CreateTarget(const FileSpec*, const ArchSpec*)
427 //------------------------------------------------------------------
428 Target (Debugger &debugger,
429 const ArchSpec &target_arch,
430 const lldb::PlatformSP &platform_sp);
446 DeleteCurrentProcess ();
450 //------------------------------------------------------------------
451 /// Dump a description of this object to a Stream.
453 /// Dump a description of the contents of this object to the
454 /// supplied stream \a s. The dumped content will be only what has
455 /// been loaded or parsed up to this point at which this function
456 /// is called, so this is a good way to see what has been parsed
460 /// The stream to which to dump the object descripton.
461 //------------------------------------------------------------------
463 Dump (Stream *s, lldb::DescriptionLevel description_level);
465 const lldb::ProcessSP &
466 CreateProcess (Listener &listener,
467 const char *plugin_name,
468 const FileSpec *crash_file);
470 const lldb::ProcessSP &
471 GetProcessSP () const;
482 //------------------------------------------------------------------
483 // This part handles the breakpoints.
484 //------------------------------------------------------------------
487 GetBreakpointList(bool internal = false);
489 const BreakpointList &
490 GetBreakpointList(bool internal = false) const;
493 GetLastCreatedBreakpoint ()
495 return m_last_created_breakpoint;
499 GetBreakpointByID (lldb::break_id_t break_id);
501 // Use this to create a file and line breakpoint to a given module or all module it is NULL
503 CreateBreakpoint (const FileSpecList *containingModules,
504 const FileSpec &file,
506 LazyBool check_inlines = eLazyBoolCalculate,
507 LazyBool skip_prologue = eLazyBoolCalculate,
508 bool internal = false);
510 // Use this to create breakpoint that matches regex against the source lines in files given in source_file_list:
512 CreateSourceRegexBreakpoint (const FileSpecList *containingModules,
513 const FileSpecList *source_file_list,
514 RegularExpression &source_regex,
515 bool internal = false);
517 // Use this to create a breakpoint from a load address
519 CreateBreakpoint (lldb::addr_t load_addr,
520 bool internal = false);
522 // Use this to create Address breakpoints:
524 CreateBreakpoint (Address &addr,
525 bool internal = false);
527 // Use this to create a function breakpoint by regexp in containingModule/containingSourceFiles, or all modules if it is NULL
528 // When "skip_prologue is set to eLazyBoolCalculate, we use the current target
529 // setting, else we use the values passed in
531 CreateFuncRegexBreakpoint (const FileSpecList *containingModules,
532 const FileSpecList *containingSourceFiles,
533 RegularExpression &func_regexp,
534 LazyBool skip_prologue = eLazyBoolCalculate,
535 bool internal = false);
537 // Use this to create a function breakpoint by name in containingModule, or all modules if it is NULL
538 // When "skip_prologue is set to eLazyBoolCalculate, we use the current target
539 // setting, else we use the values passed in
541 CreateBreakpoint (const FileSpecList *containingModules,
542 const FileSpecList *containingSourceFiles,
543 const char *func_name,
544 uint32_t func_name_type_mask,
545 LazyBool skip_prologue = eLazyBoolCalculate,
546 bool internal = false);
549 CreateExceptionBreakpoint (enum lldb::LanguageType language, bool catch_bp, bool throw_bp, bool internal = false);
551 // This is the same as the func_name breakpoint except that you can specify a vector of names. This is cheaper
552 // than a regular expression breakpoint in the case where you just want to set a breakpoint on a set of names
555 CreateBreakpoint (const FileSpecList *containingModules,
556 const FileSpecList *containingSourceFiles,
557 const char *func_names[],
559 uint32_t func_name_type_mask,
560 LazyBool skip_prologue = eLazyBoolCalculate,
561 bool internal = false);
564 CreateBreakpoint (const FileSpecList *containingModules,
565 const FileSpecList *containingSourceFiles,
566 const std::vector<std::string> &func_names,
567 uint32_t func_name_type_mask,
568 LazyBool skip_prologue = eLazyBoolCalculate,
569 bool internal = false);
572 // Use this to create a general breakpoint:
574 CreateBreakpoint (lldb::SearchFilterSP &filter_sp,
575 lldb::BreakpointResolverSP &resolver_sp,
576 bool internal = false);
578 // Use this to create a watchpoint:
580 CreateWatchpoint (lldb::addr_t addr,
582 const ClangASTType *type,
587 GetLastCreatedWatchpoint ()
589 return m_last_created_watchpoint;
595 return m_watchpoint_list;
599 RemoveAllBreakpoints (bool internal_also = false);
602 DisableAllBreakpoints (bool internal_also = false);
605 EnableAllBreakpoints (bool internal_also = false);
608 DisableBreakpointByID (lldb::break_id_t break_id);
611 EnableBreakpointByID (lldb::break_id_t break_id);
614 RemoveBreakpointByID (lldb::break_id_t break_id);
616 // The flag 'end_to_end', default to true, signifies that the operation is
617 // performed end to end, for both the debugger and the debuggee.
620 RemoveAllWatchpoints (bool end_to_end = true);
623 DisableAllWatchpoints (bool end_to_end = true);
626 EnableAllWatchpoints (bool end_to_end = true);
629 ClearAllWatchpointHitCounts ();
632 IgnoreAllWatchpoints (uint32_t ignore_count);
635 DisableWatchpointByID (lldb::watch_id_t watch_id);
638 EnableWatchpointByID (lldb::watch_id_t watch_id);
641 RemoveWatchpointByID (lldb::watch_id_t watch_id);
644 IgnoreWatchpointByID (lldb::watch_id_t watch_id, uint32_t ignore_count);
646 //------------------------------------------------------------------
647 /// Get \a load_addr as a callable code load address for this target
649 /// Take \a load_addr and potentially add any address bits that are
650 /// needed to make the address callable. For ARM this can set bit
651 /// zero (if it already isn't) if \a load_addr is a thumb function.
652 /// If \a addr_class is set to eAddressClassInvalid, then the address
653 /// adjustment will always happen. If it is set to an address class
654 /// that doesn't have code in it, LLDB_INVALID_ADDRESS will be
656 //------------------------------------------------------------------
658 GetCallableLoadAddress (lldb::addr_t load_addr, lldb::AddressClass addr_class = lldb::eAddressClassInvalid) const;
660 //------------------------------------------------------------------
661 /// Get \a load_addr as an opcode for this target.
663 /// Take \a load_addr and potentially strip any address bits that are
664 /// needed to make the address point to an opcode. For ARM this can
665 /// clear bit zero (if it already isn't) if \a load_addr is a
666 /// thumb function and load_addr is in code.
667 /// If \a addr_class is set to eAddressClassInvalid, then the address
668 /// adjustment will always happen. If it is set to an address class
669 /// that doesn't have code in it, LLDB_INVALID_ADDRESS will be
671 //------------------------------------------------------------------
673 GetOpcodeLoadAddress (lldb::addr_t load_addr, lldb::AddressClass addr_class = lldb::eAddressClassInvalid) const;
676 //------------------------------------------------------------------
677 /// Implementing of ModuleList::Notifier.
678 //------------------------------------------------------------------
681 ModuleAdded (const ModuleList& module_list, const lldb::ModuleSP& module_sp);
684 ModuleRemoved (const ModuleList& module_list, const lldb::ModuleSP& module_sp);
687 ModuleUpdated (const ModuleList& module_list,
688 const lldb::ModuleSP& old_module_sp,
689 const lldb::ModuleSP& new_module_sp);
691 WillClearList (const ModuleList& module_list);
696 ModulesDidLoad (ModuleList &module_list);
699 ModulesDidUnload (ModuleList &module_list);
702 SymbolsDidLoad (ModuleList &module_list);
704 //------------------------------------------------------------------
705 /// Gets the module for the main executable.
707 /// Each process has a notion of a main executable that is the file
708 /// that will be executed or attached to. Executable files can have
709 /// dependent modules that are discovered from the object files, or
710 /// discovered at runtime as things are dynamically loaded.
713 /// The shared pointer to the executable module which can
714 /// contains a NULL Module object if no executable has been
717 /// @see DynamicLoader
718 /// @see ObjectFile::GetDependentModules (FileSpecList&)
719 /// @see Process::SetExecutableModule(lldb::ModuleSP&)
720 //------------------------------------------------------------------
722 GetExecutableModule ();
725 GetExecutableModulePointer ();
727 //------------------------------------------------------------------
728 /// Set the main executable module.
730 /// Each process has a notion of a main executable that is the file
731 /// that will be executed or attached to. Executable files can have
732 /// dependent modules that are discovered from the object files, or
733 /// discovered at runtime as things are dynamically loaded.
735 /// Setting the executable causes any of the current dependant
736 /// image information to be cleared and replaced with the static
737 /// dependent image information found by calling
738 /// ObjectFile::GetDependentModules (FileSpecList&) on the main
739 /// executable and any modules on which it depends. Calling
740 /// Process::GetImages() will return the newly found images that
741 /// were obtained from all of the object files.
743 /// @param[in] module_sp
744 /// A shared pointer reference to the module that will become
745 /// the main executable for this process.
747 /// @param[in] get_dependent_files
748 /// If \b true then ask the object files to track down any
749 /// known dependent files.
751 /// @see ObjectFile::GetDependentModules (FileSpecList&)
752 /// @see Process::GetImages()
753 //------------------------------------------------------------------
755 SetExecutableModule (lldb::ModuleSP& module_sp, bool get_dependent_files);
758 LoadScriptingResources (std::list<Error>& errors,
759 Stream* feedback_stream = NULL,
760 bool continue_on_error = true)
762 return m_images.LoadScriptingResourcesInTarget(this,errors,feedback_stream,continue_on_error);
765 //------------------------------------------------------------------
766 /// Get accessor for the images for this process.
768 /// Each process has a notion of a main executable that is the file
769 /// that will be executed or attached to. Executable files can have
770 /// dependent modules that are discovered from the object files, or
771 /// discovered at runtime as things are dynamically loaded. After
772 /// a main executable has been set, the images will contain a list
773 /// of all the files that the executable depends upon as far as the
774 /// object files know. These images will usually contain valid file
775 /// virtual addresses only. When the process is launched or attached
776 /// to, the DynamicLoader plug-in will discover where these images
777 /// were loaded in memory and will resolve the load virtual
778 /// addresses is each image, and also in images that are loaded by
782 /// A list of Module objects in a module list.
783 //------------------------------------------------------------------
796 //------------------------------------------------------------------
797 /// Return whether this FileSpec corresponds to a module that should be considered for general searches.
799 /// This API will be consulted by the SearchFilterForNonModuleSpecificSearches
800 /// and any module that returns \b true will not be searched. Note the
801 /// SearchFilterForNonModuleSpecificSearches is the search filter that
802 /// gets used in the CreateBreakpoint calls when no modules is provided.
804 /// The target call at present just consults the Platform's call of the
807 /// @param[in] module_sp
808 /// A shared pointer reference to the module that checked.
810 /// @return \b true if the module should be excluded, \b false otherwise.
811 //------------------------------------------------------------------
813 ModuleIsExcludedForNonModuleSpecificSearches (const FileSpec &module_spec);
815 //------------------------------------------------------------------
816 /// Return whether this module should be considered for general searches.
818 /// This API will be consulted by the SearchFilterForNonModuleSpecificSearches
819 /// and any module that returns \b true will not be searched. Note the
820 /// SearchFilterForNonModuleSpecificSearches is the search filter that
821 /// gets used in the CreateBreakpoint calls when no modules is provided.
823 /// The target call at present just consults the Platform's call of the
826 /// FIXME: When we get time we should add a way for the user to set modules that they
827 /// don't want searched, in addition to or instead of the platform ones.
829 /// @param[in] module_sp
830 /// A shared pointer reference to the module that checked.
832 /// @return \b true if the module should be excluded, \b false otherwise.
833 //------------------------------------------------------------------
835 ModuleIsExcludedForNonModuleSpecificSearches (const lldb::ModuleSP &module_sp);
844 GetArchitecture () const
849 //------------------------------------------------------------------
850 /// Set the architecture for this target.
852 /// If the current target has no Images read in, then this just sets the architecture, which will
853 /// be used to select the architecture of the ExecutableModule when that is set.
854 /// If the current target has an ExecutableModule, then calling SetArchitecture with a different
855 /// architecture from the currently selected one will reset the ExecutableModule to that slice
856 /// of the file backing the ExecutableModule. If the file backing the ExecutableModule does not
857 /// contain a fork of this architecture, then this code will return false, and the architecture
858 /// won't be changed.
859 /// If the input arch_spec is the same as the already set architecture, this is a no-op.
861 /// @param[in] arch_spec
862 /// The new architecture.
865 /// \b true if the architecture was successfully set, \bfalse otherwise.
866 //------------------------------------------------------------------
868 SetArchitecture (const ArchSpec &arch_spec);
877 ReadMemoryFromFileCache (const Address& addr,
882 // Reading memory through the target allows us to skip going to the process
883 // for reading memory if possible and it allows us to try and read from
884 // any constant sections in our object files on disk. If you always want
885 // live program memory, read straight from the process. If you possibly
886 // want to read from const sections in object files, read from the target.
887 // This version of ReadMemory will try and read memory from the process
888 // if the process is alive. The order is:
889 // 1 - if (prefer_file_cache == true) then read from object file cache
890 // 2 - if there is a valid process, try and read from its memory
891 // 3 - if (prefer_file_cache == false) then read from object file cache
893 ReadMemory (const Address& addr,
894 bool prefer_file_cache,
898 lldb::addr_t *load_addr_ptr = NULL);
901 ReadCStringFromMemory (const Address& addr, std::string &out_str, Error &error);
904 ReadCStringFromMemory (const Address& addr, char *dst, size_t dst_max_len, Error &result_error);
907 ReadScalarIntegerFromMemory (const Address& addr,
908 bool prefer_file_cache,
915 ReadUnsignedIntegerFromMemory (const Address& addr,
916 bool prefer_file_cache,
917 size_t integer_byte_size,
922 ReadPointerFromMemory (const Address& addr,
923 bool prefer_file_cache,
925 Address &pointer_addr);
930 return m_section_load_list;
933 const SectionLoadList&
934 GetSectionLoadList() const
936 return m_section_load_list;
940 GetTargetFromContexts (const ExecutionContext *exe_ctx_ptr,
941 const SymbolContext *sc_ptr);
943 //------------------------------------------------------------------
944 // lldb::ExecutionContextScope pure virtual functions
945 //------------------------------------------------------------------
946 virtual lldb::TargetSP
949 virtual lldb::ProcessSP
952 virtual lldb::ThreadSP
955 virtual lldb::StackFrameSP
956 CalculateStackFrame ();
959 CalculateExecutionContext (ExecutionContext &exe_ctx);
962 GetImageSearchPathList ();
965 GetScratchClangASTContext(bool create_on_demand=true);
968 GetClangASTImporter();
971 // Since expressions results can persist beyond the lifetime of a process,
972 // and the const expression results are available after a process is gone,
973 // we provide a way for expressions to be evaluated from the Target itself.
974 // If an expression is going to be run, then it should have a frame filled
975 // in in th execution context.
977 EvaluateExpression (const char *expression,
979 lldb::ValueObjectSP &result_valobj_sp,
980 const EvaluateExpressionOptions& options = EvaluateExpressionOptions());
982 ClangPersistentVariables &
983 GetPersistentVariables()
985 return m_persistent_variables;
988 //------------------------------------------------------------------
990 //------------------------------------------------------------------
991 class StopHook : public UserID
996 StopHook (const StopHook &rhs);
1017 SetCommands (StringList &in_commands)
1019 m_commands = in_commands;
1022 // Set the specifier. The stop hook will own the specifier, and is responsible for deleting it when we're done.
1024 SetSpecifier (SymbolContextSpecifier *specifier)
1026 m_specifier_sp.reset (specifier);
1029 SymbolContextSpecifier *
1032 return m_specifier_sp.get();
1035 // Set the Thread Specifier. The stop hook will own the thread specifier, and is responsible for deleting it when we're done.
1037 SetThreadSpecifier (ThreadSpec *specifier);
1040 GetThreadSpecifier()
1042 return m_thread_spec_ap.get();
1052 SetIsActive (bool is_active)
1054 m_active = is_active;
1058 GetDescription (Stream *s, lldb::DescriptionLevel level) const;
1061 lldb::TargetSP m_target_sp;
1062 StringList m_commands;
1063 lldb::SymbolContextSpecifierSP m_specifier_sp;
1064 std::unique_ptr<ThreadSpec> m_thread_spec_ap;
1067 // Use AddStopHook to make a new empty stop hook. The GetCommandPointer and fill it with commands,
1068 // and SetSpecifier to set the specifier shared pointer (can be null, that will match anything.)
1069 StopHook (lldb::TargetSP target_sp, lldb::user_id_t uid);
1070 friend class Target;
1072 typedef std::shared_ptr<StopHook> StopHookSP;
1074 // Add an empty stop hook to the Target's stop hook list, and returns a shared pointer to it in new_hook.
1075 // Returns the id of the new hook.
1077 AddStopHook (StopHookSP &new_hook);
1086 SetSuppresStopHooks (bool suppress)
1088 bool old_value = m_suppress_stop_hooks;
1089 m_suppress_stop_hooks = suppress;
1094 GetSuppressStopHooks ()
1096 return m_suppress_stop_hooks;
1100 SetSuppressSyntheticValue (bool suppress)
1102 bool old_value = m_suppress_synthetic_value;
1103 m_suppress_synthetic_value = suppress;
1108 GetSuppressSyntheticValue ()
1110 return m_suppress_synthetic_value;
1114 // GetStopHookByIndex (size_t index);
1117 RemoveStopHookByID (lldb::user_id_t uid);
1120 RemoveAllStopHooks ();
1123 GetStopHookByID (lldb::user_id_t uid);
1126 SetStopHookActiveStateByID (lldb::user_id_t uid, bool active_state);
1129 SetAllStopHooksActiveState (bool active_state);
1131 size_t GetNumStopHooks () const
1133 return m_stop_hooks.size();
1137 GetStopHookAtIndex (size_t index)
1139 if (index >= GetNumStopHooks())
1140 return StopHookSP();
1141 StopHookCollection::iterator pos = m_stop_hooks.begin();
1148 return (*pos).second;
1154 return m_platform_sp;
1158 SetPlatform (const lldb::PlatformSP &platform_sp)
1160 m_platform_sp = platform_sp;
1164 GetSourceManager ();
1166 //------------------------------------------------------------------
1168 //------------------------------------------------------------------
1169 lldb::SearchFilterSP
1170 GetSearchFilterForModule (const FileSpec *containingModule);
1172 lldb::SearchFilterSP
1173 GetSearchFilterForModuleList (const FileSpecList *containingModuleList);
1175 lldb::SearchFilterSP
1176 GetSearchFilterForModuleAndCUList (const FileSpecList *containingModules, const FileSpecList *containingSourceFiles);
1179 //------------------------------------------------------------------
1180 // Member variables.
1181 //------------------------------------------------------------------
1182 Debugger & m_debugger;
1183 lldb::PlatformSP m_platform_sp; ///< The platform for this target.
1184 Mutex m_mutex; ///< An API mutex that is used by the lldb::SB* classes make the SB interface thread safe
1186 ModuleList m_images; ///< The list of images for this process (shared libraries and anything dynamically loaded).
1187 SectionLoadList m_section_load_list;
1188 BreakpointList m_breakpoint_list;
1189 BreakpointList m_internal_breakpoint_list;
1190 lldb::BreakpointSP m_last_created_breakpoint;
1191 WatchpointList m_watchpoint_list;
1192 lldb::WatchpointSP m_last_created_watchpoint;
1193 // We want to tightly control the process destruction process so
1194 // we can correctly tear down everything that we need to, so the only
1195 // class that knows about the process lifespan is this target class.
1196 lldb::ProcessSP m_process_sp;
1198 lldb::SearchFilterSP m_search_filter_sp;
1199 PathMappingList m_image_search_paths;
1200 std::unique_ptr<ClangASTContext> m_scratch_ast_context_ap;
1201 std::unique_ptr<ClangASTSource> m_scratch_ast_source_ap;
1202 std::unique_ptr<ClangASTImporter> m_ast_importer_ap;
1203 ClangPersistentVariables m_persistent_variables; ///< These are the persistent variables associated with this process for the expression parser.
1205 std::unique_ptr<SourceManager> m_source_manager_ap;
1207 typedef std::map<lldb::user_id_t, StopHookSP> StopHookCollection;
1208 StopHookCollection m_stop_hooks;
1209 lldb::user_id_t m_stop_hook_next_id;
1210 bool m_suppress_stop_hooks;
1211 bool m_suppress_synthetic_value;
1214 ImageSearchPathsChanged (const PathMappingList &path_list,
1218 DISALLOW_COPY_AND_ASSIGN (Target);
1221 } // namespace lldb_private
1223 #endif // liblldb_Target_h_