LLDB mainline
Target.h
Go to the documentation of this file.
1//===-- Target.h ------------------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_TARGET_TARGET_H
10#define LLDB_TARGET_TARGET_H
11
12#include <list>
13#include <map>
14#include <memory>
15#include <mutex>
16#include <optional>
17#include <string>
18#include <type_traits>
19#include <utility>
20#include <vector>
21
25#include "lldb/Core/Address.h"
48#include "lldb/Utility/Stream.h"
51#include "lldb/Utility/UUID.h"
52#include "lldb/lldb-public.h"
53#include "llvm/ADT/DenseSet.h"
54#include "llvm/ADT/MapVector.h"
55#include "llvm/ADT/StringRef.h"
56#include "llvm/Support/Casting.h"
57
58namespace lldb_private {
59
61
67
74
80
86
93
95
100
102public:
103 TargetProperties(Target *target);
104
106
108
109 void SetDefaultArchitecture(const ArchSpec &arch);
110
111 bool GetMoveToNearestCode() const;
112
114
116
117 bool GetPreloadSymbols() const;
118
119 void SetPreloadSymbols(bool b);
120
121 bool GetDisableASLR() const;
122
123 void SetDisableASLR(bool b);
124
125 bool GetInheritTCC() const;
126
127 void SetInheritTCC(bool b);
128
129 bool GetDetachOnError() const;
130
131 void SetDetachOnError(bool b);
132
133 bool GetDisableSTDIO() const;
134
135 void SetDisableSTDIO(bool b);
136
137 llvm::StringRef GetLaunchWorkingDirectory() const;
138
139 bool GetParallelModuleLoad() const;
140
141 const char *GetDisassemblyFlavor() const;
142
143 const char *GetDisassemblyCPU() const;
144
145 const char *GetDisassemblyFeatures() const;
146
148
150
151 llvm::StringRef GetArg0() const;
152
153 void SetArg0(llvm::StringRef arg);
154
155 bool GetRunArguments(Args &args) const;
156
157 void SetRunArguments(const Args &args);
158
159 // Get the whole environment including the platform inherited environment and
160 // the target specific environment, excluding the unset environment variables.
162 // Get the platform inherited environment, excluding the unset environment
163 // variables.
165 // Get the target specific environment only, without the platform inherited
166 // environment.
168 // Set the target specific environment.
169 void SetEnvironment(Environment env);
170
171 bool GetSkipPrologue() const;
172
174
176
177 bool GetAutoSourceMapRelative() const;
178
180
182
184
186
188
190
192
193 bool GetEnableAutoApplyFixIts() const;
194
195 uint64_t GetNumberOfRetriesWithFixits() const;
196
197 bool GetEnableNotifyAboutFixIts() const;
198
200
201 JITEngine GetJITEngine() const;
202
203 bool GetEnableSyntheticValue() const;
204
206
207 uint32_t GetMaxZeroPaddingInFloatFormat() const;
208
210
211 /// Get the max depth value, augmented with a bool to indicate whether the
212 /// depth is the default.
213 ///
214 /// When the user has customized the max depth, the bool will be false.
215 ///
216 /// \returns the max depth, and true if the max depth is the system default,
217 /// otherwise false.
218 std::pair<uint32_t, bool> GetMaximumDepthOfChildrenToDisplay() const;
219
220 uint32_t GetMaximumSizeOfStringSummary() const;
221
222 uint32_t GetMaximumMemReadSize() const;
223
227
228 void SetStandardInputPath(llvm::StringRef path);
229 void SetStandardOutputPath(llvm::StringRef path);
230 void SetStandardErrorPath(llvm::StringRef path);
231
232 void SetStandardInputPath(const char *path) = delete;
233 void SetStandardOutputPath(const char *path) = delete;
234 void SetStandardErrorPath(const char *path) = delete;
235
238
240
241 llvm::StringRef GetExpressionPrefixContents();
242
243 uint64_t GetExprErrorLimit() const;
244
245 uint64_t GetExprAllocAddress() const;
246
247 uint64_t GetExprAllocSize() const;
248
249 uint64_t GetExprAllocAlign() const;
250
251 bool GetUseHexImmediates() const;
252
253 bool GetUseFastStepping() const;
254
256
258
259 /// Set the target-wide target.load-script-from-symbol-file setting.
260 /// See \c SetAutoLoadScriptsForModule for overriding this setting
261 /// per-module.
263
265
267
269
270 bool GetUserSpecifiedTrapHandlerNames(Args &args) const;
271
272 void SetUserSpecifiedTrapHandlerNames(const Args &args);
273
275
277
279
281
283
284 void SetProcessLaunchInfo(const ProcessLaunchInfo &launch_info);
285
286 bool GetInjectLocalVariables(ExecutionContext *exe_ctx) const;
287
288 bool GetUseDILForCreatingValues() const;
289
290 bool GetReloadModuleScripts() const;
291
292 void SetUseDILForCreatingValues(bool b);
293
295
297
298 bool GetAutoInstallMainExecutable() const;
299
301
302 void SetDebugUtilityExpression(bool debug);
303
304 bool GetDebugUtilityExpression() const;
305
306 void SetCheckValueObjectOwnership(bool check);
307
308 bool GetCheckValueObjectOwnership() const;
309
310 std::optional<LoadScriptFromSymFile>
311 GetAutoLoadScriptsForModule(llvm::StringRef module_name) const;
312
313 /// Set the \c LoadScriptFromSymFile for a module called \c module_name
314 /// (excluding file extension). LLDB will prefer this over the target-wide
315 /// target.load-script-from-symbol-file setting
316 /// (see \c SetLoadScriptFromSymbolFile).
317 void SetAutoLoadScriptsForModule(llvm::StringRef module_name,
318 LoadScriptFromSymFile load_style);
319
320private:
321 std::optional<bool>
322 GetExperimentalPropertyValue(size_t prop_idx,
323 ExecutionContext *exe_ctx = nullptr) const;
324
325 // Callbacks for m_launch_info.
336
337 // Settings checker for target.jit-save-objects-dir:
338 void CheckJITObjectsDir();
339
341
342 // Member variables.
344 std::unique_ptr<TargetExperimentalProperties> m_experimental_properties_up;
346};
347
349public:
351
352// MSVC has a bug here that reports C4268: 'const' static/global data
353// initialized with compiler generated default constructor fills the object
354// with zeros. Confirmed that MSVC is *not* zero-initializing, it's just a
355// bogus warning.
356#if defined(_MSC_VER)
357#pragma warning(push)
358#pragma warning(disable : 4268)
359#endif
360 static constexpr std::chrono::milliseconds default_timeout{500};
361#if defined(_MSC_VER)
362#pragma warning(pop)
363#endif
364
367
369
373
375
376 void SetLanguage(lldb::LanguageType language_type) {
377 m_language = SourceLanguage(language_type);
378 }
379
381 m_preferred_lookup_contexts = std::move(contexts);
382 }
383
387
388 /// Set the language using a pair of language code and version as
389 /// defined by the DWARF 6 specification.
390 /// WARNING: These codes may change until DWARF 6 is finalized.
391 void SetLanguage(uint16_t name, uint32_t version) {
392 m_language = SourceLanguage(name, version);
393 }
394
395 bool DoesCoerceToId() const { return m_coerce_to_id; }
396
397 const char *GetPrefix() const {
398 return (m_prefix.empty() ? nullptr : m_prefix.c_str());
399 }
400
401 void SetPrefix(const char *prefix) {
402 if (prefix && prefix[0])
403 m_prefix = prefix;
404 else
405 m_prefix.clear();
406 }
407
408 void SetCoerceToId(bool coerce = true) { m_coerce_to_id = coerce; }
409
410 bool DoesUnwindOnError() const { return m_unwind_on_error; }
411
412 void SetUnwindOnError(bool unwind = false) { m_unwind_on_error = unwind; }
413
415
416 void SetIgnoreBreakpoints(bool ignore = false) {
417 m_ignore_breakpoints = ignore;
418 }
419
420 bool DoesKeepInMemory() const { return m_keep_in_memory; }
421
422 void SetKeepInMemory(bool keep = true) { m_keep_in_memory = keep; }
423
425
426 void
430
431 const Timeout<std::micro> &GetTimeout() const { return m_timeout; }
432
433 void SetTimeout(const Timeout<std::micro> &timeout) { m_timeout = timeout; }
434
438
440 m_one_thread_timeout = timeout;
441 }
442
443 bool GetTryAllThreads() const { return m_try_others; }
444
445 void SetTryAllThreads(bool try_others = true) { m_try_others = try_others; }
446
447 bool GetStopOthers() const { return m_stop_others; }
448
449 void SetStopOthers(bool stop_others = true) { m_stop_others = stop_others; }
450
451 bool GetDebug() const { return m_debug; }
452
453 void SetDebug(bool b) {
454 m_debug = b;
455 if (m_debug)
457 }
458
460
462
463 bool GetColorizeErrors() const { return m_ansi_color_errors; }
464
466
467 bool GetTrapExceptions() const { return m_trap_exceptions; }
468
470
471 bool GetStopOnFork() const { return m_stop_on_fork; }
472
473 void SetStopOnFork(bool b) { m_stop_on_fork = b; }
474
475 bool GetREPLEnabled() const { return m_repl; }
476
477 void SetREPLEnabled(bool b) { m_repl = b; }
478
481 m_cancel_callback = callback;
482 }
483
485 return ((m_cancel_callback != nullptr)
487 : false);
488 }
489
490 // Allows the expression contents to be remapped to point to the specified
491 // file and line using #line directives.
492 void SetPoundLine(const char *path, uint32_t line) const {
493 if (path && path[0]) {
494 m_pound_line_file = path;
495 m_pound_line_line = line;
496 } else {
497 m_pound_line_file.clear();
499 }
500 }
501
502 const char *GetPoundLineFilePath() const {
503 return (m_pound_line_file.empty() ? nullptr : m_pound_line_file.c_str());
504 }
505
506 uint32_t GetPoundLineLine() const { return m_pound_line_line; }
507
509
513
515
517
518 void SetRetriesWithFixIts(uint64_t number_of_retries) {
519 m_retries_with_fixits = number_of_retries;
520 }
521
522 uint64_t GetRetriesWithFixIts() const { return m_retries_with_fixits; }
523
525
527
528 /// Set language-plugin specific option called \c option_name to
529 /// the specified boolean \c value.
530 llvm::Error SetBooleanLanguageOption(llvm::StringRef option_name, bool value);
531
532 /// Get the language-plugin specific boolean option called \c option_name.
533 ///
534 /// If the option doesn't exist or is not a boolean option, returns false.
535 /// Otherwise returns the boolean value of the option.
536 llvm::Expected<bool>
537 GetBooleanLanguageOption(llvm::StringRef option_name) const;
538
539 void SetCppIgnoreContextQualifiers(bool value);
540
542
543 void SetTryDILFirst(bool b) { m_try_DIL_first = b; }
544
545 bool GetTryDILFirst() const { return m_try_DIL_first; }
546
547private:
549
551
554 std::string m_prefix;
555 bool m_coerce_to_id = false;
556 bool m_unwind_on_error = true;
558 bool m_keep_in_memory = false;
559 bool m_try_others = true;
560 bool m_stop_others = true;
561 bool m_debug = false;
562 bool m_trap_exceptions = true;
563 bool m_stop_on_fork = false;
564 bool m_repl = false;
570 /// True if the executed code should be treated as utility code that is only
571 /// used by LLDB internally.
573 /// If enabled, Data Inspection Language (DIL) should attempt to evaluate the
574 /// expression first. If DIL is not called or fails, the evaluation falls
575 /// back to UserExpression.
576 bool m_try_DIL_first = false;
577
582 void *m_cancel_callback_baton = nullptr;
583 // If m_pound_line_file is not empty and m_pound_line_line is non-zero, use
584 // #line %u "%s" before the expression content to remap where the source
585 // originates
586 mutable std::string m_pound_line_file;
587 mutable uint32_t m_pound_line_line = 0;
588
589 /// Dictionary mapping names of language-plugin specific options
590 /// to values.
592
593 /// During expression evaluation, any SymbolContext in this list will be
594 /// used for symbol/function lookup before any other context (except for
595 /// the module corresponding to the current frame).
597};
598
599// Target
600class Target : public std::enable_shared_from_this<Target>,
601 public TargetProperties,
602 public Broadcaster,
604 public ModuleList::Notifier {
605public:
606 friend class TargetList;
607 friend class Debugger;
608 friend class TargetAPIMutex;
609
610 /// Broadcaster event bits definitions.
611 enum {
619 };
620
621 // These two functions fill out the Broadcaster interface:
622
623 static llvm::StringRef GetStaticBroadcasterClass();
624
625 llvm::StringRef GetBroadcasterClass() const override {
627 }
628
629 // This event data class is for use by the TargetList to broadcast new target
630 // notifications.
631 class TargetEventData : public EventData {
632 public:
633 TargetEventData(const lldb::TargetSP &target_sp);
634
635 TargetEventData(const lldb::TargetSP &target_sp,
636 const ModuleList &module_list);
637
638 // Constructor for eBroadcastBitNewTargetCreated events. For this event
639 // type:
640 // - target_sp is the parent target (the subject/broadcaster of the event)
641 // - created_target_sp is the newly created target
642 TargetEventData(const lldb::TargetSP &target_sp,
643 const lldb::TargetSP &created_target_sp);
644
646
647 static llvm::StringRef GetFlavorString();
648
649 llvm::StringRef GetFlavor() const override {
651 }
652
653 void Dump(Stream *s) const override;
654
655 static const TargetEventData *GetEventDataFromEvent(const Event *event_ptr);
656
657 static lldb::TargetSP GetTargetFromEvent(const Event *event_ptr);
658
659 // For eBroadcastBitNewTargetCreated events, returns the newly created
660 // target. For other event types, returns an invalid target.
661 static lldb::TargetSP GetCreatedTargetFromEvent(const Event *event_ptr);
662
663 static ModuleList GetModuleListFromEvent(const Event *event_ptr);
664
665 const lldb::TargetSP &GetTarget() const { return m_target_sp; }
666
668 return m_created_target_sp;
669 }
670
671 const ModuleList &GetModuleList() const { return m_module_list; }
672
673 private:
677
679 const TargetEventData &operator=(const TargetEventData &) = delete;
680 };
681
682 ~Target() override;
683
684 static void SettingsInitialize();
685
686 static void SettingsTerminate();
687
689
691
693
694 static void SetDefaultArchitecture(const ArchSpec &arch);
695
696 bool IsDummyTarget() const { return m_is_dummy_target; }
697
698 /// Get the globally unique ID for this target.
699 ///
700 /// This ID is unique across all debugger instances and all targets,
701 /// within the same lldb process. The ID is assigned
702 /// during target construction and remains constant for the target's lifetime.
703 /// The first target created (typically the dummy target) gets ID 1.
704 ///
705 /// \return
706 /// The globally unique ID for this target.
708
709 const std::string &GetLabel() const { return m_label; }
710
711 /// Set a label for a target.
712 ///
713 /// The label cannot be used by another target or be only integral.
714 ///
715 /// \return
716 /// The label for this target or an error if the label didn't match the
717 /// requirements.
718 llvm::Error SetLabel(llvm::StringRef label);
719
720 /// Get the target session name for this target.
721 ///
722 /// Provides a meaningful name for IDEs or tools to display for dynamically
723 /// created targets. Defaults to "Session {ID}" based on the globally unique
724 /// ID.
725 ///
726 /// \return
727 /// The target session name for this target.
728 llvm::StringRef GetTargetSessionName() { return m_target_session_name; }
729
730 /// Set the target session name for this target.
731 ///
732 /// This should typically be set along with the event
733 /// eBroadcastBitNewTargetCreated. Useful for scripts or triggers that
734 /// automatically create targets and want to provide meaningful names that
735 /// IDEs or other tools can display to help users identify the origin and
736 /// purpose of each target.
737 ///
738 /// \param[in] target_session_name
739 /// The target session name to set for this target.
740 void SetTargetSessionName(llvm::StringRef target_session_name) {
741 m_target_session_name = target_session_name.str();
742 }
743
744 /// Find a binary on the system and return its Module,
745 /// or return an existing Module that is already in the Target.
746 ///
747 /// Given a ModuleSpec, find a binary satisifying that specification,
748 /// or identify a matching Module already present in the Target,
749 /// and return a shared pointer to it.
750 ///
751 /// Note that this function previously also preloaded the module's symbols
752 /// depending on a setting. This function no longer does any module
753 /// preloading because that can potentially cause deadlocks when called in
754 /// parallel with this function.
755 ///
756 /// \param[in] module_spec
757 /// The criteria that must be matched for the binary being loaded.
758 /// e.g. UUID, architecture, file path.
759 ///
760 /// \param[in] notify
761 /// If notify is true, and the Module is new to this Target,
762 /// Target::ModulesDidLoad will be called. See note in
763 /// Target::ModulesDidLoad about thread-safety with
764 /// Target::GetOrCreateModule.
765 /// If notify is false, it is assumed that the caller is adding
766 /// multiple Modules and will call ModulesDidLoad with the
767 /// full list at the end.
768 /// ModulesDidLoad must be called when a Module/Modules have
769 /// been added to the target, one way or the other.
770 ///
771 /// \param[out] error_ptr
772 /// Optional argument, pointing to a Status object to fill in
773 /// with any results / messages while attempting to find/load
774 /// this binary. Many callers will be internal functions that
775 /// will handle / summarize the failures in a custom way and
776 /// don't use these messages.
777 ///
778 /// \param[in] invoke_symbol_locators
779 /// Whether to search beyond the Target's modules, the shared module list
780 /// and the locate module callback, i.e. with the platform and the symbol
781 /// locators. A caller that has already searched passes false.
782 ///
783 /// \return
784 /// An empty ModuleSP will be returned if no matching file
785 /// was found. If error_ptr was non-nullptr, an error message
786 /// will likely be provided.
787 lldb::ModuleSP GetOrCreateModule(const ModuleSpec &module_spec, bool notify,
788 Status *error_ptr = nullptr,
789 bool invoke_symbol_locators = true);
790
791 // Settings accessors
792
794
795 /// Returns a handle resolved to the mutex to serialize on before
796 /// touching the target through the SB API. The handle isn't locked yet;
797 /// lock()/try_lock() it (typically via std::lock_guard<TargetAPIMutex>/
798 /// std::unique_lock<TargetAPIMutex>) to actually acquire it.
800
802
803 void CleanupProcess();
804
805 /// Dump a description of this object to a Stream.
806 ///
807 /// Dump a description of the contents of this object to the
808 /// supplied stream \a s. The dumped content will be only what has
809 /// been loaded or parsed up to this point at which this function
810 /// is called, so this is a good way to see what has been parsed
811 /// in a target.
812 ///
813 /// \param[in] s
814 /// The stream to which to dump the object description.
815 void Dump(Stream *s, lldb::DescriptionLevel description_level);
816
817 // If listener_sp is null, the listener of the owning Debugger object will be
818 // used.
820 llvm::StringRef plugin_name,
821 const FileSpec *crash_file,
822 bool can_connect);
823
824 const lldb::ProcessSP &GetProcessSP() const;
825
826 bool IsValid() { return m_valid; }
827
828 void Destroy();
829
830 Status Launch(ProcessLaunchInfo &launch_info,
831 Stream *stream); // Optional stream to receive first stop info
832
833 Status Attach(ProcessAttachInfo &attach_info,
834 Stream *stream); // Optional stream to receive first stop info
835
836 /// Add or update a scripted frame provider descriptor for this target.
837 /// All new threads in this target will check if they match any descriptors
838 /// to create their frame providers.
839 ///
840 /// \param[in] descriptor
841 /// The descriptor to add or update.
842 ///
843 /// \return
844 /// The descriptor identifier if the registration succeeded, otherwise an
845 /// llvm::Error.
846 llvm::Expected<uint32_t> AddScriptedFrameProviderDescriptor(
847 const ScriptedFrameProviderDescriptor &descriptor);
848
849 /// Remove a scripted frame provider descriptor by id.
850 ///
851 /// \param[in] id
852 /// The id of the descriptor to remove.
853 ///
854 /// \return
855 /// True if a descriptor was removed, false if no descriptor with that
856 /// id existed.
858
859 /// Clear all scripted frame provider descriptors for this target.
861
862 /// Get all scripted frame provider descriptors for this target.
863 const llvm::MapVector<uint32_t, ScriptedFrameProviderDescriptor> &
865
866protected:
867 /// Invalidate all potentially cached frame providers for all threads
868 /// and trigger a stack changed event for all threads.
870
871public:
872 // This part handles the breakpoints.
873
874 BreakpointList &GetBreakpointList(bool internal = false);
875
876 const BreakpointList &GetBreakpointList(bool internal = false) const;
877
881
883
885
886 // Use this to create a file and line breakpoint to a given module or all
887 // module it is nullptr
888 lldb::BreakpointSP CreateBreakpoint(const FileSpecList *containingModules,
889 const FileSpec &file, uint32_t line_no,
890 uint32_t column, lldb::addr_t offset,
891 LazyBool check_inlines,
892 LazyBool skip_prologue, bool internal,
893 bool request_hardware,
894 LazyBool move_to_nearest_code);
895
896 // Use this to create breakpoint that matches regex against the source lines
897 // in files given in source_file_list: If function_names is non-empty, also
898 // filter by function after the matches are made.
900 const FileSpecList *containingModules,
901 const FileSpecList *source_file_list,
902 const std::unordered_set<std::string> &function_names,
903 RegularExpression source_regex, bool internal, bool request_hardware,
904 LazyBool move_to_nearest_code);
905
906 // Use this to create a breakpoint from a load address
907 lldb::BreakpointSP CreateBreakpoint(lldb::addr_t load_addr, bool internal,
908 bool request_hardware);
909
910 // Use this to create a breakpoint from a file address and a module file spec
912 bool internal,
913 const FileSpec &file_spec,
914 bool request_hardware);
915
916 // Use this to create Address breakpoints:
917 lldb::BreakpointSP CreateBreakpoint(const Address &addr, bool internal,
918 bool request_hardware);
919
920 // Use this to create a function breakpoint by regexp in
921 // containingModule/containingSourceFiles, or all modules if it is nullptr
922 // When "skip_prologue is set to eLazyBoolCalculate, we use the current
923 // target setting, else we use the values passed in
925 const FileSpecList *containingModules,
926 const FileSpecList *containingSourceFiles, RegularExpression func_regexp,
927 lldb::LanguageType requested_language, LazyBool skip_prologue,
928 bool internal, bool request_hardware);
929
930 // Use this to create a function breakpoint by name in containingModule, or
931 // all modules if it is nullptr When "skip_prologue is set to
932 // eLazyBoolCalculate, we use the current target setting, else we use the
933 // values passed in. func_name_type_mask is or'ed values from the
934 // FunctionNameType enum.
936 const FileSpecList *containingModules,
937 const FileSpecList *containingSourceFiles, const char *func_name,
938 lldb::FunctionNameType func_name_type_mask, lldb::LanguageType language,
939 lldb::addr_t offset, bool offset_is_insn_count, LazyBool skip_prologue,
940 bool internal, bool request_hardware);
941
943 CreateExceptionBreakpoint(enum lldb::LanguageType language, bool catch_bp,
944 bool throw_bp, bool internal,
945 Args *additional_args = nullptr,
946 Status *additional_args_error = nullptr);
947
949 const llvm::StringRef class_name, const FileSpecList *containingModules,
950 const FileSpecList *containingSourceFiles, bool internal,
951 bool request_hardware, StructuredData::ObjectSP extra_args_sp,
952 Status *creation_error = nullptr);
953
954 // This is the same as the func_name breakpoint except that you can specify a
955 // vector of names. This is cheaper than a regular expression breakpoint in
956 // the case where you just want to set a breakpoint on a set of names you
957 // already know. func_name_type_mask is or'ed values from the
958 // FunctionNameType enum.
960 const FileSpecList *containingModules,
961 const FileSpecList *containingSourceFiles, const char *func_names[],
962 size_t num_names, lldb::FunctionNameType func_name_type_mask,
963 lldb::LanguageType language, lldb::addr_t offset, LazyBool skip_prologue,
964 bool internal, bool request_hardware);
965
967 CreateBreakpoint(const FileSpecList *containingModules,
968 const FileSpecList *containingSourceFiles,
969 const std::vector<std::string> &func_names,
970 lldb::FunctionNameType func_name_type_mask,
971 lldb::LanguageType language, lldb::addr_t m_offset,
972 LazyBool skip_prologue, bool internal,
973 bool request_hardware);
974
975 // Use this to create a general breakpoint:
977 lldb::BreakpointResolverSP &resolver_sp,
978 bool internal, bool request_hardware,
979 bool resolve_indirect_symbols);
980
981 // Use this to create a watchpoint:
983 const CompilerType *type, uint32_t kind,
984 Status &error);
985
989
991
992 // Manages breakpoint names:
993 void AddNameToBreakpoint(BreakpointID &id, llvm::StringRef name,
994 Status &error);
995
996 void AddNameToBreakpoint(lldb::BreakpointSP &bp_sp, llvm::StringRef name,
997 Status &error);
998
1000 llvm::StringRef name);
1001
1002 BreakpointName *FindBreakpointName(llvm::StringRef name, bool can_create,
1003 Status &error);
1004
1005 void DeleteBreakpointName(llvm::StringRef name);
1006
1008 const BreakpointOptions &options,
1009 const BreakpointName::Permissions &permissions);
1011
1012 void AddBreakpointName(std::unique_ptr<BreakpointName> bp_name);
1013
1014 void GetBreakpointNames(std::vector<std::string> &names);
1015
1016 // This call removes ALL breakpoints regardless of permission.
1017 void RemoveAllBreakpoints(bool internal_also = false);
1018
1019 // This removes all the breakpoints, but obeys the ePermDelete on them.
1021
1022 void DisableAllBreakpoints(bool internal_also = false);
1023
1025
1026 void EnableAllBreakpoints(bool internal_also = false);
1027
1029
1031
1033
1035
1036 /// Resets the hit count of all breakpoints.
1038
1039 // This callout implements the "Resolver Override". When we have determined
1040 // the Resolver for a given breakpoint, we pass each of the registered
1041 // overrides the "natural" resolver, and then we will use whatever resolver
1042 // we get back from it if it is non-null.
1043 // We keep a list of overrides ordered by ID - and we search through the list
1044 // by ID order, and the first override that returns a non-null Resolver will
1045 // be the one we use. If no overrides return an override resolver, we'll use
1046 // the original one.
1047
1048 /// This is the abstract version of the override. Particular implementations,
1049 /// e.g. the scripted override resolver, instantiate actual versions of the
1050 /// class. The constructor takes the target this resolver is registered in, a
1051 /// description for the override and a mask of the resolver types this
1052 /// overrides, made of elements of the BreakpointResolverType enum.
1053 class BreakpointResolverOverride;
1055 std::unique_ptr<BreakpointResolverOverride>;
1056
1058 public:
1059 BreakpointResolverOverride(Target &target, const std::string &description,
1060 uint64_t type_mask)
1061 : m_target(target), m_desc(description), m_type_mask(type_mask) {}
1062
1064
1068 // Returns an error describing why this override can't be used, for
1069 // example because its script class doesn't exist.
1070 virtual llvm::Error HasErrors() = 0;
1071 const std::string &GetDescription() { return m_desc; }
1072 uint64_t GetTypeMask() { return m_type_mask; }
1073 std::string DescribeTypeMask();
1074
1075 protected:
1077 std::string m_desc;
1078 uint64_t m_type_mask = 0;
1079 };
1080
1081 /// Add a breakpoint override resolver. This version can't fail.
1085 m_breakpoint_overrides.emplace(m_override_id, std::move(override_up));
1086 m_override_id++;
1087 return id_used;
1088 }
1089
1090 /// Add a breakpoint override resolver. Return the ID or an error:
1091 llvm::Expected<lldb::user_id_t>
1092 AddBreakpointResolverOverride(llvm::StringRef class_name, uint64_t type_mask,
1093 StructuredData::DictionarySP args_data_sp,
1094 llvm::StringRef description);
1095
1097 size_t removed = m_breakpoint_overrides.erase(override_id);
1098 return removed == 1;
1099 }
1100
1102
1105
1106 /// Describe the breakpoint overrides. If ixds is empty, list all. Otherwise
1107 /// list the overrides whose ids match the ones given in idxs. The matched
1108 /// elements are removed from the list, so any elements remaining in idxs are
1109 /// indexes that are not breakpoint override indexes.
1111 std::vector<lldb::user_id_t> &idxs,
1112 uint32_t terminal_width, bool use_color);
1113
1114 // The flag 'end_to_end', default to true, signifies that the operation is
1115 // performed end to end, for both the debugger and the debuggee.
1116
1117 bool RemoveAllWatchpoints(bool end_to_end = true);
1118
1119 bool DisableAllWatchpoints(bool end_to_end = true);
1120
1121 bool EnableAllWatchpoints(bool end_to_end = true);
1122
1124
1126
1127 bool IgnoreAllWatchpoints(uint32_t ignore_count);
1128
1130
1132
1134
1135 bool IgnoreWatchpointByID(lldb::watch_id_t watch_id, uint32_t ignore_count);
1136
1138 const BreakpointIDList &bp_ids,
1139 bool append);
1140
1142 BreakpointIDList &new_bps);
1143
1145 std::vector<std::string> &names,
1146 BreakpointIDList &new_bps);
1147
1148 /// Get \a load_addr as a callable code load address for this target
1149 ///
1150 /// Take \a load_addr and potentially add any address bits that are
1151 /// needed to make the address callable. For ARM this can set bit
1152 /// zero (if it already isn't) if \a load_addr is a thumb function.
1153 /// If \a addr_class is set to AddressClass::eInvalid, then the address
1154 /// adjustment will always happen. If it is set to an address class
1155 /// that doesn't have code in it, LLDB_INVALID_ADDRESS will be
1156 /// returned.
1158 lldb::addr_t load_addr,
1159 AddressClass addr_class = AddressClass::eInvalid) const;
1160
1161 /// Get \a load_addr as an opcode for this target.
1162 ///
1163 /// Take \a load_addr and potentially strip any address bits that are
1164 /// needed to make the address point to an opcode. For ARM this can
1165 /// clear bit zero (if it already isn't) if \a load_addr is a
1166 /// thumb function and load_addr is in code.
1167 /// If \a addr_class is set to AddressClass::eInvalid, then the address
1168 /// adjustment will always happen. If it is set to an address class
1169 /// that doesn't have code in it, LLDB_INVALID_ADDRESS will be
1170 /// returned.
1173 AddressClass addr_class = AddressClass::eInvalid) const;
1174
1175 // Get load_addr as breakable load address for this target. Take a addr and
1176 // check if for any reason there is a better address than this to put a
1177 // breakpoint on. If there is then return that address. For MIPS, if
1178 // instruction at addr is a delay slot instruction then this method will find
1179 // the address of its previous instruction and return that address.
1181
1182 /// This call may preload module symbols, and may do so in parallel depending
1183 /// on the following target settings:
1184 /// - TargetProperties::GetPreloadSymbols()
1185 /// - TargetProperties::GetParallelModuleLoad()
1186 ///
1187 /// Warning: if preloading is active and this is called in parallel with
1188 /// Target::GetOrCreateModule, this may result in a ABBA deadlock situation.
1189 void ModulesDidLoad(ModuleList &module_list);
1190
1191 void ModulesDidUnload(ModuleList &module_list, bool delete_locations);
1192
1193 void SymbolsDidLoad(ModuleList &module_list);
1194
1195 /// Record that we're auto-loading \p module's scripts in this target, so we
1196 /// only load them once. We record the module before loading its scripts, so
1197 /// a script that fails to load isn't tried again in this target either. We
1198 /// don't record modules without a UUID, or any module when
1199 /// target.experimental.reload-module-scripts is set.
1200 ///
1201 /// \return
1202 /// False if we already loaded \p module's scripts in this target.
1203 bool RecordScriptingResources(Module &module);
1204
1205 void ClearModules(bool delete_locations);
1206
1207 /// Called as the last function in Process::DidExec().
1208 ///
1209 /// Process::DidExec() will clear a lot of state in the process,
1210 /// then try to reload a dynamic loader plugin to discover what
1211 /// binaries are currently available and then this function should
1212 /// be called to allow the target to do any cleanup after everything
1213 /// has been figured out. It can remove breakpoints that no longer
1214 /// make sense as the exec might have changed the target
1215 /// architecture, and unloaded some modules that might get deleted.
1216 void DidExec();
1217
1218 /// Gets the module for the main executable.
1219 ///
1220 /// Each process has a notion of a main executable that is the file
1221 /// that will be executed or attached to. Executable files can have
1222 /// dependent modules that are discovered from the object files, or
1223 /// discovered at runtime as things are dynamically loaded.
1224 ///
1225 /// \return
1226 /// The first module of type ObjectFile::eTypeExecutable. Failing that,
1227 /// the module set by RebuildModuleListWithExecutable or
1228 /// MarkExecutableModule while the target still holds it, which can be a
1229 /// shared library (an ELF PIE). Otherwise, nullptr.
1230 ///
1231 /// \see DynamicLoader
1232 /// \see ObjectFile::GetDependentModules (FileSpecList&)
1233 /// \see Target::RebuildModuleListWithExecutable(lldb::ModuleSP&)
1235
1237
1238 /// Make \a module_sp the main executable without clearing the other images,
1239 /// unlike RebuildModuleListWithExecutable. Has no effect until the target
1240 /// holds it.
1241 void MarkExecutableModule(const lldb::ModuleSP &module_sp);
1242
1243 /// Clear the module list and rebuild it around a new main executable.
1244 ///
1245 /// Each process has a notion of a main executable that is the file
1246 /// that will be executed or attached to. Executable files can have
1247 /// dependent modules that are discovered from the object files, or
1248 /// discovered at runtime as things are dynamically loaded.
1249 ///
1250 /// Rebuilding causes any of the current dependent
1251 /// image information to be cleared and replaced with the static
1252 /// dependent image information found by calling
1253 /// ObjectFile::GetDependentModules (FileSpecList&) on the main
1254 /// executable and any modules on which it depends. Calling
1255 /// Process::GetImages() will return the newly found images that
1256 /// were obtained from all of the object files.
1257 ///
1258 /// \param[in] module_sp
1259 /// A shared pointer reference to the module that will become
1260 /// the main executable for this process.
1261 ///
1262 /// \param[in] load_dependent_files
1263 /// If \b true then ask the object files to track down any
1264 /// known dependent files.
1265 ///
1266 /// \see ObjectFile::GetDependentModules (FileSpecList&)
1267 /// \see Process::GetImages()
1269 lldb::ModuleSP &module_sp,
1270 LoadDependentFiles load_dependent_files = eLoadDependentsDefault);
1271
1272 bool LoadScriptingResources(std::list<Status> &errors,
1273 bool continue_on_error = true) {
1274 return m_images.LoadScriptingResourcesInTarget(this, errors,
1275 continue_on_error);
1276 }
1277
1278 /// Get accessor for the images for this process.
1279 ///
1280 /// Each process has a notion of a main executable that is the file
1281 /// that will be executed or attached to. Executable files can have
1282 /// dependent modules that are discovered from the object files, or
1283 /// discovered at runtime as things are dynamically loaded. After
1284 /// a main executable has been set, the images will contain a list
1285 /// of all the files that the executable depends upon as far as the
1286 /// object files know. These images will usually contain valid file
1287 /// virtual addresses only. When the process is launched or attached
1288 /// to, the DynamicLoader plug-in will discover where these images
1289 /// were loaded in memory and will resolve the load virtual
1290 /// addresses is each image, and also in images that are loaded by
1291 /// code.
1292 ///
1293 /// \return
1294 /// A list of Module objects in a module list.
1295 const ModuleList &GetImages() const { return m_images; }
1296
1298
1299 /// Return whether this FileSpec corresponds to a module that should be
1300 /// considered for general searches.
1301 ///
1302 /// This API will be consulted by the SearchFilterForUnconstrainedSearches
1303 /// and any module that returns \b true will not be searched. Note the
1304 /// SearchFilterForUnconstrainedSearches is the search filter that
1305 /// gets used in the CreateBreakpoint calls when no modules is provided.
1306 ///
1307 /// The target call at present just consults the Platform's call of the
1308 /// same name.
1309 ///
1310 /// \param[in] module_spec
1311 /// Path to the module.
1312 ///
1313 /// \return \b true if the module should be excluded, \b false otherwise.
1314 bool ModuleIsExcludedForUnconstrainedSearches(const FileSpec &module_spec);
1315
1316 /// Return whether this module should be considered for general searches.
1317 ///
1318 /// This API will be consulted by the SearchFilterForUnconstrainedSearches
1319 /// and any module that returns \b true will not be searched. Note the
1320 /// SearchFilterForUnconstrainedSearches is the search filter that
1321 /// gets used in the CreateBreakpoint calls when no modules is provided.
1322 ///
1323 /// The target call at present just consults the Platform's call of the
1324 /// same name.
1325 ///
1326 /// FIXME: When we get time we should add a way for the user to set modules
1327 /// that they
1328 /// don't want searched, in addition to or instead of the platform ones.
1329 ///
1330 /// \param[in] module_sp
1331 /// A shared pointer reference to the module that checked.
1332 ///
1333 /// \return \b true if the module should be excluded, \b false otherwise.
1334 bool
1336
1337 const ArchSpec &GetArchitecture() const { return m_arch.GetSpec(); }
1338
1339 /// Returns the name of the target's ABI plugin.
1340 llvm::StringRef GetABIName() const;
1341
1342 /// Set the architecture for this target.
1343 ///
1344 /// If the current target has no Images read in, then this just sets the
1345 /// architecture, which will be used to select the architecture of the
1346 /// ExecutableModule when that is set. If the current target has an
1347 /// ExecutableModule, then calling SetArchitecture with a different
1348 /// architecture from the currently selected one will reset the
1349 /// ExecutableModule to that slice of the file backing the ExecutableModule.
1350 /// If the file backing the ExecutableModule does not contain a fork of this
1351 /// architecture, then this code will return false, and the architecture
1352 /// won't be changed. If the input arch_spec is the same as the already set
1353 /// architecture, this is a no-op.
1354 ///
1355 /// \param[in] arch_spec
1356 /// The new architecture.
1357 ///
1358 /// \param[in] set_platform
1359 /// If \b true, then the platform will be adjusted if the currently
1360 /// selected platform is not compatible with the architecture being set.
1361 /// If \b false, then just the architecture will be set even if the
1362 /// currently selected platform isn't compatible (in case it might be
1363 /// manually set following this function call).
1364 ///
1365 /// \param[in] merged
1366 /// If true, arch_spec is merged with the current
1367 /// architecture. Otherwise it's replaced.
1368 ///
1369 /// \return
1370 /// \b true if the architecture was successfully set, \b false otherwise.
1371 bool SetArchitecture(const ArchSpec &arch_spec, bool set_platform = false,
1372 bool merge = true);
1373
1374 bool MergeArchitecture(const ArchSpec &arch_spec);
1375
1376 Architecture *GetArchitecturePlugin() const { return m_arch.GetPlugin(); }
1377
1378 Debugger &GetDebugger() const { return m_debugger; }
1379
1380 size_t ReadMemoryFromFileCache(const Address &addr, void *dst, size_t dst_len,
1381 Status &error);
1382
1383 // Reading memory through the target allows us to skip going to the process
1384 // for reading memory if possible and it allows us to try and read from any
1385 // constant sections in our object files on disk. If you always want live
1386 // program memory, read straight from the process. If you possibly want to
1387 // read from const sections in object files, read from the target. This
1388 // version of ReadMemory will try and read memory from the process if the
1389 // process is alive. The order is:
1390 // 1 - if (force_live_memory == false) and the address falls in a read-only
1391 // section, then read from the file cache
1392 // 2 - if there is a process, then read from memory
1393 // 3 - if there is no process, then read from the file cache
1394 //
1395 // If did_read_live_memory is provided, will indicate if the read was from
1396 // live memory, or from file contents. A caller which needs to treat these two
1397 // sources differently should use this argument to disambiguate where the data
1398 // was read from.
1399 //
1400 // The method is virtual for mocking in the unit tests.
1401 virtual size_t ReadMemory(const Address &addr, void *dst, size_t dst_len,
1402 Status &error, bool force_live_memory = false,
1403 lldb::addr_t *load_addr_ptr = nullptr,
1404 bool *did_read_live_memory = nullptr);
1405
1406 size_t ReadCStringFromMemory(const Address &addr, std::string &out_str,
1407 Status &error, bool force_live_memory = false);
1408
1409 size_t ReadCStringFromMemory(const Address &addr, char *dst,
1410 size_t dst_max_len, Status &result_error,
1411 bool force_live_memory = false);
1412
1413 /// Read a null-terminated string from memory
1414 ///
1415 /// This function will read a cache page at a time until a null terminator
1416 /// is found. It will stop reading if an aligned null terminator of \a
1417 /// type_width bytes is not found before reading \a cstr_max_len bytes. The
1418 /// results are always guaranteed to be null-terminated, and that no more
1419 /// than (max_bytes - type_width) bytes will be read.
1420 ///
1421 /// \param[in] addr
1422 /// The address to start the memory read.
1423 ///
1424 /// \param[in] dst
1425 /// A character buffer containing at least max_bytes.
1426 ///
1427 /// \param[in] max_bytes
1428 /// The maximum number of bytes to read.
1429 ///
1430 /// \param[in] error
1431 /// The error status of the read operation.
1432 ///
1433 /// \param[in] type_width
1434 /// The size of the null terminator (1 to 4 bytes per
1435 /// character). Defaults to 1.
1436 ///
1437 /// \return
1438 /// The error status or the number of bytes prior to the null terminator.
1439 size_t ReadStringFromMemory(const Address &addr, char *dst, size_t max_bytes,
1440 Status &error, size_t type_width,
1441 bool force_live_memory = true);
1442
1443 size_t ReadScalarIntegerFromMemory(const Address &addr, uint32_t byte_size,
1444 bool is_signed, Scalar &scalar,
1445 Status &error,
1446 bool force_live_memory = false);
1447
1448 int64_t ReadSignedIntegerFromMemory(const Address &addr,
1449 size_t integer_byte_size,
1450 int64_t fail_value, Status &error,
1451 bool force_live_memory = false);
1452
1453 uint64_t ReadUnsignedIntegerFromMemory(const Address &addr,
1454 size_t integer_byte_size,
1455 uint64_t fail_value, Status &error,
1456 bool force_live_memory = false);
1457
1458 bool ReadPointerFromMemory(const Address &addr, Status &error,
1459 Address &pointer_addr,
1460 bool force_live_memory = false);
1461
1462 bool HasLoadedSections();
1463
1465
1466 void ClearSectionLoadList();
1467
1468 void DumpSectionLoadList(Stream &s);
1469
1470 static Target *GetTargetFromContexts(const ExecutionContext *exe_ctx_ptr,
1471 const SymbolContext *sc_ptr);
1472
1473 // lldb::ExecutionContextScope pure virtual functions
1475
1477
1479
1481
1482 void CalculateExecutionContext(ExecutionContext &exe_ctx) override;
1483
1485
1486 llvm::Expected<lldb::TypeSystemSP>
1488 bool create_on_demand = true);
1489
1490 std::vector<lldb::TypeSystemSP>
1491 GetScratchTypeSystems(bool create_on_demand = true);
1492
1495
1496 // Creates a UserExpression for the given language, the rest of the
1497 // parameters have the same meaning as for the UserExpression constructor.
1498 // Returns a new-ed object which the caller owns.
1499
1501 GetUserExpressionForLanguage(llvm::StringRef expr, llvm::StringRef prefix,
1502 SourceLanguage language,
1503 Expression::ResultType desired_type,
1504 const EvaluateExpressionOptions &options,
1505 ValueObject *ctx_obj, Status &error);
1506
1507 // Creates a FunctionCaller for the given language, the rest of the
1508 // parameters have the same meaning as for the FunctionCaller constructor.
1509 // Since a FunctionCaller can't be
1510 // IR Interpreted, it makes no sense to call this with an
1511 // ExecutionContextScope that lacks
1512 // a Process.
1513 // Returns a new-ed object which the caller owns.
1514
1516 const CompilerType &return_type,
1517 const Address &function_address,
1518 const ValueList &arg_value_list,
1519 const char *name, Status &error);
1520
1521 /// Creates and installs a UtilityFunction for the given language.
1522 llvm::Expected<std::unique_ptr<UtilityFunction>>
1523 CreateUtilityFunction(std::string expression, std::string name,
1524 lldb::LanguageType language, ExecutionContext &exe_ctx);
1525
1526 // Install any files through the platform that need be to installed prior to
1527 // launching or attaching.
1528 Status Install(ProcessLaunchInfo *launch_info);
1529
1530 bool ResolveFileAddress(lldb::addr_t load_addr, Address &so_addr);
1531
1532 bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr,
1533 uint32_t stop_id = SectionLoadHistory::eStopIDNow,
1534 bool allow_section_end = false);
1535
1536 bool SetSectionLoadAddress(const lldb::SectionSP &section,
1537 lldb::addr_t load_addr,
1538 bool warn_multiple = false);
1539
1540 size_t UnloadModuleSections(const lldb::ModuleSP &module_sp);
1541
1542 size_t UnloadModuleSections(const ModuleList &module_list);
1543
1544 bool SetSectionUnloaded(const lldb::SectionSP &section_sp);
1545
1546 bool SetSectionUnloaded(const lldb::SectionSP &section_sp,
1547 lldb::addr_t load_addr);
1548
1550
1552 lldb_private::TypeSummaryImpl &summary_provider);
1554
1555 /// Set the \a Trace object containing processor trace information of this
1556 /// target.
1557 ///
1558 /// \param[in] trace_sp
1559 /// The trace object.
1560 void SetTrace(const lldb::TraceSP &trace_sp);
1561
1562 /// Get the \a Trace object containing processor trace information of this
1563 /// target.
1564 ///
1565 /// \return
1566 /// The trace object. It might be undefined.
1568
1569 /// Create a \a Trace object for the current target using the using the
1570 /// default supported tracing technology for this process.
1571 ///
1572 /// \return
1573 /// The new \a Trace or an \a llvm::Error if a \a Trace already exists or
1574 /// the trace couldn't be created.
1575 llvm::Expected<lldb::TraceSP> CreateTrace();
1576
1577 /// If a \a Trace object is present, this returns it, otherwise a new Trace is
1578 /// created with \a Trace::CreateTrace.
1579 llvm::Expected<lldb::TraceSP> GetTraceOrCreate();
1580
1581 // Since expressions results can persist beyond the lifetime of a process,
1582 // and the const expression results are available after a process is gone, we
1583 // provide a way for expressions to be evaluated from the Target itself. If
1584 // an expression is going to be run, then it should have a frame filled in in
1585 // the execution context.
1587 llvm::StringRef expression, ExecutionContextScope *exe_scope,
1588 lldb::ValueObjectSP &result_valobj_sp,
1590 std::string *fixed_expression = nullptr, ValueObject *ctx_obj = nullptr);
1591
1593
1595
1596 /// This method will return the address of the starting function for
1597 /// this binary, e.g. main() or its equivalent. This can be used as
1598 /// an address of a function that is not called once a binary has
1599 /// started running - e.g. as a return address for inferior function
1600 /// calls that are unambiguous completion of the function call, not
1601 /// called during the course of the inferior function code running.
1602 ///
1603 /// If no entry point can be found, an invalid address is returned.
1604 ///
1605 /// \param [out] err
1606 /// This object will be set to failure if no entry address could
1607 /// be found, and may contain a helpful error message.
1608 //
1609 /// \return
1610 /// Returns the entry address for this program, or an error
1611 /// if none can be found.
1612 llvm::Expected<lldb_private::Address> GetEntryPointAddress();
1613
1614 CompilerType GetRegisterType(const RegisterInfo &reg_info);
1615
1616 /// Sends a breakpoint notification event.
1618 lldb::BreakpointEventType event_kind);
1619 /// Sends a breakpoint notification event.
1621 const lldb::EventDataSP &breakpoint_data_sp);
1622
1623 llvm::Expected<lldb::DisassemblerSP>
1624 ReadInstructions(const Address &start_addr, uint32_t count,
1625 const char *flavor_string = nullptr);
1626
1627 // Target Stop Hooks
1628 class StopHook : public UserID {
1629 public:
1630 StopHook(const StopHook &rhs);
1631 virtual ~StopHook() = default;
1632
1633 enum class StopHookKind : uint32_t {
1637 };
1644
1646
1647 // Set the specifier. The stop hook will own the specifier, and is
1648 // responsible for deleting it when we're done.
1649 void SetSpecifier(SymbolContextSpecifier *specifier);
1650
1652
1653 bool ExecutionContextPasses(const ExecutionContext &exe_ctx);
1654
1655 // Called on stop, this gets passed the ExecutionContext for each "stop
1656 // with a reason" thread. It should add to the stream whatever text it
1657 // wants to show the user, and return False to indicate it wants the target
1658 // not to stop.
1660 lldb::StreamSP output) = 0;
1661
1662 // Set the Thread Specifier. The stop hook will own the thread specifier,
1663 // and is responsible for deleting it when we're done.
1664 void SetThreadSpecifier(ThreadSpec *specifier);
1665
1667
1668 bool IsActive() { return m_active; }
1669
1670 void SetIsActive(bool is_active) { m_active = is_active; }
1671
1672 void SetAutoContinue(bool auto_continue) {
1673 m_auto_continue = auto_continue;
1674 }
1675
1676 bool GetAutoContinue() const { return m_auto_continue; }
1677
1678 void SetRunAtInitialStop(bool at_initial_stop) {
1679 m_at_initial_stop = at_initial_stop;
1680 }
1681
1683
1684 void SetOneShot(bool one_shot) { m_one_shot = one_shot; }
1685
1686 bool IsOneShot() const { return m_one_shot; }
1687
1688 void SetSuppressOutput(bool suppress_output) {
1689 m_suppress_output = suppress_output;
1690 }
1691
1692 bool GetSuppressOutput() const { return m_suppress_output; }
1693
1694 void GetDescription(Stream &s, lldb::DescriptionLevel level) const;
1696 lldb::DescriptionLevel level) const = 0;
1697
1698 protected:
1701 std::unique_ptr<ThreadSpec> m_thread_spec_up;
1702 bool m_active = true;
1703 bool m_auto_continue = false;
1704 bool m_at_initial_stop = false;
1705 bool m_one_shot = false;
1706 bool m_suppress_output = false;
1707
1708 StopHook(lldb::TargetSP target_sp, lldb::user_id_t uid);
1709 };
1710
1712 public:
1713 ~StopHookCommandLine() override = default;
1714
1716 void SetActionFromString(const std::string &strings);
1717 void SetActionFromStrings(const std::vector<std::string> &strings);
1718
1720 lldb::StreamSP output_sp) override;
1722 lldb::DescriptionLevel level) const override;
1723
1724 private:
1726 // Use CreateStopHook to make a new empty stop hook. Use SetActionFromString
1727 // to fill it with commands, and SetSpecifier to set the specifier shared
1728 // pointer (can be null, that will match anything.)
1730 : StopHook(target_sp, uid) {}
1731 friend class Target;
1732 };
1733
1735 public:
1736 ~StopHookScripted() override = default;
1738 lldb::StreamSP output) override;
1739
1740 Status SetScriptCallback(const ScriptedMetadata &scripted_metadata);
1741
1743 lldb::DescriptionLevel level) const override;
1744
1745 private:
1746 llvm::StringRef GetScriptClassName() const;
1747
1749
1750 /// Use CreateStopHook to make a new empty stop hook. Use SetScriptCallback
1751 /// to set the script to execute, and SetSpecifier to set the specifier
1752 /// shared pointer (can be null, that will match anything.)
1754 : StopHook(target_sp, uid) {}
1755 friend class Target;
1756 };
1757
1758 class StopHookCoded : public StopHook {
1759 public:
1760 ~StopHookCoded() override = default;
1761
1763 lldb::StreamSP output);
1764
1765 void SetCallback(llvm::StringRef name, HandleStopCallback *callback) {
1766 m_name = name;
1767 m_callback = callback;
1768 }
1769
1771 lldb::StreamSP output) override {
1772 return m_callback(exc_ctx, output);
1773 }
1774
1776 lldb::DescriptionLevel level) const override {
1777 s.Indent();
1778 s.Printf("%s (built-in)\n", m_name.c_str());
1779 }
1780
1781 private:
1782 std::string m_name;
1784
1785 /// Use CreateStopHook to make a new empty stop hook. Use SetCallback to set
1786 /// the callback to execute, and SetSpecifier to set the specifier shared
1787 /// pointer (can be null, that will match anything.)
1789 : StopHook(target_sp, uid) {}
1790 friend class Target;
1791 };
1792
1794
1795 typedef std::shared_ptr<StopHook> StopHookSP;
1796
1797 // Target Hooks
1798 //
1799 // Hooks fire on target lifecycle events. There are two flows:
1800 //
1801 // Command-based hooks: the user specifies which triggers the hook responds
1802 // to (--on-load, --on-unload, --on-stop) and provides a list of commands.
1803 // All commands run for every trigger the hook is signed up for.
1804 //
1805 // Python class hooks: the user provides a Python class name and optional
1806 // extra_args that will be passed to the hook init method (-k key -v value).
1807 // The class controls which events it handles by implementing the
1808 // corresponding callback methods (handle_module_loaded,
1809 // handle_module_unloaded, handle_stop). Triggers are set automatically
1810 // based on which methods exist.
1811 class Hook : public UserID {
1812 public:
1813 Hook(const Hook &rhs);
1814 virtual ~Hook() = default;
1815
1816 enum class HookKind : uint32_t { CommandBased = 0, ScriptBased };
1817
1818 HookKind GetHookKind() const { return m_kind; }
1819
1820 /// Individual trigger bits. Combine with bitwise OR to form a trigger mask.
1821 // FIXME: Add kProcessExit, kProcessDetach, etc. as needed.
1822 enum TriggerBit : uint32_t {
1823 kModulesLoaded = (1u << 0),
1824 kModulesUnloaded = (1u << 1),
1825 kProcessStop = (1u << 2),
1826 };
1827
1829
1830 bool IsEnabled() { return m_enabled; }
1831 void SetIsEnabled(bool enabled) { m_enabled = enabled; }
1832
1833 /// Return the bitmask of triggers this hook responds to.
1834 /// Each bit corresponds to a TriggerBit value.
1835 uint32_t GetTriggerMask() const { return m_trigger_mask; }
1836
1837 /// Return true if this hook fires on the given trigger.
1838 bool FiresOn(uint32_t trigger) const { return m_trigger_mask & trigger; }
1839
1840 // Filter fields
1841
1842 /// Set the symbol context specifier. The hook takes ownership.
1843 void SetSCSpecifier(SymbolContextSpecifier *specifier);
1845
1846 /// Check if the execution context passes the specifier and thread spec
1847 /// filters. Always returns true if no filters are set.
1848 bool ExecutionContextPasses(const ExecutionContext &exe_ctx);
1849
1850 /// Set the thread specifier. The hook takes ownership.
1851 void SetThreadSpecifier(ThreadSpec *specifier);
1853
1854 void SetRunAtInitialStop(bool at_initial_stop) {
1855 m_at_initial_stop = at_initial_stop;
1856 }
1858
1859 // Reaction settings
1860
1861 void SetAutoContinue(bool auto_continue) {
1862 m_auto_continue = auto_continue;
1863 }
1864 bool GetAutoContinue() const { return m_auto_continue; }
1865
1866 void SetSuppressOutput(bool suppress_output) {
1867 m_suppress_output = suppress_output;
1868 }
1869 bool GetSuppressOutput() const { return m_suppress_output; }
1870
1871 // Event handler methods (default no-ops)
1872
1873 virtual void HandleModuleLoaded(lldb::StreamSP output) {}
1874 virtual void HandleModuleUnloaded(lldb::StreamSP output) {}
1875
1876 /// Called when the process stops. Returns a StopHookResult indicating
1877 /// whether the process should remain stopped or continue.
1882
1883 virtual void GetDescription(Stream &s, lldb::DescriptionLevel level) const;
1884
1885 protected:
1886 /// Print the filter portion of the description (AutoContinue, Specifier,
1887 /// ThreadSpec). Called by subclass GetDescription after printing the
1888 /// hook-specific content (commands or class).
1892 bool m_enabled = true;
1893 uint32_t m_trigger_mask = 0; // No default, triggers must be explicit.
1894
1895 // Filters
1897 std::unique_ptr<ThreadSpec> m_thread_spec_up;
1898 bool m_at_initial_stop = false;
1899
1900 // Reaction settings
1901 bool m_auto_continue = false;
1902 bool m_suppress_output = false;
1903
1904 Hook(lldb::TargetSP target_sp, lldb::user_id_t uid, HookKind kind);
1905 };
1906
1907 class HookCommandLine : public Hook {
1908 public:
1909 ~HookCommandLine() override = default;
1910
1911 /// Replace the trigger mask. \a mask is a bitwise OR of TriggerBit values.
1912 void SetTriggerMask(uint32_t mask) { m_trigger_mask = mask; }
1913
1914 /// Add a trigger to the mask. \a trigger is a single TriggerBit value.
1915 void AddTrigger(uint32_t trigger) { m_trigger_mask |= trigger; }
1916
1917 /// Remove a trigger from the mask. \a trigger is a single TriggerBit value.
1918 void RemoveTrigger(uint32_t trigger) { m_trigger_mask &= ~trigger; }
1919
1920 /// Return the list of commands that this hook runs.
1922
1923 /// Populate the command list by splitting a single string on newlines.
1924 void SetActionFromString(const std::string &string);
1925
1926 /// Populate the command list from a vector of individual command strings.
1927 void SetActionFromStrings(const std::vector<std::string> &strings);
1928
1929 void GetDescription(Stream &s, lldb::DescriptionLevel level) const override;
1930 void HandleModuleLoaded(lldb::StreamSP output) override;
1931 void HandleModuleUnloaded(lldb::StreamSP output) override;
1933 lldb::StreamSP output) override;
1934
1935 private:
1937
1939 : Hook(target_sp, uid, HookKind::CommandBased) {}
1940 friend class Target;
1941 };
1942
1943 class HookScripted : public Hook {
1944 public:
1945 ~HookScripted() override = default;
1946
1947 void GetDescription(Stream &s, lldb::DescriptionLevel level) const override;
1948
1949 void HandleModuleLoaded(lldb::StreamSP output) override;
1950 void HandleModuleUnloaded(lldb::StreamSP output) override;
1952 lldb::StreamSP output) override;
1953
1954 Status SetScriptCallback(const ScriptedMetadata &scripted_metadata);
1955
1956 private:
1957 llvm::StringRef GetScriptClassName() const;
1958
1960
1962 : Hook(target_sp, uid, HookKind::ScriptBased) {}
1963 friend class Target;
1964 };
1965
1966 typedef std::shared_ptr<Hook> HookSP;
1967
1969
1970 /// Removes the most recently created hook. Used to roll back a
1971 /// hook creation when an error occurs (e.g., invalid script class name
1972 /// or empty interactive input).
1974
1976
1977 void RemoveAllHooks();
1978
1980
1981 bool SetHookEnabledStateByID(lldb::user_id_t uid, bool enabled);
1982
1983 void SetAllHooksEnabledState(bool enabled);
1984
1985 size_t GetNumHooks() const { return m_hooks.size(); }
1986
1987 HookSP GetHookAtIndex(size_t index);
1988
1989 void RunModuleHooks(bool is_load);
1990
1991 /// Add an empty stop hook to the Target's stop hook list, and returns a
1992 /// shared pointer to the new hook.
1993 StopHookSP CreateStopHook(StopHook::StopHookKind kind, bool internal = false);
1994
1995 /// If you tried to create a stop hook, and that failed, call this to
1996 /// remove the stop hook, as it will also reset the stop hook counter.
1998
1999 // Runs the stop hooks that have been registered for this target.
2000 // Returns true if the stop hooks cause the target to resume.
2001 // Pass at_initial_stop if this is the stop where lldb gains
2002 // control over the process for the first time.
2003 bool RunStopHooks(bool at_initial_stop = false);
2004
2005 bool SetSuppresStopHooks(bool suppress) {
2006 bool old_value = m_suppress_stop_hooks;
2007 m_suppress_stop_hooks = suppress;
2008 return old_value;
2009 }
2010
2012
2013 /// Collect the stop hooks and hooks added while \p collecting is true. We
2014 /// only collect while we call a module script's
2015 /// __lldb_module_added_to_target for this target.
2016 ///
2017 /// \return
2018 /// The previous value.
2019 bool SetCollectingHooks(bool collecting) {
2020 std::lock_guard<std::mutex> guard(m_module_added_hooks.mutex);
2021 return std::exchange(m_module_added_hooks.collecting, collecting);
2022 }
2023
2024 bool IsCollectingHooks() const {
2025 std::lock_guard<std::mutex> guard(m_module_added_hooks.mutex);
2026 return m_module_added_hooks.collecting;
2027 }
2028
2029 /// Run the collected stop hooks and hooks that were added with
2030 /// --at-initial-stop if the process is stopped, and stop tracking them. A
2031 /// module's __lldb_module_added_to_target adds such a hook to get hold of
2032 /// the process as soon as there is one, so when the process already stopped,
2033 /// the hook shouldn't wait for the next stop. Otherwise, the hook runs at the
2034 /// initial stop or the next stop as usual, like the stop hooks that any
2035 /// other script adds, including a module's __lldb_init_module.
2036 ///
2037 /// We don't resume the process, whatever the hooks ask: it already stopped,
2038 /// and resuming it is up to the user.
2040
2042
2043 void RemoveAllStopHooks();
2044
2045 StopHookSP GetStopHookByID(lldb::user_id_t uid);
2046
2047 bool SetStopHookActiveStateByID(lldb::user_id_t uid, bool active_state);
2048
2049 void SetAllStopHooksActiveState(bool active_state);
2050
2051 const std::vector<StopHookSP> GetStopHooks(bool internal = false) const;
2052
2054
2055 void SetPlatform(const lldb::PlatformSP &platform_sp) {
2056 m_platform_sp = platform_sp;
2057 }
2058
2060
2061 // Methods.
2063 GetSearchFilterForModule(const FileSpec *containingModule);
2064
2066 GetSearchFilterForModuleList(const FileSpecList *containingModuleList);
2067
2069 GetSearchFilterForModuleAndCUList(const FileSpecList *containingModules,
2070 const FileSpecList *containingSourceFiles);
2071
2073 const char *repl_options, bool can_create);
2074
2075 void SetREPL(lldb::LanguageType language, lldb::REPLSP repl_sp);
2076
2080
2082
2083 /// Get the list of paths that LLDB will consider automatically loading
2084 /// scripting resources from. Currently whether to load scripts
2085 /// unconditionally is controlled via the
2086 /// `target.load-script-from-symbol-file` setting.
2088
2089 /// Add a signal for the target. This will get copied over to the process
2090 /// if the signal exists on that target. Only the values with Yes and No are
2091 /// set, Calculate values will be ignored.
2092protected:
2101 using DummySignalElement = llvm::StringMapEntry<DummySignalValues>;
2102 static bool UpdateSignalFromDummy(lldb::UnixSignalsSP signals_sp,
2103 const DummySignalElement &element);
2104 static bool ResetSignalFromDummy(lldb::UnixSignalsSP signals_sp,
2105 const DummySignalElement &element);
2106
2107public:
2108 /// Add a signal to the Target's list of stored signals/actions. These
2109 /// values will get copied into any processes launched from
2110 /// this target.
2111 void AddDummySignal(llvm::StringRef name, LazyBool pass, LazyBool print,
2112 LazyBool stop);
2113 /// Updates the signals in signals_sp using the stored dummy signals.
2114 /// If warning_stream_sp is not null, if any stored signals are not found in
2115 /// the current process, a warning will be emitted here.
2117 lldb::StreamSP warning_stream_sp);
2118 /// Clear the dummy signals in signal_names from the target, or all signals
2119 /// if signal_names is empty. Also remove the behaviors they set from the
2120 /// process's signals if it exists.
2121 void ClearDummySignals(Args &signal_names);
2122 /// Print all the signals set in this target.
2123 void PrintDummySignals(Stream &strm, Args &signals);
2124
2125 /// Return the target groups this target belongs to.
2126 std::vector<lldb::TargetGroupSP> GetTargetGroups() const;
2127
2128 /// Return the first target group that can be cast to GroupT.
2129 template <typename GroupT>
2130 std::shared_ptr<GroupT> GetFirstTargetGroupOfType() const {
2131 static_assert(std::is_base_of_v<TargetGroup, GroupT>,
2132 "GroupT must derive from TargetGroup");
2133 for (const lldb::TargetGroupSP &group_sp : GetTargetGroups()) {
2134 if (GroupT *group = llvm::dyn_cast<GroupT>(group_sp.get()))
2135 return std::shared_ptr<GroupT>(group_sp, group);
2136 }
2137 return {};
2138 }
2139
2140protected:
2141 friend class TargetGroup;
2142 friend class TargetGroupList;
2143
2144 /// Called only by TargetGroup::AddTarget to record group membership.
2145 void AddTargetGroup(const lldb::TargetGroupSP &group_sp);
2146 /// Called only by TargetGroup::RemoveTarget to remove group membership.
2147 void RemoveTargetGroup(const TargetGroup *group);
2148
2149 /// The mutex the calling thread must serialize on for its current policy, or
2150 /// nullptr when that policy bypasses the API mutex entirely.
2151 std::recursive_mutex *GetAPIMutexForCurrentPolicy();
2152
2153 /// What the stop hooks that ran at a stop ask us to do with the process.
2154 enum class StopHooksVote {
2155 /// No hook asked to continue, or one asked to stay stopped.
2157 /// At least one hook asked to continue, and none asked to stay stopped.
2159 /// A hook resumed the process itself.
2161 };
2162
2163 /// Run \p active_hooks and \p active_unified_hooks at the process's current
2164 /// stop, on each thread that stopped for a reason. An attach or a core file
2165 /// may not say which thread stopped, so at the initial stop they run on the
2166 /// first thread instead.
2168 RunStopHooksAtCurrentStop(llvm::ArrayRef<StopHookSP> active_hooks,
2169 llvm::ArrayRef<HookSP> active_unified_hooks,
2170 bool at_initial_stop);
2171
2172 /// Implementing of ModuleList::Notifier.
2173
2174 void NotifyModuleAdded(const ModuleList &module_list,
2175 const lldb::ModuleSP &module_sp) override;
2176
2177 void NotifyModuleRemoved(const ModuleList &module_list,
2178 const lldb::ModuleSP &module_sp) override;
2179
2180 void NotifyModuleUpdated(const ModuleList &module_list,
2181 const lldb::ModuleSP &old_module_sp,
2182 const lldb::ModuleSP &new_module_sp) override;
2183
2184 void NotifyWillClearList(const ModuleList &module_list) override;
2185
2186 void NotifyModulesRemoved(lldb_private::ModuleList &module_list) override;
2187
2188 class Arch {
2189 public:
2190 explicit Arch(const ArchSpec &spec);
2191 const Arch &operator=(const ArchSpec &spec);
2192
2193 const ArchSpec &GetSpec() const { return m_spec; }
2194 Architecture *GetPlugin() const { return m_plugin_up.get(); }
2195
2196 private:
2198 std::unique_ptr<Architecture> m_plugin_up;
2199 };
2200
2201 // Member variables.
2203 lldb::PlatformSP m_platform_sp; ///< The platform for this target.
2204 std::recursive_mutex m_mutex; ///< An API mutex that is used by the lldb::SB*
2205 /// classes make the SB interface thread safe
2206 /// When the private state thread calls SB API's - usually because it is
2207 /// running OS plugin or Python ThreadPlan code - it should not block on the
2208 /// API mutex that is held by the code that kicked off the sequence of events
2209 /// that led us to run the code. We hand out this mutex instead when we
2210 /// detect that code is running on the private state thread.
2211 std::recursive_mutex m_private_mutex;
2213 std::string m_label;
2214 ModuleList m_images; ///< The list of images for this process (shared
2215 /// libraries and anything dynamically loaded).
2216 /// The marked main executable. Weak, so it can't outlive its image.
2222 using BreakpointNameMap = llvm::StringMap<std::unique_ptr<BreakpointName>>;
2224
2225 std::map<lldb::user_id_t, BreakpointResolverOverrideUP>
2227 /// This is the ID that will be handed out for the next added breakpoint
2228 /// override resolver for this target.
2230
2234 // We want to tightly control the process destruction process so we can
2235 // correctly tear down everything that we need to, so the only class that
2236 // knows about the process lifespan is this target class.
2241
2242 /// Map of scripted frame provider descriptors for this target.
2243 /// Keys are the provider descriptor IDs, values are the descriptors.
2244 /// Insertion order is preserved so that equal-priority providers chain
2245 /// in registration order.
2246 llvm::MapVector<uint32_t, ScriptedFrameProviderDescriptor>
2248 mutable std::recursive_mutex m_frame_provider_descriptors_mutex;
2250
2251 typedef std::map<lldb::LanguageType, lldb::REPLSP> REPLMap;
2253
2255
2256 typedef std::map<lldb::user_id_t, StopHookSP> StopHookCollection;
2259 std::vector<StopHookSP> m_internal_stop_hooks;
2260 uint32_t m_latest_stop_hook_id; /// This records the last natural stop at
2261 /// which we ran a stop-hook.
2263 bool m_suppress_stop_hooks; /// Used to not run stop hooks for expressions
2264
2265 /// The UUIDs of the modules we auto-loaded scripts for. We keep them when a
2266 /// module leaves m_images, so a dynamic loader re-adding it doesn't run its
2267 /// scripts again.
2268 llvm::SmallDenseSet<UUID> m_loaded_scripts;
2270 /// The stop hooks and hooks that a module's __lldb_module_added_to_target
2271 /// adds for this target, collected while it runs, so we can run the ones
2272 /// added with --at-initial-stop once it returns.
2273 ///
2274 /// One ModulesDidLoad call loads its modules' scripts one at a time, on the
2275 /// calling thread, after reading their symbols in parallel. But the dynamic
2276 /// loader on the private state thread and an SB API client, for example
2277 /// with SBTarget::AddModule, can each load scripts for this target at the
2278 /// same time, so the mutex guards the rest. We only hold it to update these
2279 /// fields, never while calling out.
2281 mutable std::mutex mutex;
2282 bool collecting = false;
2283 std::vector<StopHookSP> stop_hooks;
2284 std::vector<HookSP> hooks;
2285 };
2288
2289 typedef std::map<lldb::user_id_t, HookSP> HookCollection;
2294 LLDB_INVALID_GLOBALLY_UNIQUE_TARGET_ID; ///< The globally unique ID
2295 /// assigned to this target
2296 std::string m_target_session_name; ///< The target session name for this
2297 /// target, used to name debugging
2298 /// sessions in DAP.
2299 /// An optional \a lldb_private::Trace object containing processor trace
2300 /// information of this target.
2302 /// Stores the frame recognizers of this target.
2304 /// These are used to set the signal state when you don't have a process and
2305 /// more usefully in the Dummy target where you can't know exactly what
2306 /// signals you will have.
2307 llvm::StringMap<DummySignalValues> m_dummy_signals;
2308
2309 /// Every target group this target belongs to.
2311
2313
2314 static void ImageSearchPathsChanged(const PathMappingList &path_list,
2315 void *baton);
2316
2317 // Utilities for `statistics` command.
2318private:
2319 // Target metrics storage.
2321
2322public:
2323 /// Get metrics associated with this target in JSON format.
2324 ///
2325 /// Target metrics help measure timings and information that is contained in
2326 /// a target. These are designed to help measure performance of a debug
2327 /// session as well as represent the current state of the target, like
2328 /// information on the currently modules, currently set breakpoints and more.
2329 ///
2330 /// \return
2331 /// Returns a JSON value that contains all target metrics.
2332 llvm::json::Value
2334
2335 void ResetStatistics();
2336
2338
2339protected:
2340 /// Construct with optional file and arch.
2341 ///
2342 /// This member is private. Clients must use
2343 /// TargetList::CreateTarget(const FileSpec*, const ArchSpec*)
2344 /// so all targets can be tracked from the central target list.
2345 ///
2346 /// \see TargetList::CreateTarget(const FileSpec*, const ArchSpec*)
2347 Target(Debugger &debugger, const ArchSpec &target_arch,
2348 const lldb::PlatformSP &platform_sp, bool is_dummy_target);
2349
2350 // Helper function.
2351 bool ProcessIsValid();
2352
2353 // Copy breakpoints, stop hooks and so forth from the dummy target:
2354 void PrimeFromDummyTarget(Target &target);
2355
2356 void AddBreakpoint(lldb::BreakpointSP breakpoint_sp, bool internal);
2357
2359
2360 /// Return a recommended size for memory reads at \a addr, optimizing for
2361 /// cache usage.
2363
2364 Target(const Target &) = delete;
2365 const Target &operator=(const Target &) = delete;
2366
2368 return m_section_load_history.GetCurrentSectionLoadList();
2369 }
2370};
2371
2372} // namespace lldb_private
2373
2374#endif // LLDB_TARGET_TARGET_H
static llvm::raw_ostream & error(Stream &strm)
A section + offset based address class.
Definition Address.h:62
An architecture specification class.
Definition ArchSpec.h:32
A command line argument class.
Definition Args.h:33
General Outline: Allows adding and removing breakpoints and find by ID and index.
"lldb/Breakpoint/BreakpointOptions.h" Class that manages the options on a breakpoint or breakpoint lo...
General Outline: A breakpoint has four main parts, a filter, a resolver, the list of breakpoint locat...
Definition Breakpoint.h:83
Broadcaster(lldb::BroadcasterManagerSP manager_sp, std::string name)
Construct with a broadcaster with a name.
Generic representation of a type in a programming language.
A uniqued constant string class.
Definition ConstString.h:40
A class to manage flag bits.
Definition Debugger.h:106
void SetPreferredSymbolContexts(SymbolContextList contexts)
Definition Target.h:380
void SetOneThreadTimeout(const Timeout< std::micro > &timeout)
Definition Target.h:439
void SetUnwindOnError(bool unwind=false)
Definition Target.h:412
SourceLanguage GetLanguage() const
Definition Target.h:374
const char * GetPoundLineFilePath() const
Definition Target.h:502
lldb::DynamicValueType m_use_dynamic
Definition Target.h:578
void SetExecutionPolicy(ExecutionPolicy policy=eExecutionPolicyAlways)
Definition Target.h:370
Timeout< std::micro > m_one_thread_timeout
Definition Target.h:580
bool InvokeCancelCallback(lldb::ExpressionEvaluationPhase phase) const
Definition Target.h:484
lldb::DynamicValueType GetUseDynamic() const
Definition Target.h:424
void SetKeepInMemory(bool keep=true)
Definition Target.h:422
bool m_try_DIL_first
If enabled, Data Inspection Language (DIL) should attempt to evaluate the expression first.
Definition Target.h:576
void SetCoerceToId(bool coerce=true)
Definition Target.h:408
void SetLanguage(lldb::LanguageType language_type)
Definition Target.h:376
ExecutionPolicy GetExecutionPolicy() const
Definition Target.h:368
Timeout< std::micro > m_timeout
Definition Target.h:579
void SetCppIgnoreContextQualifiers(bool value)
Definition Target.cpp:6355
const StructuredData::Dictionary & GetLanguageOptions() const
Definition Target.cpp:6333
llvm::Expected< bool > GetBooleanLanguageOption(llvm::StringRef option_name) const
Get the language-plugin specific boolean option called option_name.
Definition Target.cpp:6317
void SetPrefix(const char *prefix)
Definition Target.h:401
void SetTryAllThreads(bool try_others=true)
Definition Target.h:445
static constexpr std::chrono::milliseconds default_timeout
Definition Target.h:360
void SetPoundLine(const char *path, uint32_t line) const
Definition Target.h:492
void SetRetriesWithFixIts(uint64_t number_of_retries)
Definition Target.h:518
SymbolContextList m_preferred_lookup_contexts
During expression evaluation, any SymbolContext in this list will be used for symbol/function lookup ...
Definition Target.h:596
void SetTimeout(const Timeout< std::micro > &timeout)
Definition Target.h:433
static constexpr ExecutionPolicy default_execution_policy
Definition Target.h:365
void SetStopOthers(bool stop_others=true)
Definition Target.h:449
bool m_running_utility_expression
True if the executed code should be treated as utility code that is only used by LLDB internally.
Definition Target.h:572
llvm::Error SetBooleanLanguageOption(llvm::StringRef option_name, bool value)
Set language-plugin specific option called option_name to the specified boolean value.
Definition Target.cpp:6300
StructuredData::DictionarySP m_language_options_sp
Dictionary mapping names of language-plugin specific options to values.
Definition Target.h:591
void SetCancelCallback(lldb::ExpressionCancelCallback callback, void *baton)
Definition Target.h:479
const Timeout< std::micro > & GetTimeout() const
Definition Target.h:431
const SymbolContextList & GetPreferredSymbolContexts() const
Definition Target.h:384
void SetIgnoreBreakpoints(bool ignore=false)
Definition Target.h:416
void SetLanguage(uint16_t name, uint32_t version)
Set the language using a pair of language code and version as defined by the DWARF 6 specification.
Definition Target.h:391
void SetUseDynamic(lldb::DynamicValueType dynamic=lldb::eDynamicCanRunTarget)
Definition Target.h:427
lldb::ExpressionCancelCallback m_cancel_callback
Definition Target.h:581
const Timeout< std::micro > & GetOneThreadTimeout() const
Definition Target.h:435
"lldb/Target/ExecutionContextScope.h" Inherit from this if your object can reconstruct its execution ...
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
A file collection class.
A file utility class.
Definition FileSpec.h:56
Encapsulates a function that can be called.
A collection class for Module objects.
Definition ModuleList.h:130
A class that describes an executable image and its associated object and symbol files.
Definition Module.h:92
Class that provides a registry of known stack frame recognizers.
An error handling class.
Definition Status.h:118
A stream class that can stream formatted output to a file.
Definition Stream.h:28
size_t Indent(llvm::StringRef s="")
Indent the current line in the stream.
Definition Stream.cpp:157
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Definition Stream.cpp:134
std::shared_ptr< Dictionary > DictionarySP
std::shared_ptr< Object > ObjectSP
A class that wraps a std::map of SummaryStatistics objects behind a mutex.
Definition Statistics.h:283
Defines a list of symbol context objects.
Defines a symbol context baton that can be handed other debug core functions.
A Lockable handle over a Target's API mutex, returned by Target::GetAPIMutex() and backing the public...
bool GetUseDILForCreatingValues() const
Definition Target.cpp:5389
uint32_t GetMaximumSizeOfStringSummary() const
Definition Target.cpp:5821
FileSpecList GetDebugFileSearchPaths()
Definition Target.cpp:5696
llvm::StringRef GetLaunchWorkingDirectory() const
Definition Target.cpp:5502
bool GetDisplayRecognizedArguments() const
Definition Target.cpp:5992
ImportStdModule GetImportStdModule() const
Definition Target.cpp:5712
void AppendExecutableSearchPaths(const FileSpec &)
Definition Target.cpp:5683
bool GetEnableSyntheticValue() const
Definition Target.cpp:5788
void SetStandardInputPath(const char *path)=delete
ProcessLaunchInfo m_launch_info
Definition Target.h:343
bool GetCheckValueObjectOwnership() const
Definition Target.cpp:6120
uint64_t GetExprAllocAlign() const
Definition Target.cpp:5900
MemoryModuleLoadLevel GetMemoryModuleLoadLevel() const
Definition Target.cpp:5964
llvm::StringRef GetArg0() const
Definition Target.cpp:5555
uint32_t GetMaximumMemReadSize() const
Definition Target.cpp:5827
void SetRunArguments(const Args &args)
Definition Target.cpp:5572
FileSpec GetStandardErrorPath() const
Definition Target.cpp:5853
void SetLoadScriptFromSymbolFile(LoadScriptFromSymFile load_style)
Set the target-wide target.load-script-from-symbol-file setting.
Definition Target.cpp:5944
bool GetEnableNotifyAboutFixIts() const
Definition Target.cpp:5738
bool SetPreferDynamicValue(lldb::DynamicValueType d)
Definition Target.cpp:5439
void SetDisplayRecognizedArguments(bool b)
Definition Target.cpp:5998
void SetUseDILForCreatingValues(bool b)
Definition Target.cpp:5407
std::optional< bool > GetExperimentalPropertyValue(size_t prop_idx, ExecutionContext *exe_ctx=nullptr) const
Definition Target.cpp:5372
const ProcessLaunchInfo & GetProcessLaunchInfo() const
Definition Target.cpp:6003
Environment ComputeEnvironment() const
Definition Target.cpp:5578
void SetStandardOutputPath(const char *path)=delete
bool GetUserSpecifiedTrapHandlerNames(Args &args) const
Definition Target.cpp:5971
uint64_t GetExprErrorLimit() const
Definition Target.cpp:5882
bool GetEnableAutoImportClangModules() const
Definition Target.cpp:5706
bool GetDebugUtilityExpression() const
Definition Target.cpp:6109
JITEngine GetJITEngine() const
Definition Target.cpp:5749
DynamicClassInfoHelper GetDynamicClassInfoHelper() const
Definition Target.cpp:5719
FileSpec GetStandardOutputPath() const
Definition Target.cpp:5843
void SetDisplayRuntimeSupportValues(bool b)
Definition Target.cpp:5987
uint32_t GetMaximumNumberOfChildrenToDisplay() const
Definition Target.cpp:5806
void SetRequireHardwareBreakpoints(bool b)
Definition Target.cpp:6041
lldb::BreakpointConditionMode GetBreakpointsConditionMode() const
Definition Target.cpp:5912
bool GetAutoInstallMainExecutable() const
Definition Target.cpp:6046
const char * GetDisassemblyFeatures() const
Definition Target.cpp:5534
void SetAutoLoadScriptsForModule(llvm::StringRef module_name, LoadScriptFromSymFile load_style)
Set the LoadScriptFromSymFile for a module called module_name (excluding file extension).
Definition Target.cpp:6146
RealpathPrefixes GetSourceRealpathPrefixes() const
Definition Target.cpp:5550
void SetCheckValueObjectOwnership(bool check)
Definition Target.cpp:6126
uint64_t GetNumberOfRetriesWithFixits() const
Definition Target.cpp:5732
uint64_t GetExprAllocSize() const
Definition Target.cpp:5894
std::optional< LoadScriptFromSymFile > GetAutoLoadScriptsForModule(llvm::StringRef module_name) const
Definition Target.cpp:6132
llvm::StringRef GetExpressionPrefixContents()
Definition Target.cpp:5868
PathMappingList & GetObjectPathMap() const
Definition Target.cpp:5669
const char * GetDisassemblyFlavor() const
Definition Target.cpp:5514
FileSpec GetStandardInputPath() const
Definition Target.cpp:5833
lldb::DynamicValueType GetPreferDynamicValue() const
Definition Target.cpp:5432
InlineStrategy GetInlineStrategy() const
Definition Target.cpp:5541
Environment GetTargetEnvironment() const
Definition Target.cpp:5638
bool GetDisplayRuntimeSupportValues() const
Definition Target.cpp:5981
void SetUserSpecifiedTrapHandlerNames(const Args &args)
Definition Target.cpp:5976
uint32_t GetMaxZeroPaddingInFloatFormat() const
Definition Target.cpp:5800
uint64_t GetExprAllocAddress() const
Definition Target.cpp:5888
LoadCWDlldbinitFile GetLoadCWDlldbinitFile() const
Definition Target.cpp:5950
Environment GetInheritedEnvironment() const
Definition Target.cpp:5610
void SetArg0(llvm::StringRef arg)
Definition Target.cpp:5561
bool GetInjectLocalVariables(ExecutionContext *exe_ctx) const
Definition Target.cpp:5383
void SetStandardErrorPath(const char *path)=delete
bool ShowHexVariableValuesWithLeadingZeroes() const
Definition Target.cpp:5794
SourceLanguage GetLanguage() const
Definition Target.cpp:5863
Environment GetEnvironment() const
Definition Target.cpp:5606
void SetProcessLaunchInfo(const ProcessLaunchInfo &launch_info)
Definition Target.cpp:6007
FileSpec GetSaveJITObjectsDir() const
Definition Target.cpp:5744
void SetEnvironment(Environment env)
Definition Target.cpp:5649
LoadScriptFromSymFile GetLoadScriptFromSymbolFile() const
Definition Target.cpp:5937
const char * GetDisassemblyCPU() const
Definition Target.cpp:5527
void SetStandardErrorPath(llvm::StringRef path)
Definition Target.cpp:5858
bool GetRunArguments(Args &args) const
Definition Target.cpp:5567
FileSpecList GetExecutableSearchPaths()
Definition Target.cpp:5691
ArchSpec GetDefaultArchitecture() const
Definition Target.cpp:5416
Disassembler::HexImmediateStyle GetHexImmediateStyle() const
Definition Target.cpp:5957
std::unique_ptr< TargetExperimentalProperties > m_experimental_properties_up
Definition Target.h:344
FileSpecList GetClangModuleSearchPaths()
Definition Target.cpp:5701
void SetStandardOutputPath(llvm::StringRef path)
Definition Target.cpp:5848
bool GetRequireHardwareBreakpoints() const
Definition Target.cpp:6035
PathMappingList & GetSourcePathMap() const
Definition Target.cpp:5661
bool GetReloadModuleScripts() const
Definition Target.cpp:5402
bool GetAutoSourceMapRelative() const
Definition Target.cpp:5677
void SetDefaultArchitecture(const ArchSpec &arch)
Definition Target.cpp:5421
void SetStandardInputPath(llvm::StringRef path)
Definition Target.cpp:5838
TargetProperties(Target *target)
Definition Target.cpp:5296
bool GetDisplayExpressionsInCrashlogs() const
Definition Target.cpp:5931
bool GetEnableAutoApplyFixIts() const
Definition Target.cpp:5726
void SetDebugUtilityExpression(bool debug)
Definition Target.cpp:6115
std::pair< uint32_t, bool > GetMaximumDepthOfChildrenToDisplay() const
Get the max depth value, augmented with a bool to indicate whether the depth is the default.
Definition Target.cpp:5813
A class that represents statistics for a since lldb_private::Target.
Definition Statistics.h:311
std::unique_ptr< Architecture > m_plugin_up
Definition Target.h:2198
const ArchSpec & GetSpec() const
Definition Target.h:2193
const Arch & operator=(const ArchSpec &spec)
Definition Target.cpp:171
Arch(const ArchSpec &spec)
Definition Target.cpp:167
Architecture * GetPlugin() const
Definition Target.h:2194
virtual BreakpointResolverOverrideUP CopyIntoNewTarget(Target &target)=0
BreakpointResolverOverride(Target &target, const std::string &description, uint64_t type_mask)
Definition Target.h:1059
virtual lldb::BreakpointResolverSP CheckForOverride(Target &target, lldb::BreakpointResolverSP initial_sp)=0
void AddTrigger(uint32_t trigger)
Add a trigger to the mask. trigger is a single TriggerBit value.
Definition Target.h:1915
void RemoveTrigger(uint32_t trigger)
Remove a trigger from the mask. trigger is a single TriggerBit value.
Definition Target.h:1918
void GetDescription(Stream &s, lldb::DescriptionLevel level) const override
Definition Target.cpp:4695
HookCommandLine(lldb::TargetSP target_sp, lldb::user_id_t uid)
Definition Target.h:1938
void SetTriggerMask(uint32_t mask)
Replace the trigger mask. mask is a bitwise OR of TriggerBit values.
Definition Target.h:1912
void SetActionFromString(const std::string &string)
Populate the command list by splitting a single string on newlines.
Definition Target.cpp:4722
void SetActionFromStrings(const std::vector< std::string > &strings)
Populate the command list from a vector of individual command strings.
Definition Target.cpp:4726
void HandleModuleLoaded(lldb::StreamSP output) override
Definition Target.cpp:4732
StringList & GetCommands()
Return the list of commands that this hook runs.
Definition Target.h:1921
StopHook::StopHookResult HandleStop(ExecutionContext &exe_ctx, lldb::StreamSP output) override
Called when the process stops.
Definition Target.cpp:4772
void HandleModuleUnloaded(lldb::StreamSP output) override
Definition Target.cpp:4766
llvm::StringRef GetScriptClassName() const
Definition Target.cpp:4904
Status SetScriptCallback(const ScriptedMetadata &scripted_metadata)
Definition Target.cpp:4807
void HandleModuleLoaded(lldb::StreamSP output) override
Definition Target.cpp:4849
StopHook::StopHookResult HandleStop(ExecutionContext &exe_ctx, lldb::StreamSP output) override
Called when the process stops.
Definition Target.cpp:4882
HookScripted(lldb::TargetSP target_sp, lldb::user_id_t uid)
Definition Target.h:1961
void GetDescription(Stream &s, lldb::DescriptionLevel level) const override
Definition Target.cpp:4910
lldb::ScriptedHookInterfaceSP m_interface_sp
Definition Target.h:1959
void HandleModuleUnloaded(lldb::StreamSP output) override
Definition Target.cpp:4865
virtual ~Hook()=default
void SetSuppressOutput(bool suppress_output)
Definition Target.h:1866
bool GetRunAtInitialStop() const
Definition Target.h:1857
ThreadSpec * GetThreadSpecifier()
Definition Target.h:1852
TriggerBit
Individual trigger bits. Combine with bitwise OR to form a trigger mask.
Definition Target.h:1822
bool GetSuppressOutput() const
Definition Target.h:1869
void SetRunAtInitialStop(bool at_initial_stop)
Definition Target.h:1854
lldb::SymbolContextSpecifierSP m_sc_specifier_sp
Definition Target.h:1896
void SetIsEnabled(bool enabled)
Definition Target.h:1831
bool ExecutionContextPasses(const ExecutionContext &exe_ctx)
Check if the execution context passes the specifier and thread spec filters.
Definition Target.cpp:4618
HookKind GetHookKind() const
Definition Target.h:1818
Hook(const Hook &rhs)
Definition Target.cpp:4599
virtual StopHook::StopHookResult HandleStop(ExecutionContext &exe_ctx, lldb::StreamSP output)
Called when the process stops.
Definition Target.h:1878
void GetFilterDescription(Stream &s, lldb::DescriptionLevel level) const
Print the filter portion of the description (AutoContinue, Specifier, ThreadSpec).
Definition Target.cpp:4667
void SetAutoContinue(bool auto_continue)
Definition Target.h:1861
bool GetAutoContinue() const
Definition Target.h:1864
virtual void HandleModuleUnloaded(lldb::StreamSP output)
Definition Target.h:1874
uint32_t GetTriggerMask() const
Return the bitmask of triggers this hook responds to.
Definition Target.h:1835
lldb::TargetSP & GetTarget()
Definition Target.h:1828
SymbolContextSpecifier * GetSCSpecifier()
Definition Target.h:1844
lldb::TargetSP m_target_sp
Definition Target.h:1890
virtual void GetDescription(Stream &s, lldb::DescriptionLevel level) const
Definition Target.cpp:4634
void SetSCSpecifier(SymbolContextSpecifier *specifier)
Set the symbol context specifier. The hook takes ownership.
Definition Target.cpp:4610
void SetThreadSpecifier(ThreadSpec *specifier)
Set the thread specifier. The hook takes ownership.
Definition Target.cpp:4614
virtual void HandleModuleLoaded(lldb::StreamSP output)
Definition Target.h:1873
bool FiresOn(uint32_t trigger) const
Return true if this hook fires on the given trigger.
Definition Target.h:1838
std::unique_ptr< ThreadSpec > m_thread_spec_up
Definition Target.h:1897
void GetSubclassDescription(Stream &s, lldb::DescriptionLevel level) const override
Definition Target.h:1775
HandleStopCallback * m_callback
Definition Target.h:1783
StopHookResult HandleStop(ExecutionContext &exc_ctx, lldb::StreamSP output) override
Definition Target.h:1770
StopHookCoded(lldb::TargetSP target_sp, lldb::user_id_t uid)
Use CreateStopHook to make a new empty stop hook.
Definition Target.h:1788
void SetCallback(llvm::StringRef name, HandleStopCallback *callback)
Definition Target.h:1765
StopHookResult(ExecutionContext &exc_ctx, lldb::StreamSP output) HandleStopCallback
Definition Target.h:1762
void SetActionFromString(const std::string &strings)
Definition Target.cpp:4432
StopHookCommandLine(lldb::TargetSP target_sp, lldb::user_id_t uid)
Definition Target.h:1729
void SetActionFromStrings(const std::vector< std::string > &strings)
Definition Target.cpp:4436
StopHookResult HandleStop(ExecutionContext &exc_ctx, lldb::StreamSP output_sp) override
Definition Target.cpp:4443
void GetSubclassDescription(Stream &s, lldb::DescriptionLevel level) const override
Definition Target.cpp:4414
lldb::ScriptedHookInterfaceSP m_interface_sp
Definition Target.h:1748
StopHookResult HandleStop(ExecutionContext &exc_ctx, lldb::StreamSP output) override
Definition Target.cpp:4528
Status SetScriptCallback(const ScriptedMetadata &scripted_metadata)
Definition Target.cpp:4478
StopHookScripted(lldb::TargetSP target_sp, lldb::user_id_t uid)
Use CreateStopHook to make a new empty stop hook.
Definition Target.h:1753
void GetSubclassDescription(Stream &s, lldb::DescriptionLevel level) const override
Definition Target.cpp:4557
llvm::StringRef GetScriptClassName() const
Definition Target.cpp:4551
bool GetRunAtInitialStop() const
Definition Target.h:1682
SymbolContextSpecifier * GetSpecifier()
Definition Target.h:1651
void SetSpecifier(SymbolContextSpecifier *specifier)
Definition Target.cpp:4349
virtual StopHookResult HandleStop(ExecutionContext &exe_ctx, lldb::StreamSP output)=0
std::unique_ptr< ThreadSpec > m_thread_spec_up
Definition Target.h:1701
void SetIsActive(bool is_active)
Definition Target.h:1670
void SetSuppressOutput(bool suppress_output)
Definition Target.h:1688
void SetThreadSpecifier(ThreadSpec *specifier)
Definition Target.cpp:4353
ThreadSpec * GetThreadSpecifier()
Definition Target.h:1666
StopHook(const StopHook &rhs)
Definition Target.cpp:4340
bool ExecutionContextPasses(const ExecutionContext &exe_ctx)
Definition Target.cpp:4357
lldb::TargetSP & GetTarget()
Definition Target.h:1645
void SetRunAtInitialStop(bool at_initial_stop)
Definition Target.h:1678
lldb::SymbolContextSpecifierSP m_specifier_sp
Definition Target.h:1700
virtual void GetSubclassDescription(Stream &s, lldb::DescriptionLevel level) const =0
void GetDescription(Stream &s, lldb::DescriptionLevel level) const
Definition Target.cpp:4373
void SetAutoContinue(bool auto_continue)
Definition Target.h:1672
void SetOneShot(bool one_shot)
Definition Target.h:1684
const ModuleList & GetModuleList() const
Definition Target.h:671
void Dump(Stream *s) const override
Definition Target.cpp:6178
static llvm::StringRef GetFlavorString()
Definition Target.cpp:6174
static lldb::TargetSP GetCreatedTargetFromEvent(const Event *event_ptr)
Definition Target.cpp:6207
static ModuleList GetModuleListFromEvent(const Event *event_ptr)
Definition Target.cpp:6216
static const TargetEventData * GetEventDataFromEvent(const Event *event_ptr)
Definition Target.cpp:6188
llvm::StringRef GetFlavor() const override
Definition Target.h:649
const lldb::TargetSP & GetTarget() const
Definition Target.h:665
TargetEventData(const lldb::TargetSP &target_sp)
Definition Target.cpp:6160
TargetEventData(const TargetEventData &)=delete
const lldb::TargetSP & GetCreatedTarget() const
Definition Target.h:667
const TargetEventData & operator=(const TargetEventData &)=delete
static lldb::TargetSP GetTargetFromEvent(const Event *event_ptr)
Definition Target.cpp:6198
void ModulesDidLoad(ModuleList &module_list)
This call may preload module symbols, and may do so in parallel depending on the following target set...
Definition Target.cpp:2012
void RunCollectedInitialStopHooks()
Run the collected stop hooks and hooks that were added with –at-initial-stop if the process is stoppe...
Definition Target.cpp:3318
lldb::ThreadSP CalculateThread() override
Definition Target.cpp:2771
llvm::Expected< uint32_t > AddScriptedFrameProviderDescriptor(const ScriptedFrameProviderDescriptor &descriptor)
Add or update a scripted frame provider descriptor for this target.
Definition Target.cpp:4038
StopHookCollection m_stop_hooks
Definition Target.h:2257
Module * GetExecutableModulePointer()
Definition Target.cpp:1668
void Dump(Stream *s, lldb::DescriptionLevel description_level)
Dump a description of this object to a Stream.
Definition Target.cpp:265
void DisableAllBreakpoints(bool internal_also=false)
Definition Target.cpp:1196
lldb::ModuleWP m_executable_module_wp
The marked main executable. Weak, so it can't outlive its image.
Definition Target.h:2217
friend class TargetGroupList
Definition Target.h:2142
bool RemoveHookByID(lldb::user_id_t uid)
Definition Target.cpp:4977
lldb::WatchpointSP CreateWatchpoint(lldb::addr_t addr, size_t size, const CompilerType *type, uint32_t kind, Status &error)
Definition Target.cpp:1078
void ApplyNameToBreakpoints(BreakpointName &bp_name)
Definition Target.cpp:955
lldb::user_id_t m_hook_next_id
Definition Target.h:2291
std::recursive_mutex * GetAPIMutexForCurrentPolicy()
The mutex the calling thread must serialize on for its current policy, or nullptr when that policy by...
Definition Target.cpp:6228
lldb::TraceSP GetTrace()
Get the Trace object containing processor trace information of this target.
Definition Target.cpp:3913
PathMappingList & GetImageSearchPathList()
Definition Target.cpp:2780
void FinalizeFileActions(ProcessLaunchInfo &info)
Definition Target.cpp:4120
lldb::addr_t GetCallableLoadAddress(lldb::addr_t load_addr, AddressClass addr_class=AddressClass::eInvalid) const
Get load_addr as a callable code load address for this target.
Definition Target.cpp:3170
lldb::addr_t GetOpcodeLoadAddress(lldb::addr_t load_addr, AddressClass addr_class=AddressClass::eInvalid) const
Get load_addr as an opcode for this target.
Definition Target.cpp:3178
ModuleList & GetImages()
Definition Target.h:1297
lldb::BreakpointSP CreateScriptedBreakpoint(const llvm::StringRef class_name, const FileSpecList *containingModules, const FileSpecList *containingSourceFiles, bool internal, bool request_hardware, StructuredData::ObjectSP extra_args_sp, Status *creation_error=nullptr)
Definition Target.cpp:800
static Target * GetTargetFromContexts(const ExecutionContext *exe_ctx_ptr, const SymbolContext *sc_ptr)
Definition Target.cpp:3015
lldb::addr_t GetBreakableLoadAddress(lldb::addr_t addr)
Definition Target.cpp:3185
llvm::StringMap< std::unique_ptr< BreakpointName > > BreakpointNameMap
Definition Target.h:2222
void ClearDummySignals(Args &signal_names)
Clear the dummy signals in signal_names from the target, or all signals if signal_names is empty.
Definition Target.cpp:4280
bool SetSuppresStopHooks(bool suppress)
Definition Target.h:2005
static void ImageSearchPathsChanged(const PathMappingList &path_list, void *baton)
Definition Target.cpp:2784
llvm::Expected< lldb_private::Address > GetEntryPointAddress()
This method will return the address of the starting function for this binary, e.g.
Definition Target.cpp:3136
bool IgnoreWatchpointByID(lldb::watch_id_t watch_id, uint32_t ignore_count)
Definition Target.cpp:1632
lldb::BreakpointSP CreateFuncRegexBreakpoint(const FileSpecList *containingModules, const FileSpecList *containingSourceFiles, RegularExpression func_regexp, lldb::LanguageType requested_language, LazyBool skip_prologue, bool internal, bool request_hardware)
Definition Target.cpp:766
size_t GetNumHooks() const
Definition Target.h:1985
lldb::BreakpointSP GetBreakpointByID(lldb::break_id_t break_id)
Definition Target.cpp:457
std::shared_ptr< StopHook > StopHookSP
Definition Target.h:1795
llvm::StringRef GetBroadcasterClass() const override
This needs to be filled in if you are going to register the broadcaster with the broadcaster manager ...
Definition Target.h:625
void SymbolsDidLoad(ModuleList &module_list)
Definition Target.cpp:2044
bool ClearAllWatchpointHistoricValues()
Definition Target.cpp:1546
void MarkExecutableModule(const lldb::ModuleSP &module_sp)
Make module_sp the main executable without clearing the other images, unlike RebuildModuleListWithExe...
Definition Target.cpp:1672
const std::vector< StopHookSP > GetStopHooks(bool internal=false) const
Definition Target.cpp:3307
bool RecordScriptingResources(Module &module)
Record that we're auto-loading module's scripts in this target, so we only load them once.
Definition Target.cpp:1979
void RemoveTargetGroup(const TargetGroup *group)
Called only by TargetGroup::RemoveTarget to remove group membership.
Definition Target.cpp:428
void SetTrace(const lldb::TraceSP &trace_sp)
Set the Trace object containing processor trace information of this target.
Definition Target.cpp:3911
BreakpointList & GetBreakpointList(bool internal=false)
Definition Target.cpp:443
uint32_t m_next_frame_provider_id
Definition Target.h:2249
lldb_private::SummaryStatisticsCache & GetSummaryStatisticsCache()
Definition Target.cpp:3728
const llvm::MapVector< uint32_t, ScriptedFrameProviderDescriptor > & GetScriptedFrameProviderDescriptors() const
Get all scripted frame provider descriptors for this target.
Definition Target.cpp:4099
lldb::addr_t GetSectionLoadAddress(const lldb::SectionSP &section_sp)
Definition Target.cpp:6245
llvm::StringRef GetABIName() const
Returns the name of the target's ABI plugin.
Definition Target.cpp:432
SourceManager & GetSourceManager()
Definition Target.cpp:3225
lldb::SearchFilterSP GetSearchFilterForModuleList(const FileSpecList *containingModuleList)
Definition Target.cpp:729
StopHookSP GetStopHookByID(lldb::user_id_t uid)
Definition Target.cpp:3273
llvm::StringMap< DummySignalValues > m_dummy_signals
These are used to set the signal state when you don't have a process and more usefully in the Dummy t...
Definition Target.h:2307
lldb::user_id_t AddBreakpointResolverOverride(BreakpointResolverOverrideUP override_up)
Add a breakpoint override resolver. This version can't fail.
Definition Target.h:1083
lldb::ProcessSP m_process_sp
Definition Target.h:2237
Debugger & GetDebugger() const
Definition Target.h:1378
lldb::SearchFilterSP m_search_filter_sp
Definition Target.h:2238
PersistentExpressionState * GetPersistentExpressionStateForLanguage(lldb::LanguageType language)
Definition Target.cpp:2865
void UpdateSignalsFromDummy(lldb::UnixSignalsSP signals_sp, lldb::StreamSP warning_stream_sp)
Updates the signals in signals_sp using the stored dummy signals.
Definition Target.cpp:4268
static bool UpdateSignalFromDummy(lldb::UnixSignalsSP signals_sp, const DummySignalElement &element)
Definition Target.cpp:4226
PathMappingList m_image_search_paths
Definition Target.h:2239
bool ModuleIsExcludedForUnconstrainedSearches(const FileSpec &module_spec)
Return whether this FileSpec corresponds to a module that should be considered for general searches.
Definition Target.cpp:2102
lldb::StackFrameSP CalculateStackFrame() override
Definition Target.cpp:2773
SectionLoadList & GetSectionLoadList()
Definition Target.h:2367
lldb::addr_t GetPersistentSymbol(ConstString name)
Definition Target.cpp:3116
TargetAPIMutex GetAPIMutex()
Returns a handle resolved to the mutex to serialize on before touching the target through the SB API.
Definition Target.cpp:6224
void PrimeFromDummyTarget(Target &target)
Definition Target.cpp:228
bool RemoveScriptedFrameProviderDescriptor(uint32_t id)
Remove a scripted frame provider descriptor by id.
Definition Target.cpp:4074
lldb::RegisterTypeBuilderSP m_register_type_builder_sp
Definition Target.h:2312
friend class TargetGroup
Definition Target.h:2141
static void SettingsTerminate()
Definition Target.cpp:2977
bool EnableWatchpointByID(lldb::watch_id_t watch_id)
Definition Target.cpp:1597
void DeleteBreakpointName(llvm::StringRef name)
Definition Target.cpp:932
HookSP CreateHook(Hook::HookKind kind)
Definition Target.cpp:4950
bool ResolveFileAddress(lldb::addr_t load_addr, Address &so_addr)
Definition Target.cpp:3644
bool ClearAllWatchpointHitCounts()
Definition Target.cpp:1532
CompilerType GetRegisterType(const RegisterInfo &reg_info)
Definition Target.cpp:2820
size_t ReadMemoryFromFileCache(const Address &addr, void *dst, size_t dst_len, Status &error)
Definition Target.cpp:2134
void ClearAllLoadedSections()
Definition Target.cpp:3720
std::vector< lldb::TypeSystemSP > GetScratchTypeSystems(bool create_on_demand=true)
Definition Target.cpp:2828
size_t ReadScalarIntegerFromMemory(const Address &addr, uint32_t byte_size, bool is_signed, Scalar &scalar, Status &error, bool force_live_memory=false)
Definition Target.cpp:2443
void AddNameToBreakpoint(BreakpointID &id, llvm::StringRef name, Status &error)
Definition Target.cpp:877
void DumpSectionLoadList(Stream &s)
Definition Target.cpp:6251
ModuleLoadedScriptHooks m_module_added_hooks
Definition Target.h:2286
void DeleteCurrentProcess()
Definition Target.cpp:301
BreakpointList m_internal_breakpoint_list
Definition Target.h:2221
int64_t ReadSignedIntegerFromMemory(const Address &addr, size_t integer_byte_size, int64_t fail_value, Status &error, bool force_live_memory=false)
Definition Target.cpp:2474
friend class TargetAPIMutex
Definition Target.h:608
void DisableAllowedBreakpoints()
Definition Target.cpp:1206
bool SetHookEnabledStateByID(lldb::user_id_t uid, bool enabled)
Definition Target.cpp:4999
bool LoadScriptingResources(std::list< Status > &errors, bool continue_on_error=true)
Definition Target.h:1272
bool SetSectionUnloaded(const lldb::SectionSP &section_sp)
Definition Target.cpp:3698
lldb::TargetSP CalculateTarget() override
Definition Target.cpp:2767
const lldb::ProcessSP & GetProcessSP() const
Definition Target.cpp:335
void ClearModules(bool delete_locations)
Definition Target.cpp:1677
void RemoveNameFromBreakpoint(lldb::BreakpointSP &bp_sp, llvm::StringRef name)
Definition Target.cpp:942
BreakpointNameMap m_breakpoint_names
Definition Target.h:2223
bool RemoveBreakpointByID(lldb::break_id_t break_id)
Definition Target.cpp:1230
llvm::MapVector< uint32_t, ScriptedFrameProviderDescriptor > m_frame_provider_descriptors
Map of scripted frame provider descriptors for this target.
Definition Target.h:2247
static bool ResetSignalFromDummy(lldb::UnixSignalsSP signals_sp, const DummySignalElement &element)
Definition Target.cpp:4253
Architecture * GetArchitecturePlugin() const
Definition Target.h:1376
lldb::ModuleSP GetOrCreateModule(const ModuleSpec &module_spec, bool notify, Status *error_ptr=nullptr, bool invoke_symbol_locators=true)
Find a binary on the system and return its Module, or return an existing Module that is already in th...
Definition Target.cpp:2526
llvm::json::Value ReportStatistics(const lldb_private::StatisticsOptions &options)
Get metrics associated with this target in JSON format.
Definition Target.cpp:6237
friend class TargetList
Definition Target.h:606
FunctionCaller * GetFunctionCallerForLanguage(lldb::LanguageType language, const CompilerType &return_type, const Address &function_address, const ValueList &arg_value_list, const char *name, Status &error)
Definition Target.cpp:2918
TargetStats & GetStatistics()
Definition Target.h:2337
void EnableAllBreakpoints(bool internal_also=false)
Definition Target.cpp:1213
Status Launch(ProcessLaunchInfo &launch_info, Stream *stream)
Definition Target.cpp:3743
bool DisableBreakpointByID(lldb::break_id_t break_id)
Definition Target.cpp:1250
lldb::BreakpointSP CreateBreakpointAtUserEntry(Status &error)
Definition Target.cpp:469
std::map< lldb::user_id_t, StopHookSP > StopHookCollection
Definition Target.h:2256
llvm::Expected< lldb::TraceSP > CreateTrace()
Create a Trace object for the current target using the using the default supported tracing technology...
Definition Target.cpp:3915
lldb::TraceSP m_trace_sp
An optional lldb_private::Trace object containing processor trace information of this target.
Definition Target.h:2301
lldb::user_id_t GetGloballyUniqueID() const
Get the globally unique ID for this target.
Definition Target.h:707
bool RemoveAllWatchpoints(bool end_to_end=true)
Definition Target.cpp:1450
bool ReadPointerFromMemory(const Address &addr, Status &error, Address &pointer_addr, bool force_live_memory=false)
Definition Target.cpp:2496
TargetGroupList m_target_groups
Every target group this target belongs to.
Definition Target.h:2310
void UndoCreateStopHook(lldb::user_id_t uid)
If you tried to create a stop hook, and that failed, call this to remove the stop hook,...
Definition Target.cpp:3259
StopHooksVote RunStopHooksAtCurrentStop(llvm::ArrayRef< StopHookSP > active_hooks, llvm::ArrayRef< HookSP > active_unified_hooks, bool at_initial_stop)
Run active_hooks and active_unified_hooks at the process's current stop, on each thread that stopped ...
Definition Target.cpp:3434
WatchpointList m_watchpoint_list
Definition Target.h:2232
BreakpointList m_breakpoint_list
Definition Target.h:2220
void DescribeBreakpointOverrides(Stream &stream, std::vector< lldb::user_id_t > &idxs, uint32_t terminal_width, bool use_color)
Describe the breakpoint overrides.
Definition Target.cpp:1009
lldb::SourceManagerUP m_source_manager_up
Definition Target.h:2254
lldb::user_id_t m_override_id
This is the ID that will be handed out for the next added breakpoint override resolver for this targe...
Definition Target.h:2229
bool RemoveWatchpointByID(lldb::watch_id_t watch_id)
Definition Target.cpp:1616
bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr, uint32_t stop_id=SectionLoadHistory::eStopIDNow, bool allow_section_end=false)
Definition Target.cpp:3638
size_t ReadStringFromMemory(const Address &addr, char *dst, size_t max_bytes, Status &error, size_t type_width, bool force_live_memory=true)
Read a null-terminated string from memory.
Definition Target.cpp:2394
HookSP GetHookByID(lldb::user_id_t uid)
Definition Target.cpp:4984
void NotifyWillClearList(const ModuleList &module_list) override
Definition Target.cpp:1941
bool SetArchitecture(const ArchSpec &arch_spec, bool set_platform=false, bool merge=true)
Set the architecture for this target.
Definition Target.cpp:1825
void ClearBreakpointResolverOverrides()
Definition Target.h:1101
bool RemoveBreakpointResolverOverride(lldb::user_id_t override_id)
Definition Target.h:1096
void NotifyModuleAdded(const ModuleList &module_list, const lldb::ModuleSP &module_sp) override
Implementing of ModuleList::Notifier.
Definition Target.cpp:1943
llvm::Expected< lldb::TypeSystemSP > GetScratchTypeSystemForLanguage(lldb::LanguageType language, bool create_on_demand=true)
Definition Target.cpp:2793
void ConfigureBreakpointName(BreakpointName &bp_name, const BreakpointOptions &options, const BreakpointName::Permissions &permissions)
Definition Target.cpp:947
lldb_private::SummaryStatisticsSP GetSummaryStatisticsSPForProviderName(lldb_private::TypeSummaryImpl &summary_provider)
Definition Target.cpp:3722
lldb::SearchFilterSP GetSearchFilterForModuleAndCUList(const FileSpecList *containingModules, const FileSpecList *containingSourceFiles)
Definition Target.cpp:746
lldb::ModuleSP GetExecutableModule()
Gets the module for the main executable.
Definition Target.cpp:1648
bool SetStopHookActiveStateByID(lldb::user_id_t uid, bool active_state)
Definition Target.cpp:3283
const lldb::ProcessSP & CreateProcess(lldb::ListenerSP listener_sp, llvm::StringRef plugin_name, const FileSpec *crash_file, bool can_connect)
Definition Target.cpp:323
void SetAllStopHooksActiveState(bool active_state)
Definition Target.cpp:3294
std::vector< StopHookSP > m_internal_stop_hooks
Definition Target.h:2259
lldb::ExpressionVariableSP GetPersistentVariable(ConstString name)
Definition Target.cpp:3097
void NotifyModulesRemoved(lldb_private::ModuleList &module_list) override
Definition Target.cpp:1975
StopHookSP CreateStopHook(StopHook::StopHookKind kind, bool internal=false)
Add an empty stop hook to the Target's stop hook list, and returns a shared pointer to the new hook.
Definition Target.cpp:3231
size_t ReadCStringFromMemory(const Address &addr, std::string &out_str, Status &error, bool force_live_memory=false)
Definition Target.cpp:2304
void SetAllHooksEnabledState(bool enabled)
Definition Target.cpp:5007
std::recursive_mutex m_mutex
An API mutex that is used by the lldb::SB* classes make the SB interface thread safe.
Definition Target.h:2204
std::recursive_mutex m_frame_provider_descriptors_mutex
Definition Target.h:2248
lldb::user_id_t m_target_unique_id
The globally unique ID assigned to this target.
Definition Target.h:2293
void ModulesDidUnload(ModuleList &module_list, bool delete_locations)
Definition Target.cpp:2060
void CalculateExecutionContext(ExecutionContext &exe_ctx) override
Reconstruct the object's execution context into sc.
Definition Target.cpp:2775
llvm::Expected< lldb::DisassemblerSP > ReadInstructions(const Address &start_addr, uint32_t count, const char *flavor_string=nullptr)
Definition Target.cpp:3191
llvm::Expected< lldb::TraceSP > GetTraceOrCreate()
If a Trace object is present, this returns it, otherwise a new Trace is created with Trace::CreateTra...
Definition Target.cpp:3940
void NotifyModuleUpdated(const ModuleList &module_list, const lldb::ModuleSP &old_module_sp, const lldb::ModuleSP &new_module_sp) override
Definition Target.cpp:1963
StopHooksVote
What the stop hooks that ran at a stop ask us to do with the process.
Definition Target.h:2154
@ Stop
No hook asked to continue, or one asked to stay stopped.
Definition Target.h:2156
@ Continue
At least one hook asked to continue, and none asked to stay stopped.
Definition Target.h:2158
@ AlreadyContinued
A hook resumed the process itself.
Definition Target.h:2160
bool IsCollectingHooks() const
Definition Target.h:2024
void AddTargetGroup(const lldb::TargetGroupSP &group_sp)
Called only by TargetGroup::AddTarget to record group membership.
Definition Target.cpp:424
SummaryStatisticsCache m_summary_statistics_cache
Definition Target.h:2218
std::mutex m_loaded_scripts_mutex
Definition Target.h:2269
Target(const Target &)=delete
void RegisterInternalStopHooks()
Status SerializeBreakpointsToFile(const FileSpec &file, const BreakpointIDList &bp_ids, bool append)
Definition Target.cpp:1291
void DidExec()
Called as the last function in Process::DidExec().
Definition Target.cpp:1685
void SaveScriptedLaunchInfo(lldb_private::ProcessInfo &process_info)
Definition Target.cpp:3732
bool GetSuppressStopHooks()
Definition Target.h:2011
std::string m_label
Definition Target.h:2213
lldb::user_id_t m_stop_hook_next_id
Definition Target.h:2258
static FileSpecList GetDefaultExecutableSearchPaths()
Definition Target.cpp:2979
lldb::BreakpointSP CreateExceptionBreakpoint(enum lldb::LanguageType language, bool catch_bp, bool throw_bp, bool internal, Args *additional_args=nullptr, Status *additional_args_error=nullptr)
Definition Target.cpp:783
void NotifyBreakpointChanged(Breakpoint &bp, lldb::BreakpointEventType event_kind)
Sends a breakpoint notification event.
Definition Target.cpp:6255
lldb::SearchFilterSP GetSearchFilterForModule(const FileSpec *containingModule)
Definition Target.cpp:711
llvm::StringMapEntry< DummySignalValues > DummySignalElement
Definition Target.h:2101
static llvm::StringRef GetStaticBroadcasterClass()
Definition Target.cpp:177
static FileSpecList GetDefaultDebugFileSearchPaths()
Definition Target.cpp:2983
void EnableAllowedBreakpoints()
Definition Target.cpp:1223
virtual size_t ReadMemory(const Address &addr, void *dst, size_t dst_len, Status &error, bool force_live_memory=false, lldb::addr_t *load_addr_ptr=nullptr, bool *did_read_live_memory=nullptr)
Definition Target.cpp:2167
llvm::Error SetLabel(llvm::StringRef label)
Set a label for a target.
Definition Target.cpp:2998
uint32_t m_latest_stop_hook_id
Definition Target.h:2260
void RunModuleHooks(bool is_load)
Definition Target.cpp:5012
std::map< lldb::user_id_t, BreakpointResolverOverrideUP > m_breakpoint_overrides
Definition Target.h:2226
bool SetCollectingHooks(bool collecting)
Collect the stop hooks and hooks added while collecting is true.
Definition Target.h:2019
StackFrameRecognizerManager & GetFrameRecognizerManager()
Definition Target.h:2077
void RemoveAllowedBreakpoints()
Definition Target.cpp:1175
bool DisableAllWatchpoints(bool end_to_end=true)
Definition Target.cpp:1479
bool RunStopHooks(bool at_initial_stop=false)
Definition Target.cpp:3363
void ClearSectionLoadList()
Definition Target.cpp:6249
const Target & operator=(const Target &)=delete
lldb::addr_t GetReasonableReadSize(const Address &addr)
Return a recommended size for memory reads at addr, optimizing for cache usage.
Definition Target.cpp:2381
lldb::PlatformSP m_platform_sp
The platform for this target.
Definition Target.h:2203
void UndoCreateHook(lldb::user_id_t uid)
Removes the most recently created hook.
Definition Target.cpp:4970
llvm::Expected< std::unique_ptr< UtilityFunction > > CreateUtilityFunction(std::string expression, std::string name, lldb::LanguageType language, ExecutionContext &exe_ctx)
Creates and installs a UtilityFunction for the given language.
Definition Target.cpp:2948
FileSpecList GetSafeAutoLoadPaths() const
Get the list of paths that LLDB will consider automatically loading scripting resources from.
Definition Target.cpp:6271
static TargetProperties & GetGlobalProperties()
Definition Target.cpp:3602
Status Install(ProcessLaunchInfo *launch_info)
Definition Target.cpp:3610
HookSP GetHookAtIndex(size_t index)
Definition Target.cpp:4991
lldb::PlatformSP GetPlatform()
Definition Target.h:2053
void NotifyModuleRemoved(const ModuleList &module_list, const lldb::ModuleSP &module_sp) override
Definition Target.cpp:1953
lldb::BreakpointSP CreateAddressInModuleBreakpoint(lldb::addr_t file_addr, bool internal, const FileSpec &file_spec, bool request_hardware)
Definition Target.cpp:617
lldb::BreakpointSP CreateBreakpoint(const FileSpecList *containingModules, const FileSpec &file, uint32_t line_no, uint32_t column, lldb::addr_t offset, LazyBool check_inlines, LazyBool skip_prologue, bool internal, bool request_hardware, LazyBool move_to_nearest_code)
Definition Target.cpp:528
void RemoveAllBreakpoints(bool internal_also=false)
Definition Target.cpp:1184
lldb::BreakpointSP CreateSourceRegexBreakpoint(const FileSpecList *containingModules, const FileSpecList *source_file_list, const std::unordered_set< std::string > &function_names, RegularExpression source_regex, bool internal, bool request_hardware, LazyBool move_to_nearest_code)
Definition Target.cpp:511
lldb::BreakpointSP CreateBreakpoint(const FileSpecList *containingModules, const FileSpecList *containingSourceFiles, const char *func_name, lldb::FunctionNameType func_name_type_mask, lldb::LanguageType language, lldb::addr_t offset, bool offset_is_insn_count, LazyBool skip_prologue, bool internal, bool request_hardware)
static ArchSpec GetDefaultArchitecture()
Definition Target.cpp:2987
void ResetBreakpointHitCounts()
Resets the hit count of all breakpoints.
Definition Target.cpp:1287
std::unique_ptr< BreakpointResolverOverride > BreakpointResolverOverrideUP
Definition Target.h:1054
const ModuleList & GetImages() const
Get accessor for the images for this process.
Definition Target.h:1295
const ArchSpec & GetArchitecture() const
Definition Target.h:1337
WatchpointList & GetWatchpointList()
Definition Target.h:990
@ eBroadcastBitWatchpointChanged
Definition Target.h:615
@ eBroadcastBitBreakpointChanged
Definition Target.h:612
@ eBroadcastBitNewTargetCreated
Definition Target.h:618
unsigned m_next_persistent_variable_index
Definition Target.h:2292
bool EnableBreakpointByID(lldb::break_id_t break_id)
Definition Target.cpp:1268
uint64_t ReadUnsignedIntegerFromMemory(const Address &addr, size_t integer_byte_size, uint64_t fail_value, Status &error, bool force_live_memory=false)
Definition Target.cpp:2485
void InvalidateThreadFrameProviders()
Invalidate all potentially cached frame providers for all threads and trigger a stack changed event f...
Definition Target.cpp:4105
TargetStats m_stats
Definition Target.h:2320
bool IgnoreAllWatchpoints(uint32_t ignore_count)
Definition Target.cpp:1561
void AddBreakpoint(lldb::BreakpointSP breakpoint_sp, bool internal)
Definition Target.cpp:854
std::string m_target_session_name
The target session name for this target, used to name debugging sessions in DAP.
Definition Target.h:2296
TypeSystemMap m_scratch_type_system_map
Definition Target.h:2240
void AddBreakpointName(std::unique_ptr< BreakpointName > bp_name)
Definition Target.cpp:904
void SetTargetSessionName(llvm::StringRef target_session_name)
Set the target session name for this target.
Definition Target.h:740
SectionLoadHistory m_section_load_history
Definition Target.h:2219
lldb::BreakpointSP CreateBreakpoint(const FileSpecList *containingModules, const FileSpecList *containingSourceFiles, const std::vector< std::string > &func_names, lldb::FunctionNameType func_name_type_mask, lldb::LanguageType language, lldb::addr_t m_offset, LazyBool skip_prologue, bool internal, bool request_hardware)
lldb::BreakpointResolverSP CheckBreakpointOverrides(lldb::BreakpointResolverSP original_sp)
Definition Target.cpp:1047
std::shared_ptr< GroupT > GetFirstTargetGroupOfType() const
Return the first target group that can be cast to GroupT.
Definition Target.h:2130
void GetBreakpointNames(std::vector< std::string > &names)
Definition Target.cpp:969
bool IsDummyTarget() const
Definition Target.h:696
Target(Debugger &debugger, const ArchSpec &target_arch, const lldb::PlatformSP &platform_sp, bool is_dummy_target)
Construct with optional file and arch.
Definition Target.cpp:182
size_t UnloadModuleSections(const lldb::ModuleSP &module_sp)
Definition Target.cpp:3679
llvm::StringRef GetTargetSessionName()
Get the target session name for this target.
Definition Target.h:728
const std::string & GetLabel() const
Definition Target.h:709
std::map< lldb::user_id_t, HookSP > HookCollection
Definition Target.h:2289
bool m_valid
This records the last natural stop at which we ran a stop-hook.
Definition Target.h:2262
bool DisableWatchpointByID(lldb::watch_id_t watch_id)
Definition Target.cpp:1578
void AddDummySignal(llvm::StringRef name, LazyBool pass, LazyBool print, LazyBool stop)
Add a signal to the Target's list of stored signals/actions.
Definition Target.cpp:4211
void ClearScriptedFrameProviderDescriptors()
Clear all scripted frame provider descriptors for this target.
Definition Target.cpp:4087
void RebuildModuleListWithExecutable(lldb::ModuleSP &module_sp, LoadDependentFiles load_dependent_files=eLoadDependentsDefault)
Clear the module list and rebuild it around a new main executable.
Definition Target.cpp:1691
lldb::WatchpointSP m_last_created_watchpoint
Definition Target.h:2233
Status CreateBreakpointsFromFile(const FileSpec &file, BreakpointIDList &new_bps)
Definition Target.cpp:1383
Debugger & m_debugger
Definition Target.h:2202
void SetREPL(lldb::LanguageType language, lldb::REPLSP repl_sp)
Definition Target.cpp:388
lldb::BreakpointSP CreateBreakpoint(const FileSpecList *containingModules, const FileSpecList *containingSourceFiles, const char *func_names[], size_t num_names, lldb::FunctionNameType func_name_type_mask, lldb::LanguageType language, lldb::addr_t offset, LazyBool skip_prologue, bool internal, bool request_hardware)
lldb::StackFrameRecognizerManagerUP m_frame_recognizer_manager_up
Stores the frame recognizers of this target.
Definition Target.h:2303
HookCollection m_hooks
Definition Target.h:2290
lldb::REPLSP GetREPL(Status &err, lldb::LanguageType language, const char *repl_options, bool can_create)
Definition Target.cpp:337
std::shared_ptr< Hook > HookSP
Definition Target.h:1966
UserExpression * GetUserExpressionForLanguage(llvm::StringRef expr, llvm::StringRef prefix, SourceLanguage language, Expression::ResultType desired_type, const EvaluateExpressionOptions &options, ValueObject *ctx_obj, Status &error)
Definition Target.cpp:2885
ModuleList m_images
The list of images for this process (shared libraries and anything dynamically loaded).
Definition Target.h:2214
lldb::ProcessSP CalculateProcess() override
Definition Target.cpp:2769
void PrintDummySignals(Stream &strm, Args &signals)
Print all the signals set in this target.
Definition Target.cpp:4305
std::vector< lldb::TargetGroupSP > GetTargetGroups() const
Return the target groups this target belongs to.
Definition Target.cpp:420
llvm::SmallDenseSet< UUID > m_loaded_scripts
Used to not run stop hooks for expressions.
Definition Target.h:2268
void SetPlatform(const lldb::PlatformSP &platform_sp)
Definition Target.h:2055
bool SetSectionLoadAddress(const lldb::SectionSP &section, lldb::addr_t load_addr, bool warn_multiple=false)
Definition Target.cpp:3649
BreakpointName * FindBreakpointName(llvm::StringRef name, bool can_create, Status &error)
Definition Target.cpp:909
Status Attach(ProcessAttachInfo &attach_info, Stream *stream)
Definition Target.cpp:3946
std::map< lldb::LanguageType, lldb::REPLSP > REPLMap
Definition Target.h:2251
static void SetDefaultArchitecture(const ArchSpec &arch)
Definition Target.cpp:2991
lldb::BreakpointSP m_last_created_breakpoint
Definition Target.h:2231
lldb::WatchpointSP GetLastCreatedWatchpoint()
Definition Target.h:986
bool RemoveStopHookByID(lldb::user_id_t uid)
Definition Target.cpp:3266
friend class Debugger
Definition Target.h:607
lldb::BreakpointSP GetLastCreatedBreakpoint()
Definition Target.h:878
static void SettingsInitialize()
Definition Target.cpp:2975
~Target() override
Definition Target.cpp:222
bool EnableAllWatchpoints(bool end_to_end=true)
Definition Target.cpp:1506
std::recursive_mutex m_private_mutex
When the private state thread calls SB API's - usually because it is running OS plugin or Python Thre...
Definition Target.h:2211
lldb::ExpressionResults EvaluateExpression(llvm::StringRef expression, ExecutionContextScope *exe_scope, lldb::ValueObjectSP &result_valobj_sp, const EvaluateExpressionOptions &options=EvaluateExpressionOptions(), std::string *fixed_expression=nullptr, ValueObject *ctx_obj=nullptr)
Definition Target.cpp:3029
bool MergeArchitecture(const ArchSpec &arch_spec)
Definition Target.cpp:1916
Encapsulates a one-time expression for use in lldb.
This class is used by Watchpoint to manage a list of watchpoints,.
#define LLDB_INVALID_GLOBALLY_UNIQUE_TARGET_ID
A class that represents a running process on the host machine.
std::shared_ptr< SummaryStatistics > SummaryStatisticsSP
Definition Statistics.h:33
LoadScriptFromSymFile
Definition Target.h:68
@ eLoadScriptFromSymFileTrue
Definition Target.h:69
@ eLoadScriptFromSymFileTrusted
Definition Target.h:72
@ eLoadScriptFromSymFileFalse
Definition Target.h:70
@ eLoadScriptFromSymFileWarn
Definition Target.h:71
@ eJITEngineMCJIT
Definition Target.h:94
@ eJITEngineORC
Definition Target.h:94
ExecutionPolicy
Expression execution policies.
DynamicClassInfoHelper
Definition Target.h:87
@ eDynamicClassInfoHelperCopyRealizedClassList
Definition Target.h:90
@ eDynamicClassInfoHelperGetRealizedClassList
Definition Target.h:91
@ eDynamicClassInfoHelperAuto
Definition Target.h:88
@ eDynamicClassInfoHelperRealizedClassesStruct
Definition Target.h:89
OptionEnumValues GetDynamicValueTypes()
Definition Target.cpp:5060
@ eImportStdModuleFalse
Definition Target.h:82
@ eImportStdModuleFallback
Definition Target.h:83
@ eImportStdModuleTrue
Definition Target.h:84
LoadCWDlldbinitFile
Definition Target.h:75
@ eLoadCWDlldbinitTrue
Definition Target.h:76
@ eLoadCWDlldbinitFalse
Definition Target.h:77
@ eLoadCWDlldbinitWarn
Definition Target.h:78
llvm::ArrayRef< OptionEnumValueElement > OptionEnumValues
@ eInlineBreakpointsNever
Definition Target.h:63
@ eInlineBreakpointsAlways
Definition Target.h:65
@ eInlineBreakpointsHeaders
Definition Target.h:64
BreakpointConditionMode
Modes for evaluating breakpoint conditions.
ExpressionEvaluationPhase
Expression Evaluation Stages.
std::shared_ptr< lldb_private::Trace > TraceSP
std::shared_ptr< lldb_private::ScriptedHookInterface > ScriptedHookInterfaceSP
std::shared_ptr< lldb_private::StackFrame > StackFrameSP
std::shared_ptr< lldb_private::SearchFilter > SearchFilterSP
std::shared_ptr< lldb_private::BreakpointResolver > BreakpointResolverSP
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
std::unique_ptr< lldb_private::StackFrameRecognizerManager > StackFrameRecognizerManagerUP
std::weak_ptr< lldb_private::Module > ModuleWP
std::shared_ptr< lldb_private::Thread > ThreadSP
std::shared_ptr< lldb_private::TargetGroup > TargetGroupSP
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
std::shared_ptr< lldb_private::ExpressionVariable > ExpressionVariableSP
std::shared_ptr< lldb_private::UnixSignals > UnixSignalsSP
std::shared_ptr< lldb_private::Platform > PlatformSP
std::shared_ptr< lldb_private::RegisterTypeBuilder > RegisterTypeBuilderSP
LanguageType
Programming language type.
std::shared_ptr< lldb_private::Stream > StreamSP
std::shared_ptr< lldb_private::Breakpoint > BreakpointSP
ExpressionResults
The results of expression evaluation.
int32_t break_id_t
Definition lldb-types.h:88
std::unique_ptr< lldb_private::SourceManager > SourceManagerUP
std::shared_ptr< lldb_private::Process > ProcessSP
std::shared_ptr< lldb_private::SymbolContextSpecifier > SymbolContextSpecifierSP
std::shared_ptr< lldb_private::Watchpoint > WatchpointSP
std::shared_ptr< lldb_private::Listener > ListenerSP
int32_t watch_id_t
Definition lldb-types.h:89
uint64_t user_id_t
Definition lldb-types.h:83
std::shared_ptr< lldb_private::Section > SectionSP
uint64_t addr_t
Definition lldb-types.h:80
std::shared_ptr< lldb_private::Target > TargetSP
@ eDynamicCanRunTarget
bool(* ExpressionCancelCallback)(lldb::ExpressionEvaluationPhase phase, void *baton)
Definition lldb-types.h:75
std::shared_ptr< lldb_private::Module > ModuleSP
std::shared_ptr< lldb_private::EventData > EventDataSP
std::shared_ptr< lldb_private::REPL > REPLSP
Every register is described in detail including its name, alternate name (optional),...
This struct contains the metadata needed to instantiate a frame provider and optional filters to cont...
A type-erased pair of llvm::dwarf::SourceLanguageName and version.
DummySignalValues(LazyBool pass, LazyBool notify, LazyBool stop)
Definition Target.h:2097
The stop hooks and hooks that a module's __lldb_module_added_to_target adds for this target,...
Definition Target.h:2280
std::vector< StopHookSP > stop_hooks
Definition Target.h:2283
UserID(lldb::user_id_t uid=LLDB_INVALID_UID)
Construct with optional user ID.
Definition UserID.h:33