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 <string>
16#include <vector>
17
21#include "lldb/Core/Address.h"
41#include "lldb/Utility/Stream.h"
44#include "lldb/lldb-public.h"
45#include "llvm/ADT/MapVector.h"
46#include "llvm/ADT/StringRef.h"
47
48namespace lldb_private {
49
51
57
64
70
76
83
88
90public:
91 TargetProperties(Target *target);
92
94
96
97 void SetDefaultArchitecture(const ArchSpec &arch);
98
99 bool GetMoveToNearestCode() const;
100
102
104
105 bool GetPreloadSymbols() const;
106
107 void SetPreloadSymbols(bool b);
108
109 bool GetDisableASLR() const;
110
111 void SetDisableASLR(bool b);
112
113 bool GetInheritTCC() const;
114
115 void SetInheritTCC(bool b);
116
117 bool GetDetachOnError() const;
118
119 void SetDetachOnError(bool b);
120
121 bool GetDisableSTDIO() const;
122
123 void SetDisableSTDIO(bool b);
124
125 llvm::StringRef GetLaunchWorkingDirectory() const;
126
127 bool GetParallelModuleLoad() const;
128
129 const char *GetDisassemblyFlavor() const;
130
131 const char *GetDisassemblyCPU() const;
132
133 const char *GetDisassemblyFeatures() const;
134
136
138
139 llvm::StringRef GetArg0() const;
140
141 void SetArg0(llvm::StringRef arg);
142
143 bool GetRunArguments(Args &args) const;
144
145 void SetRunArguments(const Args &args);
146
147 // Get the whole environment including the platform inherited environment and
148 // the target specific environment, excluding the unset environment variables.
150 // Get the platform inherited environment, excluding the unset environment
151 // variables.
153 // Get the target specific environment only, without the platform inherited
154 // environment.
156 // Set the target specific environment.
157 void SetEnvironment(Environment env);
158
159 bool GetSkipPrologue() const;
160
162
164
165 bool GetAutoSourceMapRelative() const;
166
168
170
172
174
176
178
180
181 bool GetEnableAutoApplyFixIts() const;
182
183 uint64_t GetNumberOfRetriesWithFixits() const;
184
185 bool GetEnableNotifyAboutFixIts() const;
186
188
189 bool GetEnableSyntheticValue() const;
190
192
193 uint32_t GetMaxZeroPaddingInFloatFormat() const;
194
196
197 /// Get the max depth value, augmented with a bool to indicate whether the
198 /// depth is the default.
199 ///
200 /// When the user has customized the max depth, the bool will be false.
201 ///
202 /// \returns the max depth, and true if the max depth is the system default,
203 /// otherwise false.
204 std::pair<uint32_t, bool> GetMaximumDepthOfChildrenToDisplay() const;
205
206 uint32_t GetMaximumSizeOfStringSummary() const;
207
208 uint32_t GetMaximumMemReadSize() const;
209
213
214 void SetStandardInputPath(llvm::StringRef path);
215 void SetStandardOutputPath(llvm::StringRef path);
216 void SetStandardErrorPath(llvm::StringRef path);
217
218 void SetStandardInputPath(const char *path) = delete;
219 void SetStandardOutputPath(const char *path) = delete;
220 void SetStandardErrorPath(const char *path) = delete;
221
223
225
226 llvm::StringRef GetExpressionPrefixContents();
227
228 uint64_t GetExprErrorLimit() const;
229
230 uint64_t GetExprAllocAddress() const;
231
232 uint64_t GetExprAllocSize() const;
233
234 uint64_t GetExprAllocAlign() const;
235
236 bool GetUseHexImmediates() const;
237
238 bool GetUseFastStepping() const;
239
241
243
244 /// Set the target-wide target.load-script-from-symbol-file setting.
245 /// See \c SetAutoLoadScriptsForModule for overriding this setting
246 /// per-module.
248
250
252
254
255 bool GetUserSpecifiedTrapHandlerNames(Args &args) const;
256
257 void SetUserSpecifiedTrapHandlerNames(const Args &args);
258
260
262
264
266
268
269 void SetProcessLaunchInfo(const ProcessLaunchInfo &launch_info);
270
271 bool GetInjectLocalVariables(ExecutionContext *exe_ctx) const;
272
273 bool GetUseDIL(ExecutionContext *exe_ctx) const;
274
275 void SetUseDIL(ExecutionContext *exe_ctx, bool b);
276
278
280
281 bool GetAutoInstallMainExecutable() const;
282
284
285 void SetDebugUtilityExpression(bool debug);
286
287 bool GetDebugUtilityExpression() const;
288
289 void SetCheckValueObjectOwnership(bool check);
290
291 bool GetCheckValueObjectOwnership() const;
292
293 std::optional<LoadScriptFromSymFile>
294 GetAutoLoadScriptsForModule(llvm::StringRef module_name) const;
295
296 /// Set the \c LoadScriptFromSymFile for a module called \c module_name
297 /// (excluding file extension). LLDB will prefer this over the target-wide
298 /// target.load-script-from-symbol-file setting
299 /// (see \c SetLoadScriptFromSymbolFile).
300 void SetAutoLoadScriptsForModule(llvm::StringRef module_name,
301 LoadScriptFromSymFile load_style);
302
303private:
304 std::optional<bool>
305 GetExperimentalPropertyValue(size_t prop_idx,
306 ExecutionContext *exe_ctx = nullptr) const;
307
308 // Callbacks for m_launch_info.
319
320 // Settings checker for target.jit-save-objects-dir:
321 void CheckJITObjectsDir();
322
324
325 // Member variables.
327 std::unique_ptr<TargetExperimentalProperties> m_experimental_properties_up;
329};
330
332public:
334
335// MSVC has a bug here that reports C4268: 'const' static/global data
336// initialized with compiler generated default constructor fills the object
337// with zeros. Confirmed that MSVC is *not* zero-initializing, it's just a
338// bogus warning.
339#if defined(_MSC_VER)
340#pragma warning(push)
341#pragma warning(disable : 4268)
342#endif
343 static constexpr std::chrono::milliseconds default_timeout{500};
344#if defined(_MSC_VER)
345#pragma warning(pop)
346#endif
347
350
352
356
358
359 void SetLanguage(lldb::LanguageType language_type) {
360 m_language = SourceLanguage(language_type);
361 }
362
364 m_preferred_lookup_contexts = std::move(contexts);
365 }
366
370
371 /// Set the language using a pair of language code and version as
372 /// defined by the DWARF 6 specification.
373 /// WARNING: These codes may change until DWARF 6 is finalized.
374 void SetLanguage(uint16_t name, uint32_t version) {
375 m_language = SourceLanguage(name, version);
376 }
377
378 bool DoesCoerceToId() const { return m_coerce_to_id; }
379
380 const char *GetPrefix() const {
381 return (m_prefix.empty() ? nullptr : m_prefix.c_str());
382 }
383
384 void SetPrefix(const char *prefix) {
385 if (prefix && prefix[0])
386 m_prefix = prefix;
387 else
388 m_prefix.clear();
389 }
390
391 void SetCoerceToId(bool coerce = true) { m_coerce_to_id = coerce; }
392
393 bool DoesUnwindOnError() const { return m_unwind_on_error; }
394
395 void SetUnwindOnError(bool unwind = false) { m_unwind_on_error = unwind; }
396
398
399 void SetIgnoreBreakpoints(bool ignore = false) {
400 m_ignore_breakpoints = ignore;
401 }
402
403 bool DoesKeepInMemory() const { return m_keep_in_memory; }
404
405 void SetKeepInMemory(bool keep = true) { m_keep_in_memory = keep; }
406
408
409 void
413
414 const Timeout<std::micro> &GetTimeout() const { return m_timeout; }
415
416 void SetTimeout(const Timeout<std::micro> &timeout) { m_timeout = timeout; }
417
421
423 m_one_thread_timeout = timeout;
424 }
425
426 bool GetTryAllThreads() const { return m_try_others; }
427
428 void SetTryAllThreads(bool try_others = true) { m_try_others = try_others; }
429
430 bool GetStopOthers() const { return m_stop_others; }
431
432 void SetStopOthers(bool stop_others = true) { m_stop_others = stop_others; }
433
434 bool GetDebug() const { return m_debug; }
435
436 void SetDebug(bool b) {
437 m_debug = b;
438 if (m_debug)
440 }
441
443
445
446 bool GetColorizeErrors() const { return m_ansi_color_errors; }
447
449
450 bool GetTrapExceptions() const { return m_trap_exceptions; }
451
453
454 bool GetStopOnFork() const { return m_stop_on_fork; }
455
456 void SetStopOnFork(bool b) { m_stop_on_fork = b; }
457
458 bool GetREPLEnabled() const { return m_repl; }
459
460 void SetREPLEnabled(bool b) { m_repl = b; }
461
464 m_cancel_callback = callback;
465 }
466
468 return ((m_cancel_callback != nullptr)
470 : false);
471 }
472
473 // Allows the expression contents to be remapped to point to the specified
474 // file and line using #line directives.
475 void SetPoundLine(const char *path, uint32_t line) const {
476 if (path && path[0]) {
477 m_pound_line_file = path;
478 m_pound_line_line = line;
479 } else {
480 m_pound_line_file.clear();
482 }
483 }
484
485 const char *GetPoundLineFilePath() const {
486 return (m_pound_line_file.empty() ? nullptr : m_pound_line_file.c_str());
487 }
488
489 uint32_t GetPoundLineLine() const { return m_pound_line_line; }
490
492
496
498
500
501 void SetRetriesWithFixIts(uint64_t number_of_retries) {
502 m_retries_with_fixits = number_of_retries;
503 }
504
505 uint64_t GetRetriesWithFixIts() const { return m_retries_with_fixits; }
506
508
510
511 /// Set language-plugin specific option called \c option_name to
512 /// the specified boolean \c value.
513 llvm::Error SetBooleanLanguageOption(llvm::StringRef option_name, bool value);
514
515 /// Get the language-plugin specific boolean option called \c option_name.
516 ///
517 /// If the option doesn't exist or is not a boolean option, returns false.
518 /// Otherwise returns the boolean value of the option.
519 llvm::Expected<bool>
520 GetBooleanLanguageOption(llvm::StringRef option_name) const;
521
522 void SetCppIgnoreContextQualifiers(bool value);
523
525
526private:
528
530
533 std::string m_prefix;
534 bool m_coerce_to_id = false;
535 bool m_unwind_on_error = true;
537 bool m_keep_in_memory = false;
538 bool m_try_others = true;
539 bool m_stop_others = true;
540 bool m_debug = false;
541 bool m_trap_exceptions = true;
542 bool m_stop_on_fork = false;
543 bool m_repl = false;
549 /// True if the executed code should be treated as utility code that is only
550 /// used by LLDB internally.
552
557 void *m_cancel_callback_baton = nullptr;
558 // If m_pound_line_file is not empty and m_pound_line_line is non-zero, use
559 // #line %u "%s" before the expression content to remap where the source
560 // originates
561 mutable std::string m_pound_line_file;
562 mutable uint32_t m_pound_line_line = 0;
563
564 /// Dictionary mapping names of language-plugin specific options
565 /// to values.
567
568 /// During expression evaluation, any SymbolContext in this list will be
569 /// used for symbol/function lookup before any other context (except for
570 /// the module corresponding to the current frame).
572};
573
574// Target
575class Target : public std::enable_shared_from_this<Target>,
576 public TargetProperties,
577 public Broadcaster,
579 public ModuleList::Notifier {
580public:
581 friend class TargetList;
582 friend class Debugger;
583
584 /// Broadcaster event bits definitions.
585 enum {
593 };
594
595 // These two functions fill out the Broadcaster interface:
596
597 static llvm::StringRef GetStaticBroadcasterClass();
598
599 llvm::StringRef GetBroadcasterClass() const override {
601 }
602
603 // This event data class is for use by the TargetList to broadcast new target
604 // notifications.
605 class TargetEventData : public EventData {
606 public:
607 TargetEventData(const lldb::TargetSP &target_sp);
608
609 TargetEventData(const lldb::TargetSP &target_sp,
610 const ModuleList &module_list);
611
612 // Constructor for eBroadcastBitNewTargetCreated events. For this event
613 // type:
614 // - target_sp is the parent target (the subject/broadcaster of the event)
615 // - created_target_sp is the newly created target
616 TargetEventData(const lldb::TargetSP &target_sp,
617 const lldb::TargetSP &created_target_sp);
618
620
621 static llvm::StringRef GetFlavorString();
622
623 llvm::StringRef GetFlavor() const override {
625 }
626
627 void Dump(Stream *s) const override;
628
629 static const TargetEventData *GetEventDataFromEvent(const Event *event_ptr);
630
631 static lldb::TargetSP GetTargetFromEvent(const Event *event_ptr);
632
633 // For eBroadcastBitNewTargetCreated events, returns the newly created
634 // target. For other event types, returns an invalid target.
635 static lldb::TargetSP GetCreatedTargetFromEvent(const Event *event_ptr);
636
637 static ModuleList GetModuleListFromEvent(const Event *event_ptr);
638
639 const lldb::TargetSP &GetTarget() const { return m_target_sp; }
640
642 return m_created_target_sp;
643 }
644
645 const ModuleList &GetModuleList() const { return m_module_list; }
646
647 private:
651
653 const TargetEventData &operator=(const TargetEventData &) = delete;
654 };
655
656 ~Target() override;
657
658 static void SettingsInitialize();
659
660 static void SettingsTerminate();
661
663
665
667
668 static void SetDefaultArchitecture(const ArchSpec &arch);
669
670 bool IsDummyTarget() const { return m_is_dummy_target; }
671
672 /// Get the globally unique ID for this target.
673 ///
674 /// This ID is unique across all debugger instances and all targets,
675 /// within the same lldb process. The ID is assigned
676 /// during target construction and remains constant for the target's lifetime.
677 /// The first target created (typically the dummy target) gets ID 1.
678 ///
679 /// \return
680 /// The globally unique ID for this target.
682
683 const std::string &GetLabel() const { return m_label; }
684
685 /// Set a label for a target.
686 ///
687 /// The label cannot be used by another target or be only integral.
688 ///
689 /// \return
690 /// The label for this target or an error if the label didn't match the
691 /// requirements.
692 llvm::Error SetLabel(llvm::StringRef label);
693
694 /// Get the target session name for this target.
695 ///
696 /// Provides a meaningful name for IDEs or tools to display for dynamically
697 /// created targets. Defaults to "Session {ID}" based on the globally unique
698 /// ID.
699 ///
700 /// \return
701 /// The target session name for this target.
702 llvm::StringRef GetTargetSessionName() { return m_target_session_name; }
703
704 /// Set the target session name for this target.
705 ///
706 /// This should typically be set along with the event
707 /// eBroadcastBitNewTargetCreated. Useful for scripts or triggers that
708 /// automatically create targets and want to provide meaningful names that
709 /// IDEs or other tools can display to help users identify the origin and
710 /// purpose of each target.
711 ///
712 /// \param[in] target_session_name
713 /// The target session name to set for this target.
714 void SetTargetSessionName(llvm::StringRef target_session_name) {
715 m_target_session_name = target_session_name.str();
716 }
717
718 /// Find a binary on the system and return its Module,
719 /// or return an existing Module that is already in the Target.
720 ///
721 /// Given a ModuleSpec, find a binary satisifying that specification,
722 /// or identify a matching Module already present in the Target,
723 /// and return a shared pointer to it.
724 ///
725 /// Note that this function previously also preloaded the module's symbols
726 /// depending on a setting. This function no longer does any module
727 /// preloading because that can potentially cause deadlocks when called in
728 /// parallel with this function.
729 ///
730 /// \param[in] module_spec
731 /// The criteria that must be matched for the binary being loaded.
732 /// e.g. UUID, architecture, file path.
733 ///
734 /// \param[in] notify
735 /// If notify is true, and the Module is new to this Target,
736 /// Target::ModulesDidLoad will be called. See note in
737 /// Target::ModulesDidLoad about thread-safety with
738 /// Target::GetOrCreateModule.
739 /// If notify is false, it is assumed that the caller is adding
740 /// multiple Modules and will call ModulesDidLoad with the
741 /// full list at the end.
742 /// ModulesDidLoad must be called when a Module/Modules have
743 /// been added to the target, one way or the other.
744 ///
745 /// \param[out] error_ptr
746 /// Optional argument, pointing to a Status object to fill in
747 /// with any results / messages while attempting to find/load
748 /// this binary. Many callers will be internal functions that
749 /// will handle / summarize the failures in a custom way and
750 /// don't use these messages.
751 ///
752 /// \return
753 /// An empty ModuleSP will be returned if no matching file
754 /// was found. If error_ptr was non-nullptr, an error message
755 /// will likely be provided.
756 lldb::ModuleSP GetOrCreateModule(const ModuleSpec &module_spec, bool notify,
757 Status *error_ptr = nullptr);
758
759 // Settings accessors
760
762
763 std::recursive_mutex &GetAPIMutex();
764
766
767 void CleanupProcess();
768
769 /// Dump a description of this object to a Stream.
770 ///
771 /// Dump a description of the contents of this object to the
772 /// supplied stream \a s. The dumped content will be only what has
773 /// been loaded or parsed up to this point at which this function
774 /// is called, so this is a good way to see what has been parsed
775 /// in a target.
776 ///
777 /// \param[in] s
778 /// The stream to which to dump the object description.
779 void Dump(Stream *s, lldb::DescriptionLevel description_level);
780
781 // If listener_sp is null, the listener of the owning Debugger object will be
782 // used.
784 llvm::StringRef plugin_name,
785 const FileSpec *crash_file,
786 bool can_connect);
787
788 const lldb::ProcessSP &GetProcessSP() const;
789
790 bool IsValid() { return m_valid; }
791
792 void Destroy();
793
794 Status Launch(ProcessLaunchInfo &launch_info,
795 Stream *stream); // Optional stream to receive first stop info
796
797 Status Attach(ProcessAttachInfo &attach_info,
798 Stream *stream); // Optional stream to receive first stop info
799
800 /// Add or update a scripted frame provider descriptor for this target.
801 /// All new threads in this target will check if they match any descriptors
802 /// to create their frame providers.
803 ///
804 /// \param[in] descriptor
805 /// The descriptor to add or update.
806 ///
807 /// \return
808 /// The descriptor identifier if the registration succeeded, otherwise an
809 /// llvm::Error.
810 llvm::Expected<uint32_t> AddScriptedFrameProviderDescriptor(
811 const ScriptedFrameProviderDescriptor &descriptor);
812
813 /// Remove a scripted frame provider descriptor by id.
814 ///
815 /// \param[in] id
816 /// The id of the descriptor to remove.
817 ///
818 /// \return
819 /// True if a descriptor was removed, false if no descriptor with that
820 /// id existed.
822
823 /// Clear all scripted frame provider descriptors for this target.
825
826 /// Get all scripted frame provider descriptors for this target.
827 const llvm::MapVector<uint32_t, ScriptedFrameProviderDescriptor> &
829
830protected:
831 /// Invalidate all potentially cached frame providers for all threads
832 /// and trigger a stack changed event for all threads.
834
835public:
836 // This part handles the breakpoints.
837
838 BreakpointList &GetBreakpointList(bool internal = false);
839
840 const BreakpointList &GetBreakpointList(bool internal = false) const;
841
845
847
849
850 // Use this to create a file and line breakpoint to a given module or all
851 // module it is nullptr
852 lldb::BreakpointSP CreateBreakpoint(const FileSpecList *containingModules,
853 const FileSpec &file, uint32_t line_no,
854 uint32_t column, lldb::addr_t offset,
855 LazyBool check_inlines,
856 LazyBool skip_prologue, bool internal,
857 bool request_hardware,
858 LazyBool move_to_nearest_code);
859
860 // Use this to create breakpoint that matches regex against the source lines
861 // in files given in source_file_list: If function_names is non-empty, also
862 // filter by function after the matches are made.
864 const FileSpecList *containingModules,
865 const FileSpecList *source_file_list,
866 const std::unordered_set<std::string> &function_names,
867 RegularExpression source_regex, bool internal, bool request_hardware,
868 LazyBool move_to_nearest_code);
869
870 // Use this to create a breakpoint from a load address
871 lldb::BreakpointSP CreateBreakpoint(lldb::addr_t load_addr, bool internal,
872 bool request_hardware);
873
874 // Use this to create a breakpoint from a file address and a module file spec
876 bool internal,
877 const FileSpec &file_spec,
878 bool request_hardware);
879
880 // Use this to create Address breakpoints:
881 lldb::BreakpointSP CreateBreakpoint(const Address &addr, bool internal,
882 bool request_hardware);
883
884 // Use this to create a function breakpoint by regexp in
885 // containingModule/containingSourceFiles, or all modules if it is nullptr
886 // When "skip_prologue is set to eLazyBoolCalculate, we use the current
887 // target setting, else we use the values passed in
889 const FileSpecList *containingModules,
890 const FileSpecList *containingSourceFiles, RegularExpression func_regexp,
891 lldb::LanguageType requested_language, LazyBool skip_prologue,
892 bool internal, bool request_hardware);
893
894 // Use this to create a function breakpoint by name in containingModule, or
895 // all modules if it is nullptr When "skip_prologue is set to
896 // eLazyBoolCalculate, we use the current target setting, else we use the
897 // values passed in. func_name_type_mask is or'ed values from the
898 // FunctionNameType enum.
900 const FileSpecList *containingModules,
901 const FileSpecList *containingSourceFiles, const char *func_name,
902 lldb::FunctionNameType func_name_type_mask, lldb::LanguageType language,
903 lldb::addr_t offset, bool offset_is_insn_count, LazyBool skip_prologue,
904 bool internal, bool request_hardware);
905
907 CreateExceptionBreakpoint(enum lldb::LanguageType language, bool catch_bp,
908 bool throw_bp, bool internal,
909 Args *additional_args = nullptr,
910 Status *additional_args_error = nullptr);
911
913 const llvm::StringRef class_name, const FileSpecList *containingModules,
914 const FileSpecList *containingSourceFiles, bool internal,
915 bool request_hardware, StructuredData::ObjectSP extra_args_sp,
916 Status *creation_error = nullptr);
917
918 // This is the same as the func_name breakpoint except that you can specify a
919 // vector of names. This is cheaper than a regular expression breakpoint in
920 // the case where you just want to set a breakpoint on a set of names you
921 // already know. func_name_type_mask is or'ed values from the
922 // FunctionNameType enum.
924 const FileSpecList *containingModules,
925 const FileSpecList *containingSourceFiles, const char *func_names[],
926 size_t num_names, lldb::FunctionNameType func_name_type_mask,
927 lldb::LanguageType language, lldb::addr_t offset, LazyBool skip_prologue,
928 bool internal, bool request_hardware);
929
931 CreateBreakpoint(const FileSpecList *containingModules,
932 const FileSpecList *containingSourceFiles,
933 const std::vector<std::string> &func_names,
934 lldb::FunctionNameType func_name_type_mask,
935 lldb::LanguageType language, lldb::addr_t m_offset,
936 LazyBool skip_prologue, bool internal,
937 bool request_hardware);
938
939 // Use this to create a general breakpoint:
941 lldb::BreakpointResolverSP &resolver_sp,
942 bool internal, bool request_hardware,
943 bool resolve_indirect_symbols);
944
945 // Use this to create a watchpoint:
947 const CompilerType *type, uint32_t kind,
948 Status &error);
949
953
955
956 // Manages breakpoint names:
957 void AddNameToBreakpoint(BreakpointID &id, llvm::StringRef name,
958 Status &error);
959
960 void AddNameToBreakpoint(lldb::BreakpointSP &bp_sp, llvm::StringRef name,
961 Status &error);
962
964
965 BreakpointName *FindBreakpointName(ConstString name, bool can_create,
966 Status &error);
967
969
971 const BreakpointOptions &options,
972 const BreakpointName::Permissions &permissions);
974
975 void AddBreakpointName(std::unique_ptr<BreakpointName> bp_name);
976
977 void GetBreakpointNames(std::vector<std::string> &names);
978
979 // This call removes ALL breakpoints regardless of permission.
980 void RemoveAllBreakpoints(bool internal_also = false);
981
982 // This removes all the breakpoints, but obeys the ePermDelete on them.
984
985 void DisableAllBreakpoints(bool internal_also = false);
986
988
989 void EnableAllBreakpoints(bool internal_also = false);
990
992
994
996
998
999 /// Resets the hit count of all breakpoints.
1001
1002 // This callout implements the "Resolver Override". When we have determined
1003 // the Resolver for a given breakpoint, we pass each of the registered
1004 // overrides the "natural" resolver, and then we will use whatever resolver
1005 // we get back from it if it is non-null.
1006 // We keep a list of overrides ordered by ID - and we search through the list
1007 // by ID order, and the first override that returns a non-null Resolver will
1008 // be the one we use. If no overrides return an override resolver, we'll use
1009 // the original one.
1010
1011 // This is the abstract version of the override. Particular implementations
1012 // e.g. the scripted override will derive from this.
1013 class BreakpointResolverOverride;
1015 std::unique_ptr<BreakpointResolverOverride>;
1016
1018 public:
1019 BreakpointResolverOverride(Target &target, const std::string &description)
1020 : m_target(target), m_desc(description) {}
1021
1023
1027 // Return whether constructing this resolver was successful.
1028 virtual llvm::Error Validate() = 0;
1029 const std::string &GetDescription() { return m_desc; }
1030
1031 protected:
1033 std::string m_desc;
1034 };
1035
1036 /// Add a breakpoint override resolver. This version can't fail.
1040 m_breakpoint_overrides.emplace(m_override_id, std::move(override_up));
1041 m_override_id++;
1042 return id_used;
1043 }
1044
1045 /// Add a breakpoint override resolver. Return the ID or an error:
1046 llvm::Expected<lldb::user_id_t>
1047 AddBreakpointResolverOverride(llvm::StringRef class_name,
1048 StructuredData::DictionarySP args_data_sp,
1049 llvm::StringRef description);
1050
1052 size_t removed = m_breakpoint_overrides.erase(override_id);
1053 return removed == 1;
1054 }
1055
1057
1060 for (auto const &elem : m_breakpoint_overrides) {
1061 if (lldb::BreakpointResolverSP overriden_sp =
1062 elem.second->CheckForOverride(*this, original_sp))
1063 return overriden_sp;
1064 }
1065 return {};
1066 }
1067
1068 /// Describe the breakpoint overrides. If ixds is empty, list all. Otherwise
1069 /// list the overrides whose ids match the ones given in idxs. The matched
1070 /// elements are removed from the list, so any elements remaining in idxs are
1071 /// indexes that are not breakpoint override indexes.
1073 std::vector<lldb::user_id_t> &idxs);
1074
1075 // The flag 'end_to_end', default to true, signifies that the operation is
1076 // performed end to end, for both the debugger and the debuggee.
1077
1078 bool RemoveAllWatchpoints(bool end_to_end = true);
1079
1080 bool DisableAllWatchpoints(bool end_to_end = true);
1081
1082 bool EnableAllWatchpoints(bool end_to_end = true);
1083
1085
1087
1088 bool IgnoreAllWatchpoints(uint32_t ignore_count);
1089
1091
1093
1095
1096 bool IgnoreWatchpointByID(lldb::watch_id_t watch_id, uint32_t ignore_count);
1097
1099 const BreakpointIDList &bp_ids,
1100 bool append);
1101
1103 BreakpointIDList &new_bps);
1104
1106 std::vector<std::string> &names,
1107 BreakpointIDList &new_bps);
1108
1109 /// Get \a load_addr as a callable code load address for this target
1110 ///
1111 /// Take \a load_addr and potentially add any address bits that are
1112 /// needed to make the address callable. For ARM this can set bit
1113 /// zero (if it already isn't) if \a load_addr is a thumb function.
1114 /// If \a addr_class is set to AddressClass::eInvalid, then the address
1115 /// adjustment will always happen. If it is set to an address class
1116 /// that doesn't have code in it, LLDB_INVALID_ADDRESS will be
1117 /// returned.
1119 lldb::addr_t load_addr,
1120 AddressClass addr_class = AddressClass::eInvalid) const;
1121
1122 /// Get \a load_addr as an opcode for this target.
1123 ///
1124 /// Take \a load_addr and potentially strip any address bits that are
1125 /// needed to make the address point to an opcode. For ARM this can
1126 /// clear bit zero (if it already isn't) if \a load_addr is a
1127 /// thumb function and load_addr is in code.
1128 /// If \a addr_class is set to AddressClass::eInvalid, then the address
1129 /// adjustment will always happen. If it is set to an address class
1130 /// that doesn't have code in it, LLDB_INVALID_ADDRESS will be
1131 /// returned.
1134 AddressClass addr_class = AddressClass::eInvalid) const;
1135
1136 // Get load_addr as breakable load address for this target. Take a addr and
1137 // check if for any reason there is a better address than this to put a
1138 // breakpoint on. If there is then return that address. For MIPS, if
1139 // instruction at addr is a delay slot instruction then this method will find
1140 // the address of its previous instruction and return that address.
1142
1143 /// This call may preload module symbols, and may do so in parallel depending
1144 /// on the following target settings:
1145 /// - TargetProperties::GetPreloadSymbols()
1146 /// - TargetProperties::GetParallelModuleLoad()
1147 ///
1148 /// Warning: if preloading is active and this is called in parallel with
1149 /// Target::GetOrCreateModule, this may result in a ABBA deadlock situation.
1150 void ModulesDidLoad(ModuleList &module_list);
1151
1152 void ModulesDidUnload(ModuleList &module_list, bool delete_locations);
1153
1154 void SymbolsDidLoad(ModuleList &module_list);
1155
1156 void ClearModules(bool delete_locations);
1157
1158 /// Called as the last function in Process::DidExec().
1159 ///
1160 /// Process::DidExec() will clear a lot of state in the process,
1161 /// then try to reload a dynamic loader plugin to discover what
1162 /// binaries are currently available and then this function should
1163 /// be called to allow the target to do any cleanup after everything
1164 /// has been figured out. It can remove breakpoints that no longer
1165 /// make sense as the exec might have changed the target
1166 /// architecture, and unloaded some modules that might get deleted.
1167 void DidExec();
1168
1169 /// Gets the module for the main executable.
1170 ///
1171 /// Each process has a notion of a main executable that is the file
1172 /// that will be executed or attached to. Executable files can have
1173 /// dependent modules that are discovered from the object files, or
1174 /// discovered at runtime as things are dynamically loaded.
1175 ///
1176 /// \return
1177 /// The shared pointer to the executable module which can
1178 /// contains a nullptr Module object if no executable has been
1179 /// set.
1180 ///
1181 /// \see DynamicLoader
1182 /// \see ObjectFile::GetDependentModules (FileSpecList&)
1183 /// \see Process::SetExecutableModule(lldb::ModuleSP&)
1185
1187
1188 /// Set the main executable module.
1189 ///
1190 /// Each process has a notion of a main executable that is the file
1191 /// that will be executed or attached to. Executable files can have
1192 /// dependent modules that are discovered from the object files, or
1193 /// discovered at runtime as things are dynamically loaded.
1194 ///
1195 /// Setting the executable causes any of the current dependent
1196 /// image information to be cleared and replaced with the static
1197 /// dependent image information found by calling
1198 /// ObjectFile::GetDependentModules (FileSpecList&) on the main
1199 /// executable and any modules on which it depends. Calling
1200 /// Process::GetImages() will return the newly found images that
1201 /// were obtained from all of the object files.
1202 ///
1203 /// \param[in] module_sp
1204 /// A shared pointer reference to the module that will become
1205 /// the main executable for this process.
1206 ///
1207 /// \param[in] load_dependent_files
1208 /// If \b true then ask the object files to track down any
1209 /// known dependent files.
1210 ///
1211 /// \see ObjectFile::GetDependentModules (FileSpecList&)
1212 /// \see Process::GetImages()
1214 lldb::ModuleSP &module_sp,
1215 LoadDependentFiles load_dependent_files = eLoadDependentsDefault);
1216
1217 bool LoadScriptingResources(std::list<Status> &errors,
1218 bool continue_on_error = true) {
1219 return m_images.LoadScriptingResourcesInTarget(this, errors,
1220 continue_on_error);
1221 }
1222
1223 /// Get accessor for the images for this process.
1224 ///
1225 /// Each process has a notion of a main executable that is the file
1226 /// that will be executed or attached to. Executable files can have
1227 /// dependent modules that are discovered from the object files, or
1228 /// discovered at runtime as things are dynamically loaded. After
1229 /// a main executable has been set, the images will contain a list
1230 /// of all the files that the executable depends upon as far as the
1231 /// object files know. These images will usually contain valid file
1232 /// virtual addresses only. When the process is launched or attached
1233 /// to, the DynamicLoader plug-in will discover where these images
1234 /// were loaded in memory and will resolve the load virtual
1235 /// addresses is each image, and also in images that are loaded by
1236 /// code.
1237 ///
1238 /// \return
1239 /// A list of Module objects in a module list.
1240 const ModuleList &GetImages() const { return m_images; }
1241
1243
1244 /// Return whether this FileSpec corresponds to a module that should be
1245 /// considered for general searches.
1246 ///
1247 /// This API will be consulted by the SearchFilterForUnconstrainedSearches
1248 /// and any module that returns \b true will not be searched. Note the
1249 /// SearchFilterForUnconstrainedSearches is the search filter that
1250 /// gets used in the CreateBreakpoint calls when no modules is provided.
1251 ///
1252 /// The target call at present just consults the Platform's call of the
1253 /// same name.
1254 ///
1255 /// \param[in] module_spec
1256 /// Path to the module.
1257 ///
1258 /// \return \b true if the module should be excluded, \b false otherwise.
1259 bool ModuleIsExcludedForUnconstrainedSearches(const FileSpec &module_spec);
1260
1261 /// Return whether this module should be considered for general searches.
1262 ///
1263 /// This API will be consulted by the SearchFilterForUnconstrainedSearches
1264 /// and any module that returns \b true will not be searched. Note the
1265 /// SearchFilterForUnconstrainedSearches is the search filter that
1266 /// gets used in the CreateBreakpoint calls when no modules is provided.
1267 ///
1268 /// The target call at present just consults the Platform's call of the
1269 /// same name.
1270 ///
1271 /// FIXME: When we get time we should add a way for the user to set modules
1272 /// that they
1273 /// don't want searched, in addition to or instead of the platform ones.
1274 ///
1275 /// \param[in] module_sp
1276 /// A shared pointer reference to the module that checked.
1277 ///
1278 /// \return \b true if the module should be excluded, \b false otherwise.
1279 bool
1281
1282 const ArchSpec &GetArchitecture() const { return m_arch.GetSpec(); }
1283
1284 /// Returns the name of the target's ABI plugin.
1285 llvm::StringRef GetABIName() const;
1286
1287 /// Set the architecture for this target.
1288 ///
1289 /// If the current target has no Images read in, then this just sets the
1290 /// architecture, which will be used to select the architecture of the
1291 /// ExecutableModule when that is set. If the current target has an
1292 /// ExecutableModule, then calling SetArchitecture with a different
1293 /// architecture from the currently selected one will reset the
1294 /// ExecutableModule to that slice of the file backing the ExecutableModule.
1295 /// If the file backing the ExecutableModule does not contain a fork of this
1296 /// architecture, then this code will return false, and the architecture
1297 /// won't be changed. If the input arch_spec is the same as the already set
1298 /// architecture, this is a no-op.
1299 ///
1300 /// \param[in] arch_spec
1301 /// The new architecture.
1302 ///
1303 /// \param[in] set_platform
1304 /// If \b true, then the platform will be adjusted if the currently
1305 /// selected platform is not compatible with the architecture being set.
1306 /// If \b false, then just the architecture will be set even if the
1307 /// currently selected platform isn't compatible (in case it might be
1308 /// manually set following this function call).
1309 ///
1310 /// \param[in] merged
1311 /// If true, arch_spec is merged with the current
1312 /// architecture. Otherwise it's replaced.
1313 ///
1314 /// \return
1315 /// \b true if the architecture was successfully set, \b false otherwise.
1316 bool SetArchitecture(const ArchSpec &arch_spec, bool set_platform = false,
1317 bool merge = true);
1318
1319 bool MergeArchitecture(const ArchSpec &arch_spec);
1320
1321 Architecture *GetArchitecturePlugin() const { return m_arch.GetPlugin(); }
1322
1323 Debugger &GetDebugger() const { return m_debugger; }
1324
1325 size_t ReadMemoryFromFileCache(const Address &addr, void *dst, size_t dst_len,
1326 Status &error);
1327
1328 // Reading memory through the target allows us to skip going to the process
1329 // for reading memory if possible and it allows us to try and read from any
1330 // constant sections in our object files on disk. If you always want live
1331 // program memory, read straight from the process. If you possibly want to
1332 // read from const sections in object files, read from the target. This
1333 // version of ReadMemory will try and read memory from the process if the
1334 // process is alive. The order is:
1335 // 1 - if (force_live_memory == false) and the address falls in a read-only
1336 // section, then read from the file cache
1337 // 2 - if there is a process, then read from memory
1338 // 3 - if there is no process, then read from the file cache
1339 //
1340 // If did_read_live_memory is provided, will indicate if the read was from
1341 // live memory, or from file contents. A caller which needs to treat these two
1342 // sources differently should use this argument to disambiguate where the data
1343 // was read from.
1344 //
1345 // The method is virtual for mocking in the unit tests.
1346 virtual size_t ReadMemory(const Address &addr, void *dst, size_t dst_len,
1347 Status &error, bool force_live_memory = false,
1348 lldb::addr_t *load_addr_ptr = nullptr,
1349 bool *did_read_live_memory = nullptr);
1350
1351 size_t ReadCStringFromMemory(const Address &addr, std::string &out_str,
1352 Status &error, bool force_live_memory = false);
1353
1354 size_t ReadCStringFromMemory(const Address &addr, char *dst,
1355 size_t dst_max_len, Status &result_error,
1356 bool force_live_memory = false);
1357
1358 /// Read a NULL terminated string from memory
1359 ///
1360 /// This function will read a cache page at a time until a NULL string
1361 /// terminator is found. It will stop reading if an aligned sequence of NULL
1362 /// termination \a type_width bytes is not found before reading \a
1363 /// cstr_max_len bytes. The results are always guaranteed to be NULL
1364 /// terminated, and that no more than (max_bytes - type_width) bytes will be
1365 /// read.
1366 ///
1367 /// \param[in] addr
1368 /// The address to start the memory read.
1369 ///
1370 /// \param[in] dst
1371 /// A character buffer containing at least max_bytes.
1372 ///
1373 /// \param[in] max_bytes
1374 /// The maximum number of bytes to read.
1375 ///
1376 /// \param[in] error
1377 /// The error status of the read operation.
1378 ///
1379 /// \param[in] type_width
1380 /// The size of the null terminator (1 to 4 bytes per
1381 /// character). Defaults to 1.
1382 ///
1383 /// \return
1384 /// The error status or the number of bytes prior to the null terminator.
1385 size_t ReadStringFromMemory(const Address &addr, char *dst, size_t max_bytes,
1386 Status &error, size_t type_width,
1387 bool force_live_memory = true);
1388
1389 size_t ReadScalarIntegerFromMemory(const Address &addr, uint32_t byte_size,
1390 bool is_signed, Scalar &scalar,
1391 Status &error,
1392 bool force_live_memory = false);
1393
1394 int64_t ReadSignedIntegerFromMemory(const Address &addr,
1395 size_t integer_byte_size,
1396 int64_t fail_value, Status &error,
1397 bool force_live_memory = false);
1398
1399 uint64_t ReadUnsignedIntegerFromMemory(const Address &addr,
1400 size_t integer_byte_size,
1401 uint64_t fail_value, Status &error,
1402 bool force_live_memory = false);
1403
1404 bool ReadPointerFromMemory(const Address &addr, Status &error,
1405 Address &pointer_addr,
1406 bool force_live_memory = false);
1407
1408 bool HasLoadedSections();
1409
1411
1412 void ClearSectionLoadList();
1413
1414 void DumpSectionLoadList(Stream &s);
1415
1416 static Target *GetTargetFromContexts(const ExecutionContext *exe_ctx_ptr,
1417 const SymbolContext *sc_ptr);
1418
1419 // lldb::ExecutionContextScope pure virtual functions
1421
1423
1425
1427
1428 void CalculateExecutionContext(ExecutionContext &exe_ctx) override;
1429
1431
1432 llvm::Expected<lldb::TypeSystemSP>
1434 bool create_on_demand = true);
1435
1436 std::vector<lldb::TypeSystemSP>
1437 GetScratchTypeSystems(bool create_on_demand = true);
1438
1441
1442 // Creates a UserExpression for the given language, the rest of the
1443 // parameters have the same meaning as for the UserExpression constructor.
1444 // Returns a new-ed object which the caller owns.
1445
1447 GetUserExpressionForLanguage(llvm::StringRef expr, llvm::StringRef prefix,
1448 SourceLanguage language,
1449 Expression::ResultType desired_type,
1450 const EvaluateExpressionOptions &options,
1451 ValueObject *ctx_obj, Status &error);
1452
1453 // Creates a FunctionCaller for the given language, the rest of the
1454 // parameters have the same meaning as for the FunctionCaller constructor.
1455 // Since a FunctionCaller can't be
1456 // IR Interpreted, it makes no sense to call this with an
1457 // ExecutionContextScope that lacks
1458 // a Process.
1459 // Returns a new-ed object which the caller owns.
1460
1462 const CompilerType &return_type,
1463 const Address &function_address,
1464 const ValueList &arg_value_list,
1465 const char *name, Status &error);
1466
1467 /// Creates and installs a UtilityFunction for the given language.
1468 llvm::Expected<std::unique_ptr<UtilityFunction>>
1469 CreateUtilityFunction(std::string expression, std::string name,
1470 lldb::LanguageType language, ExecutionContext &exe_ctx);
1471
1472 // Install any files through the platform that need be to installed prior to
1473 // launching or attaching.
1474 Status Install(ProcessLaunchInfo *launch_info);
1475
1476 bool ResolveFileAddress(lldb::addr_t load_addr, Address &so_addr);
1477
1478 bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr,
1479 uint32_t stop_id = SectionLoadHistory::eStopIDNow,
1480 bool allow_section_end = false);
1481
1482 bool SetSectionLoadAddress(const lldb::SectionSP &section,
1483 lldb::addr_t load_addr,
1484 bool warn_multiple = false);
1485
1486 size_t UnloadModuleSections(const lldb::ModuleSP &module_sp);
1487
1488 size_t UnloadModuleSections(const ModuleList &module_list);
1489
1490 bool SetSectionUnloaded(const lldb::SectionSP &section_sp);
1491
1492 bool SetSectionUnloaded(const lldb::SectionSP &section_sp,
1493 lldb::addr_t load_addr);
1494
1496
1498 lldb_private::TypeSummaryImpl &summary_provider);
1500
1501 /// Set the \a Trace object containing processor trace information of this
1502 /// target.
1503 ///
1504 /// \param[in] trace_sp
1505 /// The trace object.
1506 void SetTrace(const lldb::TraceSP &trace_sp);
1507
1508 /// Get the \a Trace object containing processor trace information of this
1509 /// target.
1510 ///
1511 /// \return
1512 /// The trace object. It might be undefined.
1514
1515 /// Create a \a Trace object for the current target using the using the
1516 /// default supported tracing technology for this process.
1517 ///
1518 /// \return
1519 /// The new \a Trace or an \a llvm::Error if a \a Trace already exists or
1520 /// the trace couldn't be created.
1521 llvm::Expected<lldb::TraceSP> CreateTrace();
1522
1523 /// If a \a Trace object is present, this returns it, otherwise a new Trace is
1524 /// created with \a Trace::CreateTrace.
1525 llvm::Expected<lldb::TraceSP> GetTraceOrCreate();
1526
1527 // Since expressions results can persist beyond the lifetime of a process,
1528 // and the const expression results are available after a process is gone, we
1529 // provide a way for expressions to be evaluated from the Target itself. If
1530 // an expression is going to be run, then it should have a frame filled in in
1531 // the execution context.
1533 llvm::StringRef expression, ExecutionContextScope *exe_scope,
1534 lldb::ValueObjectSP &result_valobj_sp,
1536 std::string *fixed_expression = nullptr, ValueObject *ctx_obj = nullptr);
1537
1539
1541
1542 /// This method will return the address of the starting function for
1543 /// this binary, e.g. main() or its equivalent. This can be used as
1544 /// an address of a function that is not called once a binary has
1545 /// started running - e.g. as a return address for inferior function
1546 /// calls that are unambiguous completion of the function call, not
1547 /// called during the course of the inferior function code running.
1548 ///
1549 /// If no entry point can be found, an invalid address is returned.
1550 ///
1551 /// \param [out] err
1552 /// This object will be set to failure if no entry address could
1553 /// be found, and may contain a helpful error message.
1554 //
1555 /// \return
1556 /// Returns the entry address for this program, or an error
1557 /// if none can be found.
1558 llvm::Expected<lldb_private::Address> GetEntryPointAddress();
1559
1560 CompilerType GetRegisterType(const std::string &name,
1561 const lldb_private::RegisterFlags &flags,
1562 uint32_t byte_size);
1563
1564 /// Sends a breakpoint notification event.
1566 lldb::BreakpointEventType event_kind);
1567 /// Sends a breakpoint notification event.
1569 const lldb::EventDataSP &breakpoint_data_sp);
1570
1571 llvm::Expected<lldb::DisassemblerSP>
1572 ReadInstructions(const Address &start_addr, uint32_t count,
1573 const char *flavor_string = nullptr);
1574
1575 // Target Stop Hooks
1576 class StopHook : public UserID {
1577 public:
1578 StopHook(const StopHook &rhs);
1579 virtual ~StopHook() = default;
1580
1581 enum class StopHookKind : uint32_t {
1585 };
1592
1594
1595 // Set the specifier. The stop hook will own the specifier, and is
1596 // responsible for deleting it when we're done.
1597 void SetSpecifier(SymbolContextSpecifier *specifier);
1598
1600
1601 bool ExecutionContextPasses(const ExecutionContext &exe_ctx);
1602
1603 // Called on stop, this gets passed the ExecutionContext for each "stop
1604 // with a reason" thread. It should add to the stream whatever text it
1605 // wants to show the user, and return False to indicate it wants the target
1606 // not to stop.
1608 lldb::StreamSP output) = 0;
1609
1610 // Set the Thread Specifier. The stop hook will own the thread specifier,
1611 // and is responsible for deleting it when we're done.
1612 void SetThreadSpecifier(ThreadSpec *specifier);
1613
1615
1616 bool IsActive() { return m_active; }
1617
1618 void SetIsActive(bool is_active) { m_active = is_active; }
1619
1620 void SetAutoContinue(bool auto_continue) {
1621 m_auto_continue = auto_continue;
1622 }
1623
1624 bool GetAutoContinue() const { return m_auto_continue; }
1625
1626 void SetRunAtInitialStop(bool at_initial_stop) {
1627 m_at_initial_stop = at_initial_stop;
1628 }
1629
1631
1632 void SetSuppressOutput(bool suppress_output) {
1633 m_suppress_output = suppress_output;
1634 }
1635
1636 bool GetSuppressOutput() const { return m_suppress_output; }
1637
1638 void GetDescription(Stream &s, lldb::DescriptionLevel level) const;
1640 lldb::DescriptionLevel level) const = 0;
1641
1642 protected:
1645 std::unique_ptr<ThreadSpec> m_thread_spec_up;
1646 bool m_active = true;
1647 bool m_auto_continue = false;
1649 bool m_suppress_output = false;
1650
1651 StopHook(lldb::TargetSP target_sp, lldb::user_id_t uid);
1652 };
1653
1655 public:
1656 ~StopHookCommandLine() override = default;
1657
1659 void SetActionFromString(const std::string &strings);
1660 void SetActionFromStrings(const std::vector<std::string> &strings);
1661
1663 lldb::StreamSP output_sp) override;
1665 lldb::DescriptionLevel level) const override;
1666
1667 private:
1669 // Use CreateStopHook to make a new empty stop hook. Use SetActionFromString
1670 // to fill it with commands, and SetSpecifier to set the specifier shared
1671 // pointer (can be null, that will match anything.)
1673 : StopHook(target_sp, uid) {}
1674 friend class Target;
1675 };
1676
1678 public:
1679 ~StopHookScripted() override = default;
1681 lldb::StreamSP output) override;
1682
1683 Status SetScriptCallback(std::string class_name,
1684 StructuredData::ObjectSP extra_args_sp);
1685
1687 lldb::DescriptionLevel level) const override;
1688
1689 private:
1690 std::string m_class_name;
1691 /// This holds the dictionary of keys & values that can be used to
1692 /// parametrize any given callback's behavior.
1695
1696 /// Use CreateStopHook to make a new empty stop hook. Use SetScriptCallback
1697 /// to set the script to execute, and SetSpecifier to set the specifier
1698 /// shared pointer (can be null, that will match anything.)
1700 : StopHook(target_sp, uid) {}
1701 friend class Target;
1702 };
1703
1704 class StopHookCoded : public StopHook {
1705 public:
1706 ~StopHookCoded() override = default;
1707
1709 lldb::StreamSP output);
1710
1711 void SetCallback(llvm::StringRef name, HandleStopCallback *callback) {
1712 m_name = name;
1713 m_callback = callback;
1714 }
1715
1717 lldb::StreamSP output) override {
1718 return m_callback(exc_ctx, output);
1719 }
1720
1722 lldb::DescriptionLevel level) const override {
1723 s.Indent();
1724 s.Printf("%s (built-in)\n", m_name.c_str());
1725 }
1726
1727 private:
1728 std::string m_name;
1730
1731 /// Use CreateStopHook to make a new empty stop hook. Use SetCallback to set
1732 /// the callback to execute, and SetSpecifier to set the specifier shared
1733 /// pointer (can be null, that will match anything.)
1735 : StopHook(target_sp, uid) {}
1736 friend class Target;
1737 };
1738
1740
1741 typedef std::shared_ptr<StopHook> StopHookSP;
1742
1743 // Target Hooks
1744 //
1745 // Hooks fire on target lifecycle events. There are two flows:
1746 //
1747 // Command-based hooks: the user specifies which triggers the hook responds
1748 // to (--on-load, --on-unload, --on-stop) and provides a list of commands.
1749 // All commands run for every trigger the hook is signed up for.
1750 //
1751 // Python class hooks: the user provides a Python class name and optional
1752 // extra_args that will be passed to the hook init method (-k key -v value).
1753 // The class controls which events it handles by implementing the
1754 // corresponding callback methods (handle_module_loaded,
1755 // handle_module_unloaded, handle_stop). Triggers are set automatically
1756 // based on which methods exist.
1757 class Hook : public UserID {
1758 public:
1759 Hook(const Hook &rhs);
1760 virtual ~Hook() = default;
1761
1762 enum class HookKind : uint32_t { CommandBased = 0, ScriptBased };
1763
1764 HookKind GetHookKind() const { return m_kind; }
1765
1766 /// Individual trigger bits. Combine with bitwise OR to form a trigger mask.
1767 // FIXME: Add kProcessExit, kProcessDetach, etc. as needed.
1768 enum TriggerBit : uint32_t {
1769 kModulesLoaded = (1u << 0),
1770 kModulesUnloaded = (1u << 1),
1771 kProcessStop = (1u << 2),
1772 };
1773
1775
1776 bool IsEnabled() { return m_enabled; }
1777 void SetIsEnabled(bool enabled) { m_enabled = enabled; }
1778
1779 /// Return the bitmask of triggers this hook responds to.
1780 /// Each bit corresponds to a TriggerBit value.
1781 uint32_t GetTriggerMask() const { return m_trigger_mask; }
1782
1783 /// Return true if this hook fires on the given trigger.
1784 bool FiresOn(uint32_t trigger) const { return m_trigger_mask & trigger; }
1785
1786 // Filter fields
1787
1788 /// Set the symbol context specifier. The hook takes ownership.
1789 void SetSCSpecifier(SymbolContextSpecifier *specifier);
1791
1792 /// Check if the execution context passes the specifier and thread spec
1793 /// filters. Always returns true if no filters are set.
1794 bool ExecutionContextPasses(const ExecutionContext &exe_ctx);
1795
1796 /// Set the thread specifier. The hook takes ownership.
1797 void SetThreadSpecifier(ThreadSpec *specifier);
1799
1800 void SetRunAtInitialStop(bool at_initial_stop) {
1801 m_at_initial_stop = at_initial_stop;
1802 }
1804
1805 // Reaction settings
1806
1807 void SetAutoContinue(bool auto_continue) {
1808 m_auto_continue = auto_continue;
1809 }
1810 bool GetAutoContinue() const { return m_auto_continue; }
1811
1812 void SetSuppressOutput(bool suppress_output) {
1813 m_suppress_output = suppress_output;
1814 }
1815 bool GetSuppressOutput() const { return m_suppress_output; }
1816
1817 // Event handler methods (default no-ops)
1818
1819 virtual void HandleModuleLoaded(lldb::StreamSP output) {}
1820 virtual void HandleModuleUnloaded(lldb::StreamSP output) {}
1821
1822 /// Called when the process stops. Returns a StopHookResult indicating
1823 /// whether the process should remain stopped or continue.
1828
1829 virtual void GetDescription(Stream &s, lldb::DescriptionLevel level) const;
1830
1831 protected:
1832 /// Print the filter portion of the description (AutoContinue, Specifier,
1833 /// ThreadSpec). Called by subclass GetDescription after printing the
1834 /// hook-specific content (commands or class).
1838 bool m_enabled = true;
1839 uint32_t m_trigger_mask = 0; // No default, triggers must be explicit.
1840
1841 // Filters
1843 std::unique_ptr<ThreadSpec> m_thread_spec_up;
1845
1846 // Reaction settings
1847 bool m_auto_continue = false;
1848 bool m_suppress_output = false;
1849
1850 Hook(lldb::TargetSP target_sp, lldb::user_id_t uid, HookKind kind);
1851 };
1852
1853 class HookCommandLine : public Hook {
1854 public:
1855 ~HookCommandLine() override = default;
1856
1857 /// Replace the trigger mask. \a mask is a bitwise OR of TriggerBit values.
1858 void SetTriggerMask(uint32_t mask) { m_trigger_mask = mask; }
1859
1860 /// Add a trigger to the mask. \a trigger is a single TriggerBit value.
1861 void AddTrigger(uint32_t trigger) { m_trigger_mask |= trigger; }
1862
1863 /// Remove a trigger from the mask. \a trigger is a single TriggerBit value.
1864 void RemoveTrigger(uint32_t trigger) { m_trigger_mask &= ~trigger; }
1865
1866 /// Return the list of commands that this hook runs.
1868
1869 /// Populate the command list by splitting a single string on newlines.
1870 void SetActionFromString(const std::string &string);
1871
1872 /// Populate the command list from a vector of individual command strings.
1873 void SetActionFromStrings(const std::vector<std::string> &strings);
1874
1875 void GetDescription(Stream &s, lldb::DescriptionLevel level) const override;
1876 void HandleModuleLoaded(lldb::StreamSP output) override;
1877 void HandleModuleUnloaded(lldb::StreamSP output) override;
1879 lldb::StreamSP output) override;
1880
1881 private:
1883
1885 : Hook(target_sp, uid, HookKind::CommandBased) {}
1886 friend class Target;
1887 };
1888
1889 class HookScripted : public Hook {
1890 public:
1891 ~HookScripted() override = default;
1892
1893 void GetDescription(Stream &s, lldb::DescriptionLevel level) const override;
1894
1895 void HandleModuleLoaded(lldb::StreamSP output) override;
1896 void HandleModuleUnloaded(lldb::StreamSP output) override;
1898 lldb::StreamSP output) override;
1899
1900 Status SetScriptCallback(std::string class_name,
1901 StructuredData::ObjectSP extra_args_sp);
1902
1903 private:
1904 std::string m_class_name;
1907
1909 : Hook(target_sp, uid, HookKind::ScriptBased) {}
1910 friend class Target;
1911 };
1912
1913 typedef std::shared_ptr<Hook> HookSP;
1914
1916
1917 /// Removes the most recently created hook. Used to roll back a
1918 /// hook creation when an error occurs (e.g., invalid script class name
1919 /// or empty interactive input).
1921
1923
1924 void RemoveAllHooks();
1925
1927
1928 bool SetHookEnabledStateByID(lldb::user_id_t uid, bool enabled);
1929
1930 void SetAllHooksEnabledState(bool enabled);
1931
1932 size_t GetNumHooks() const { return m_hooks.size(); }
1933
1934 HookSP GetHookAtIndex(size_t index);
1935
1936 void RunModuleHooks(bool is_load);
1937
1938 /// Add an empty stop hook to the Target's stop hook list, and returns a
1939 /// shared pointer to the new hook.
1940 StopHookSP CreateStopHook(StopHook::StopHookKind kind, bool internal = false);
1941
1942 /// If you tried to create a stop hook, and that failed, call this to
1943 /// remove the stop hook, as it will also reset the stop hook counter.
1945
1946 // Runs the stop hooks that have been registered for this target.
1947 // Returns true if the stop hooks cause the target to resume.
1948 // Pass at_initial_stop if this is the stop where lldb gains
1949 // control over the process for the first time.
1950 bool RunStopHooks(bool at_initial_stop = false);
1951
1952 bool SetSuppresStopHooks(bool suppress) {
1953 bool old_value = m_suppress_stop_hooks;
1954 m_suppress_stop_hooks = suppress;
1955 return old_value;
1956 }
1957
1959
1961
1962 void RemoveAllStopHooks();
1963
1964 StopHookSP GetStopHookByID(lldb::user_id_t uid);
1965
1966 bool SetStopHookActiveStateByID(lldb::user_id_t uid, bool active_state);
1967
1968 void SetAllStopHooksActiveState(bool active_state);
1969
1970 const std::vector<StopHookSP> GetStopHooks(bool internal = false) const;
1971
1973
1974 void SetPlatform(const lldb::PlatformSP &platform_sp) {
1975 m_platform_sp = platform_sp;
1976 }
1977
1979
1980 // Methods.
1982 GetSearchFilterForModule(const FileSpec *containingModule);
1983
1985 GetSearchFilterForModuleList(const FileSpecList *containingModuleList);
1986
1988 GetSearchFilterForModuleAndCUList(const FileSpecList *containingModules,
1989 const FileSpecList *containingSourceFiles);
1990
1992 const char *repl_options, bool can_create);
1993
1994 void SetREPL(lldb::LanguageType language, lldb::REPLSP repl_sp);
1995
1999
2001
2002 /// Get the list of paths that LLDB will consider automatically loading
2003 /// scripting resources from. Currently whether to load scripts
2004 /// unconditionally is controlled via the
2005 /// `target.load-script-from-symbol-file` setting.
2007
2008 /// Add a signal for the target. This will get copied over to the process
2009 /// if the signal exists on that target. Only the values with Yes and No are
2010 /// set, Calculate values will be ignored.
2011protected:
2020 using DummySignalElement = llvm::StringMapEntry<DummySignalValues>;
2021 static bool UpdateSignalFromDummy(lldb::UnixSignalsSP signals_sp,
2022 const DummySignalElement &element);
2023 static bool ResetSignalFromDummy(lldb::UnixSignalsSP signals_sp,
2024 const DummySignalElement &element);
2025
2026public:
2027 /// Add a signal to the Target's list of stored signals/actions. These
2028 /// values will get copied into any processes launched from
2029 /// this target.
2030 void AddDummySignal(llvm::StringRef name, LazyBool pass, LazyBool print,
2031 LazyBool stop);
2032 /// Updates the signals in signals_sp using the stored dummy signals.
2033 /// If warning_stream_sp is not null, if any stored signals are not found in
2034 /// the current process, a warning will be emitted here.
2036 lldb::StreamSP warning_stream_sp);
2037 /// Clear the dummy signals in signal_names from the target, or all signals
2038 /// if signal_names is empty. Also remove the behaviors they set from the
2039 /// process's signals if it exists.
2040 void ClearDummySignals(Args &signal_names);
2041 /// Print all the signals set in this target.
2042 void PrintDummySignals(Stream &strm, Args &signals);
2043
2044protected:
2045 /// Implementing of ModuleList::Notifier.
2046
2047 void NotifyModuleAdded(const ModuleList &module_list,
2048 const lldb::ModuleSP &module_sp) override;
2049
2050 void NotifyModuleRemoved(const ModuleList &module_list,
2051 const lldb::ModuleSP &module_sp) override;
2052
2053 void NotifyModuleUpdated(const ModuleList &module_list,
2054 const lldb::ModuleSP &old_module_sp,
2055 const lldb::ModuleSP &new_module_sp) override;
2056
2057 void NotifyWillClearList(const ModuleList &module_list) override;
2058
2059 void NotifyModulesRemoved(lldb_private::ModuleList &module_list) override;
2060
2061 class Arch {
2062 public:
2063 explicit Arch(const ArchSpec &spec);
2064 const Arch &operator=(const ArchSpec &spec);
2065
2066 const ArchSpec &GetSpec() const { return m_spec; }
2067 Architecture *GetPlugin() const { return m_plugin_up.get(); }
2068
2069 private:
2071 std::unique_ptr<Architecture> m_plugin_up;
2072 };
2073
2074 // Member variables.
2076 lldb::PlatformSP m_platform_sp; ///< The platform for this target.
2077 std::recursive_mutex m_mutex; ///< An API mutex that is used by the lldb::SB*
2078 /// classes make the SB interface thread safe
2079 /// When the private state thread calls SB API's - usually because it is
2080 /// running OS plugin or Python ThreadPlan code - it should not block on the
2081 /// API mutex that is held by the code that kicked off the sequence of events
2082 /// that led us to run the code. We hand out this mutex instead when we
2083 /// detect that code is running on the private state thread.
2084 std::recursive_mutex m_private_mutex;
2086 std::string m_label;
2087 ModuleList m_images; ///< The list of images for this process (shared
2088 /// libraries and anything dynamically loaded).
2094 std::map<ConstString, std::unique_ptr<BreakpointName>>;
2096
2097 std::map<lldb::user_id_t, BreakpointResolverOverrideUP>
2099 /// This is the ID that will be handed out for the next added breakpoint
2100 /// override resolver for this target.
2102
2106 // We want to tightly control the process destruction process so we can
2107 // correctly tear down everything that we need to, so the only class that
2108 // knows about the process lifespan is this target class.
2113
2114 /// Map of scripted frame provider descriptors for this target.
2115 /// Keys are the provider descriptor IDs, values are the descriptors.
2116 /// Insertion order is preserved so that equal-priority providers chain
2117 /// in registration order.
2118 llvm::MapVector<uint32_t, ScriptedFrameProviderDescriptor>
2120 mutable std::recursive_mutex m_frame_provider_descriptors_mutex;
2122
2123 typedef std::map<lldb::LanguageType, lldb::REPLSP> REPLMap;
2125
2127
2128 typedef std::map<lldb::user_id_t, StopHookSP> StopHookCollection;
2131 std::vector<StopHookSP> m_internal_stop_hooks;
2132 uint32_t m_latest_stop_hook_id; /// This records the last natural stop at
2133 /// which we ran a stop-hook.
2135 bool m_suppress_stop_hooks; /// Used to not run stop hooks for expressions
2137
2138 typedef std::map<lldb::user_id_t, HookSP> HookCollection;
2143 LLDB_INVALID_GLOBALLY_UNIQUE_TARGET_ID; ///< The globally unique ID
2144 /// assigned to this target
2145 std::string m_target_session_name; ///< The target session name for this
2146 /// target, used to name debugging
2147 /// sessions in DAP.
2148 /// An optional \a lldb_private::Trace object containing processor trace
2149 /// information of this target.
2151 /// Stores the frame recognizers of this target.
2153 /// These are used to set the signal state when you don't have a process and
2154 /// more usefully in the Dummy target where you can't know exactly what
2155 /// signals you will have.
2156 llvm::StringMap<DummySignalValues> m_dummy_signals;
2157
2159
2160 static void ImageSearchPathsChanged(const PathMappingList &path_list,
2161 void *baton);
2162
2163 // Utilities for `statistics` command.
2164private:
2165 // Target metrics storage.
2167
2168public:
2169 /// Get metrics associated with this target in JSON format.
2170 ///
2171 /// Target metrics help measure timings and information that is contained in
2172 /// a target. These are designed to help measure performance of a debug
2173 /// session as well as represent the current state of the target, like
2174 /// information on the currently modules, currently set breakpoints and more.
2175 ///
2176 /// \return
2177 /// Returns a JSON value that contains all target metrics.
2178 llvm::json::Value
2180
2181 void ResetStatistics();
2182
2184
2185protected:
2186 /// Construct with optional file and arch.
2187 ///
2188 /// This member is private. Clients must use
2189 /// TargetList::CreateTarget(const FileSpec*, const ArchSpec*)
2190 /// so all targets can be tracked from the central target list.
2191 ///
2192 /// \see TargetList::CreateTarget(const FileSpec*, const ArchSpec*)
2193 Target(Debugger &debugger, const ArchSpec &target_arch,
2194 const lldb::PlatformSP &platform_sp, bool is_dummy_target);
2195
2196 // Helper function.
2197 bool ProcessIsValid();
2198
2199 // Copy breakpoints, stop hooks and so forth from the dummy target:
2200 void PrimeFromDummyTarget(Target &target);
2201
2202 void AddBreakpoint(lldb::BreakpointSP breakpoint_sp, bool internal);
2203
2205
2206 /// Return a recommended size for memory reads at \a addr, optimizing for
2207 /// cache usage.
2209
2210 Target(const Target &) = delete;
2211 const Target &operator=(const Target &) = delete;
2212
2214 return m_section_load_history.GetCurrentSectionLoadList();
2215 }
2216};
2217
2218} // namespace lldb_private
2219
2220#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:81
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:100
void SetPreferredSymbolContexts(SymbolContextList contexts)
Definition Target.h:363
void SetOneThreadTimeout(const Timeout< std::micro > &timeout)
Definition Target.h:422
void SetUnwindOnError(bool unwind=false)
Definition Target.h:395
SourceLanguage GetLanguage() const
Definition Target.h:357
const char * GetPoundLineFilePath() const
Definition Target.h:485
lldb::DynamicValueType m_use_dynamic
Definition Target.h:553
void SetExecutionPolicy(ExecutionPolicy policy=eExecutionPolicyAlways)
Definition Target.h:353
Timeout< std::micro > m_one_thread_timeout
Definition Target.h:555
bool InvokeCancelCallback(lldb::ExpressionEvaluationPhase phase) const
Definition Target.h:467
lldb::DynamicValueType GetUseDynamic() const
Definition Target.h:407
void SetKeepInMemory(bool keep=true)
Definition Target.h:405
void SetCoerceToId(bool coerce=true)
Definition Target.h:391
void SetLanguage(lldb::LanguageType language_type)
Definition Target.h:359
ExecutionPolicy GetExecutionPolicy() const
Definition Target.h:351
Timeout< std::micro > m_timeout
Definition Target.h:554
void SetCppIgnoreContextQualifiers(bool value)
Definition Target.cpp:6088
const StructuredData::Dictionary & GetLanguageOptions() const
Definition Target.cpp:6066
llvm::Expected< bool > GetBooleanLanguageOption(llvm::StringRef option_name) const
Get the language-plugin specific boolean option called option_name.
Definition Target.cpp:6050
void SetPrefix(const char *prefix)
Definition Target.h:384
void SetTryAllThreads(bool try_others=true)
Definition Target.h:428
static constexpr std::chrono::milliseconds default_timeout
Definition Target.h:343
void SetPoundLine(const char *path, uint32_t line) const
Definition Target.h:475
void SetRetriesWithFixIts(uint64_t number_of_retries)
Definition Target.h:501
SymbolContextList m_preferred_lookup_contexts
During expression evaluation, any SymbolContext in this list will be used for symbol/function lookup ...
Definition Target.h:571
void SetTimeout(const Timeout< std::micro > &timeout)
Definition Target.h:416
static constexpr ExecutionPolicy default_execution_policy
Definition Target.h:348
void SetStopOthers(bool stop_others=true)
Definition Target.h:432
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:551
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:6033
StructuredData::DictionarySP m_language_options_sp
Dictionary mapping names of language-plugin specific options to values.
Definition Target.h:566
void SetCancelCallback(lldb::ExpressionCancelCallback callback, void *baton)
Definition Target.h:462
const Timeout< std::micro > & GetTimeout() const
Definition Target.h:414
const SymbolContextList & GetPreferredSymbolContexts() const
Definition Target.h:367
void SetIgnoreBreakpoints(bool ignore=false)
Definition Target.h:399
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:374
void SetUseDynamic(lldb::DynamicValueType dynamic=lldb::eDynamicCanRunTarget)
Definition Target.h:410
lldb::ExpressionCancelCallback m_cancel_callback
Definition Target.h:556
const Timeout< std::micro > & GetOneThreadTimeout() const
Definition Target.h:418
"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:57
Encapsulates a function that can be called.
A collection class for Module objects.
Definition ModuleList.h:125
A class that describes an executable image and its associated object and symbol files.
Definition Module.h:90
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:281
Defines a list of symbol context objects.
Defines a symbol context baton that can be handed other debug core functions.
uint32_t GetMaximumSizeOfStringSummary() const
Definition Target.cpp:5561
FileSpecList GetDebugFileSearchPaths()
Definition Target.cpp:5442
llvm::StringRef GetLaunchWorkingDirectory() const
Definition Target.cpp:5248
bool GetDisplayRecognizedArguments() const
Definition Target.cpp:5725
ImportStdModule GetImportStdModule() const
Definition Target.cpp:5458
void AppendExecutableSearchPaths(const FileSpec &)
Definition Target.cpp:5429
bool GetEnableSyntheticValue() const
Definition Target.cpp:5528
void SetStandardInputPath(const char *path)=delete
ProcessLaunchInfo m_launch_info
Definition Target.h:326
bool GetCheckValueObjectOwnership() const
Definition Target.cpp:5853
uint64_t GetExprAllocAlign() const
Definition Target.cpp:5640
MemoryModuleLoadLevel GetMemoryModuleLoadLevel() const
Definition Target.cpp:5697
llvm::StringRef GetArg0() const
Definition Target.cpp:5301
uint32_t GetMaximumMemReadSize() const
Definition Target.cpp:5567
void SetRunArguments(const Args &args)
Definition Target.cpp:5318
FileSpec GetStandardErrorPath() const
Definition Target.cpp:5593
void SetLoadScriptFromSymbolFile(LoadScriptFromSymFile load_style)
Set the target-wide target.load-script-from-symbol-file setting.
Definition Target.cpp:5677
bool GetEnableNotifyAboutFixIts() const
Definition Target.cpp:5484
bool SetPreferDynamicValue(lldb::DynamicValueType d)
Definition Target.cpp:5185
void SetDisplayRecognizedArguments(bool b)
Definition Target.cpp:5731
std::optional< bool > GetExperimentalPropertyValue(size_t prop_idx, ExecutionContext *exe_ctx=nullptr) const
Definition Target.cpp:5124
const ProcessLaunchInfo & GetProcessLaunchInfo() const
Definition Target.cpp:5736
Environment ComputeEnvironment() const
Definition Target.cpp:5324
void SetStandardOutputPath(const char *path)=delete
bool GetUserSpecifiedTrapHandlerNames(Args &args) const
Definition Target.cpp:5704
uint64_t GetExprErrorLimit() const
Definition Target.cpp:5622
bool GetEnableAutoImportClangModules() const
Definition Target.cpp:5452
bool GetDebugUtilityExpression() const
Definition Target.cpp:5842
DynamicClassInfoHelper GetDynamicClassInfoHelper() const
Definition Target.cpp:5465
FileSpec GetStandardOutputPath() const
Definition Target.cpp:5583
void SetDisplayRuntimeSupportValues(bool b)
Definition Target.cpp:5720
uint32_t GetMaximumNumberOfChildrenToDisplay() const
Definition Target.cpp:5546
void SetRequireHardwareBreakpoints(bool b)
Definition Target.cpp:5774
bool GetAutoInstallMainExecutable() const
Definition Target.cpp:5779
const char * GetDisassemblyFeatures() const
Definition Target.cpp:5280
void SetAutoLoadScriptsForModule(llvm::StringRef module_name, LoadScriptFromSymFile load_style)
Set the LoadScriptFromSymFile for a module called module_name (excluding file extension).
Definition Target.cpp:5879
RealpathPrefixes GetSourceRealpathPrefixes() const
Definition Target.cpp:5296
void SetCheckValueObjectOwnership(bool check)
Definition Target.cpp:5859
uint64_t GetNumberOfRetriesWithFixits() const
Definition Target.cpp:5478
uint64_t GetExprAllocSize() const
Definition Target.cpp:5634
std::optional< LoadScriptFromSymFile > GetAutoLoadScriptsForModule(llvm::StringRef module_name) const
Definition Target.cpp:5865
llvm::StringRef GetExpressionPrefixContents()
Definition Target.cpp:5608
PathMappingList & GetObjectPathMap() const
Definition Target.cpp:5415
const char * GetDisassemblyFlavor() const
Definition Target.cpp:5260
FileSpec GetStandardInputPath() const
Definition Target.cpp:5573
lldb::DynamicValueType GetPreferDynamicValue() const
Definition Target.cpp:5178
InlineStrategy GetInlineStrategy() const
Definition Target.cpp:5287
Environment GetTargetEnvironment() const
Definition Target.cpp:5384
bool GetDisplayRuntimeSupportValues() const
Definition Target.cpp:5714
void SetUserSpecifiedTrapHandlerNames(const Args &args)
Definition Target.cpp:5709
uint32_t GetMaxZeroPaddingInFloatFormat() const
Definition Target.cpp:5540
uint64_t GetExprAllocAddress() const
Definition Target.cpp:5628
LoadCWDlldbinitFile GetLoadCWDlldbinitFile() const
Definition Target.cpp:5683
Environment GetInheritedEnvironment() const
Definition Target.cpp:5356
void SetArg0(llvm::StringRef arg)
Definition Target.cpp:5307
bool GetInjectLocalVariables(ExecutionContext *exe_ctx) const
Definition Target.cpp:5135
void SetStandardErrorPath(const char *path)=delete
bool ShowHexVariableValuesWithLeadingZeroes() const
Definition Target.cpp:5534
SourceLanguage GetLanguage() const
Definition Target.cpp:5603
Environment GetEnvironment() const
Definition Target.cpp:5352
void SetProcessLaunchInfo(const ProcessLaunchInfo &launch_info)
Definition Target.cpp:5740
FileSpec GetSaveJITObjectsDir() const
Definition Target.cpp:5490
void SetEnvironment(Environment env)
Definition Target.cpp:5395
LoadScriptFromSymFile GetLoadScriptFromSymbolFile() const
Definition Target.cpp:5670
const char * GetDisassemblyCPU() const
Definition Target.cpp:5273
void SetStandardErrorPath(llvm::StringRef path)
Definition Target.cpp:5598
bool GetRunArguments(Args &args) const
Definition Target.cpp:5313
FileSpecList GetExecutableSearchPaths()
Definition Target.cpp:5437
ArchSpec GetDefaultArchitecture() const
Definition Target.cpp:5162
Disassembler::HexImmediateStyle GetHexImmediateStyle() const
Definition Target.cpp:5690
void SetUseDIL(ExecutionContext *exe_ctx, bool b)
Definition Target.cpp:5153
std::unique_ptr< TargetExperimentalProperties > m_experimental_properties_up
Definition Target.h:327
FileSpecList GetClangModuleSearchPaths()
Definition Target.cpp:5447
void SetStandardOutputPath(llvm::StringRef path)
Definition Target.cpp:5588
bool GetRequireHardwareBreakpoints() const
Definition Target.cpp:5768
PathMappingList & GetSourcePathMap() const
Definition Target.cpp:5407
bool GetAutoSourceMapRelative() const
Definition Target.cpp:5423
bool GetUseDIL(ExecutionContext *exe_ctx) const
Definition Target.cpp:5141
void SetDefaultArchitecture(const ArchSpec &arch)
Definition Target.cpp:5167
void SetStandardInputPath(llvm::StringRef path)
Definition Target.cpp:5578
TargetProperties(Target *target)
Definition Target.cpp:5048
bool GetDisplayExpressionsInCrashlogs() const
Definition Target.cpp:5664
bool GetEnableAutoApplyFixIts() const
Definition Target.cpp:5472
void SetDebugUtilityExpression(bool debug)
Definition Target.cpp:5848
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:5553
A class that represents statistics for a since lldb_private::Target.
Definition Statistics.h:309
std::unique_ptr< Architecture > m_plugin_up
Definition Target.h:2071
const ArchSpec & GetSpec() const
Definition Target.h:2066
const Arch & operator=(const ArchSpec &spec)
Definition Target.cpp:168
Arch(const ArchSpec &spec)
Definition Target.cpp:164
Architecture * GetPlugin() const
Definition Target.h:2067
virtual BreakpointResolverOverrideUP CopyIntoNewTarget(Target &target)=0
BreakpointResolverOverride(Target &target, const std::string &description)
Definition Target.h:1019
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:1861
void RemoveTrigger(uint32_t trigger)
Remove a trigger from the mask. trigger is a single TriggerBit value.
Definition Target.h:1864
void GetDescription(Stream &s, lldb::DescriptionLevel level) const override
Definition Target.cpp:4486
HookCommandLine(lldb::TargetSP target_sp, lldb::user_id_t uid)
Definition Target.h:1884
void SetTriggerMask(uint32_t mask)
Replace the trigger mask. mask is a bitwise OR of TriggerBit values.
Definition Target.h:1858
void SetActionFromString(const std::string &string)
Populate the command list by splitting a single string on newlines.
Definition Target.cpp:4513
void SetActionFromStrings(const std::vector< std::string > &strings)
Populate the command list from a vector of individual command strings.
Definition Target.cpp:4517
void HandleModuleLoaded(lldb::StreamSP output) override
Definition Target.cpp:4523
StringList & GetCommands()
Return the list of commands that this hook runs.
Definition Target.h:1867
StopHook::StopHookResult HandleStop(ExecutionContext &exe_ctx, lldb::StreamSP output) override
Called when the process stops.
Definition Target.cpp:4563
void HandleModuleUnloaded(lldb::StreamSP output) override
Definition Target.cpp:4557
StructuredDataImpl m_extra_args
Definition Target.h:1905
void HandleModuleLoaded(lldb::StreamSP output) override
Definition Target.cpp:4642
StopHook::StopHookResult HandleStop(ExecutionContext &exe_ctx, lldb::StreamSP output) override
Called when the process stops.
Definition Target.cpp:4661
HookScripted(lldb::TargetSP target_sp, lldb::user_id_t uid)
Definition Target.h:1908
Status SetScriptCallback(std::string class_name, StructuredData::ObjectSP extra_args_sp)
Definition Target.cpp:4597
void GetDescription(Stream &s, lldb::DescriptionLevel level) const override
Definition Target.cpp:4679
lldb::ScriptedHookInterfaceSP m_interface_sp
Definition Target.h:1906
void HandleModuleUnloaded(lldb::StreamSP output) override
Definition Target.cpp:4651
virtual ~Hook()=default
void SetSuppressOutput(bool suppress_output)
Definition Target.h:1812
bool GetRunAtInitialStop() const
Definition Target.h:1803
ThreadSpec * GetThreadSpecifier()
Definition Target.h:1798
TriggerBit
Individual trigger bits. Combine with bitwise OR to form a trigger mask.
Definition Target.h:1768
bool GetSuppressOutput() const
Definition Target.h:1815
void SetRunAtInitialStop(bool at_initial_stop)
Definition Target.h:1800
lldb::SymbolContextSpecifierSP m_sc_specifier_sp
Definition Target.h:1842
void SetIsEnabled(bool enabled)
Definition Target.h:1777
bool ExecutionContextPasses(const ExecutionContext &exe_ctx)
Check if the execution context passes the specifier and thread spec filters.
Definition Target.cpp:4409
HookKind GetHookKind() const
Definition Target.h:1764
Hook(const Hook &rhs)
Definition Target.cpp:4390
virtual StopHook::StopHookResult HandleStop(ExecutionContext &exe_ctx, lldb::StreamSP output)
Called when the process stops.
Definition Target.h:1824
void GetFilterDescription(Stream &s, lldb::DescriptionLevel level) const
Print the filter portion of the description (AutoContinue, Specifier, ThreadSpec).
Definition Target.cpp:4458
void SetAutoContinue(bool auto_continue)
Definition Target.h:1807
bool GetAutoContinue() const
Definition Target.h:1810
virtual void HandleModuleUnloaded(lldb::StreamSP output)
Definition Target.h:1820
uint32_t GetTriggerMask() const
Return the bitmask of triggers this hook responds to.
Definition Target.h:1781
lldb::TargetSP & GetTarget()
Definition Target.h:1774
SymbolContextSpecifier * GetSCSpecifier()
Definition Target.h:1790
lldb::TargetSP m_target_sp
Definition Target.h:1836
virtual void GetDescription(Stream &s, lldb::DescriptionLevel level) const
Definition Target.cpp:4425
void SetSCSpecifier(SymbolContextSpecifier *specifier)
Set the symbol context specifier. The hook takes ownership.
Definition Target.cpp:4401
void SetThreadSpecifier(ThreadSpec *specifier)
Set the thread specifier. The hook takes ownership.
Definition Target.cpp:4405
virtual void HandleModuleLoaded(lldb::StreamSP output)
Definition Target.h:1819
bool FiresOn(uint32_t trigger) const
Return true if this hook fires on the given trigger.
Definition Target.h:1784
std::unique_ptr< ThreadSpec > m_thread_spec_up
Definition Target.h:1843
void GetSubclassDescription(Stream &s, lldb::DescriptionLevel level) const override
Definition Target.h:1721
HandleStopCallback * m_callback
Definition Target.h:1729
StopHookResult HandleStop(ExecutionContext &exc_ctx, lldb::StreamSP output) override
Definition Target.h:1716
StopHookCoded(lldb::TargetSP target_sp, lldb::user_id_t uid)
Use CreateStopHook to make a new empty stop hook.
Definition Target.h:1734
void SetCallback(llvm::StringRef name, HandleStopCallback *callback)
Definition Target.h:1711
StopHookResult(ExecutionContext &exc_ctx, lldb::StreamSP output) HandleStopCallback
Definition Target.h:1708
void SetActionFromString(const std::string &strings)
Definition Target.cpp:4239
StopHookCommandLine(lldb::TargetSP target_sp, lldb::user_id_t uid)
Definition Target.h:1672
void SetActionFromStrings(const std::vector< std::string > &strings)
Definition Target.cpp:4243
StopHookResult HandleStop(ExecutionContext &exc_ctx, lldb::StreamSP output_sp) override
Definition Target.cpp:4250
void GetSubclassDescription(Stream &s, lldb::DescriptionLevel level) const override
Definition Target.cpp:4221
Status SetScriptCallback(std::string class_name, StructuredData::ObjectSP extra_args_sp)
Definition Target.cpp:4284
StopHookResult HandleStop(ExecutionContext &exc_ctx, lldb::StreamSP output) override
Definition Target.cpp:4324
StopHookScripted(lldb::TargetSP target_sp, lldb::user_id_t uid)
Use CreateStopHook to make a new empty stop hook.
Definition Target.h:1699
void GetSubclassDescription(Stream &s, lldb::DescriptionLevel level) const override
Definition Target.cpp:4346
StructuredDataImpl m_extra_args
This holds the dictionary of keys & values that can be used to parametrize any given callback's behav...
Definition Target.h:1693
lldb::ScriptedStopHookInterfaceSP m_interface_sp
Definition Target.h:1694
bool GetRunAtInitialStop() const
Definition Target.h:1630
SymbolContextSpecifier * GetSpecifier()
Definition Target.h:1599
void SetSpecifier(SymbolContextSpecifier *specifier)
Definition Target.cpp:4159
virtual StopHookResult HandleStop(ExecutionContext &exe_ctx, lldb::StreamSP output)=0
std::unique_ptr< ThreadSpec > m_thread_spec_up
Definition Target.h:1645
void SetIsActive(bool is_active)
Definition Target.h:1618
void SetSuppressOutput(bool suppress_output)
Definition Target.h:1632
void SetThreadSpecifier(ThreadSpec *specifier)
Definition Target.cpp:4163
ThreadSpec * GetThreadSpecifier()
Definition Target.h:1614
StopHook(const StopHook &rhs)
Definition Target.cpp:4151
bool ExecutionContextPasses(const ExecutionContext &exe_ctx)
Definition Target.cpp:4167
lldb::TargetSP & GetTarget()
Definition Target.h:1593
void SetRunAtInitialStop(bool at_initial_stop)
Definition Target.h:1626
lldb::SymbolContextSpecifierSP m_specifier_sp
Definition Target.h:1644
virtual void GetSubclassDescription(Stream &s, lldb::DescriptionLevel level) const =0
void GetDescription(Stream &s, lldb::DescriptionLevel level) const
Definition Target.cpp:4183
void SetAutoContinue(bool auto_continue)
Definition Target.h:1620
const ModuleList & GetModuleList() const
Definition Target.h:645
void Dump(Stream *s) const override
Definition Target.cpp:5911
static llvm::StringRef GetFlavorString()
Definition Target.cpp:5907
static lldb::TargetSP GetCreatedTargetFromEvent(const Event *event_ptr)
Definition Target.cpp:5940
static ModuleList GetModuleListFromEvent(const Event *event_ptr)
Definition Target.cpp:5949
static const TargetEventData * GetEventDataFromEvent(const Event *event_ptr)
Definition Target.cpp:5921
llvm::StringRef GetFlavor() const override
Definition Target.h:623
const lldb::TargetSP & GetTarget() const
Definition Target.h:639
TargetEventData(const lldb::TargetSP &target_sp)
Definition Target.cpp:5893
TargetEventData(const TargetEventData &)=delete
const lldb::TargetSP & GetCreatedTarget() const
Definition Target.h:641
const TargetEventData & operator=(const TargetEventData &)=delete
static lldb::TargetSP GetTargetFromEvent(const Event *event_ptr)
Definition Target.cpp:5931
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:1910
void DescribeBreakpointOverrides(Stream &stream, std::vector< lldb::user_id_t > &idxs)
Describe the breakpoint overrides.
Definition Target.cpp:973
lldb::ThreadSP CalculateThread() override
Definition Target.cpp:2651
llvm::Expected< uint32_t > AddScriptedFrameProviderDescriptor(const ScriptedFrameProviderDescriptor &descriptor)
Add or update a scripted frame provider descriptor for this target.
Definition Target.cpp:3849
StopHookCollection m_stop_hooks
Definition Target.h:2129
Module * GetExecutableModulePointer()
Definition Target.cpp:1610
void Dump(Stream *s, lldb::DescriptionLevel description_level)
Dump a description of this object to a Stream.
Definition Target.cpp:257
void DisableAllBreakpoints(bool internal_also=false)
Definition Target.cpp:1142
bool RemoveHookByID(lldb::user_id_t uid)
Definition Target.cpp:4742
lldb::WatchpointSP CreateWatchpoint(lldb::addr_t addr, size_t size, const CompilerType *type, uint32_t kind, Status &error)
Definition Target.cpp:1024
void ApplyNameToBreakpoints(BreakpointName &bp_name)
Definition Target.cpp:930
lldb::user_id_t m_hook_next_id
Definition Target.h:2140
lldb::TraceSP GetTrace()
Get the Trace object containing processor trace information of this target.
Definition Target.cpp:3724
PathMappingList & GetImageSearchPathList()
Definition Target.cpp:2660
void FinalizeFileActions(ProcessLaunchInfo &info)
Definition Target.cpp:3931
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:3059
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:3067
ModuleList & GetImages()
Definition Target.h:1242
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:775
static Target * GetTargetFromContexts(const ExecutionContext *exe_ctx_ptr, const SymbolContext *sc_ptr)
Definition Target.cpp:2894
lldb::BreakpointResolverSP CheckBreakpointOverrides(lldb::BreakpointResolverSP original_sp)
Definition Target.h:1059
lldb::addr_t GetBreakableLoadAddress(lldb::addr_t addr)
Definition Target.cpp:3074
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:4091
bool SetSuppresStopHooks(bool suppress)
Definition Target.h:1952
static void ImageSearchPathsChanged(const PathMappingList &path_list, void *baton)
Definition Target.cpp:2664
llvm::Expected< lldb_private::Address > GetEntryPointAddress()
This method will return the address of the starting function for this binary, e.g.
Definition Target.cpp:3025
bool IgnoreWatchpointByID(lldb::watch_id_t watch_id, uint32_t ignore_count)
Definition Target.cpp:1578
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:741
size_t GetNumHooks() const
Definition Target.h:1932
lldb::BreakpointSP GetBreakpointByID(lldb::break_id_t break_id)
Definition Target.cpp:436
std::shared_ptr< StopHook > StopHookSP
Definition Target.h:1741
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:599
void SymbolsDidLoad(ModuleList &module_list)
Definition Target.cpp:1938
bool ClearAllWatchpointHistoricValues()
Definition Target.cpp:1492
const std::vector< StopHookSP > GetStopHooks(bool internal=false) const
Definition Target.cpp:3187
void SetTrace(const lldb::TraceSP &trace_sp)
Set the Trace object containing processor trace information of this target.
Definition Target.cpp:3722
BreakpointList & GetBreakpointList(bool internal=false)
Definition Target.cpp:422
uint32_t m_next_frame_provider_id
Definition Target.h:2121
CompilerType GetRegisterType(const std::string &name, const lldb_private::RegisterFlags &flags, uint32_t byte_size)
Definition Target.cpp:2700
BreakpointNameList m_breakpoint_names
Definition Target.h:2095
lldb_private::SummaryStatisticsCache & GetSummaryStatisticsCache()
Definition Target.cpp:3539
const llvm::MapVector< uint32_t, ScriptedFrameProviderDescriptor > & GetScriptedFrameProviderDescriptors() const
Get all scripted frame provider descriptors for this target.
Definition Target.cpp:3910
lldb::addr_t GetSectionLoadAddress(const lldb::SectionSP &section_sp)
Definition Target.cpp:5978
llvm::StringRef GetABIName() const
Returns the name of the target's ABI plugin.
Definition Target.cpp:411
SourceManager & GetSourceManager()
Definition Target.cpp:3111
lldb::SearchFilterSP GetSearchFilterForModuleList(const FileSpecList *containingModuleList)
Definition Target.cpp:704
StopHookSP GetStopHookByID(lldb::user_id_t uid)
Definition Target.cpp:3153
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:2156
lldb::user_id_t AddBreakpointResolverOverride(BreakpointResolverOverrideUP override_up)
Add a breakpoint override resolver. This version can't fail.
Definition Target.h:1038
lldb::ProcessSP m_process_sp
Definition Target.h:2109
Debugger & GetDebugger() const
Definition Target.h:1323
lldb::SearchFilterSP m_search_filter_sp
Definition Target.h:2110
PersistentExpressionState * GetPersistentExpressionStateForLanguage(lldb::LanguageType language)
Definition Target.cpp:2744
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:4079
bool m_is_dummy_target
Used to not run stop hooks for expressions.
Definition Target.h:2136
static bool UpdateSignalFromDummy(lldb::UnixSignalsSP signals_sp, const DummySignalElement &element)
Definition Target.cpp:4037
PathMappingList m_image_search_paths
Definition Target.h:2111
bool ModuleIsExcludedForUnconstrainedSearches(const FileSpec &module_spec)
Return whether this FileSpec corresponds to a module that should be considered for general searches.
Definition Target.cpp:1996
lldb::StackFrameSP CalculateStackFrame() override
Definition Target.cpp:2653
SectionLoadList & GetSectionLoadList()
Definition Target.h:2213
lldb::addr_t GetPersistentSymbol(ConstString name)
Definition Target.cpp:3005
void PrimeFromDummyTarget(Target &target)
Definition Target.cpp:224
bool RemoveScriptedFrameProviderDescriptor(uint32_t id)
Remove a scripted frame provider descriptor by id.
Definition Target.cpp:3885
lldb::RegisterTypeBuilderSP m_register_type_builder_sp
Definition Target.h:2158
static void SettingsTerminate()
Definition Target.cpp:2856
bool EnableWatchpointByID(lldb::watch_id_t watch_id)
Definition Target.cpp:1543
HookSP CreateHook(Hook::HookKind kind)
Definition Target.cpp:4720
bool ResolveFileAddress(lldb::addr_t load_addr, Address &so_addr)
Definition Target.cpp:3455
bool ClearAllWatchpointHitCounts()
Definition Target.cpp:1478
size_t ReadMemoryFromFileCache(const Address &addr, void *dst, size_t dst_len, Status &error)
Definition Target.cpp:2028
void ClearAllLoadedSections()
Definition Target.cpp:3531
std::vector< lldb::TypeSystemSP > GetScratchTypeSystems(bool create_on_demand=true)
Definition Target.cpp:2710
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:2327
void AddNameToBreakpoint(BreakpointID &id, llvm::StringRef name, Status &error)
Definition Target.cpp:852
void DumpSectionLoadList(Stream &s)
Definition Target.cpp:5984
void DeleteCurrentProcess()
Definition Target.cpp:293
BreakpointList m_internal_breakpoint_list
Definition Target.h:2092
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:2358
void DisableAllowedBreakpoints()
Definition Target.cpp:1152
bool SetHookEnabledStateByID(lldb::user_id_t uid, bool enabled)
Definition Target.cpp:4764
bool LoadScriptingResources(std::list< Status > &errors, bool continue_on_error=true)
Definition Target.h:1217
bool SetSectionUnloaded(const lldb::SectionSP &section_sp)
Definition Target.cpp:3509
lldb::TargetSP CalculateTarget() override
Definition Target.cpp:2647
const lldb::ProcessSP & GetProcessSP() const
Definition Target.cpp:327
void ClearModules(bool delete_locations)
Definition Target.cpp:1614
bool RemoveBreakpointByID(lldb::break_id_t break_id)
Definition Target.cpp:1176
llvm::MapVector< uint32_t, ScriptedFrameProviderDescriptor > m_frame_provider_descriptors
Map of scripted frame provider descriptors for this target.
Definition Target.h:2119
lldb::ModuleSP GetOrCreateModule(const ModuleSpec &module_spec, bool notify, Status *error_ptr=nullptr)
Find a binary on the system and return its Module, or return an existing Module that is already in th...
Definition Target.cpp:2410
static bool ResetSignalFromDummy(lldb::UnixSignalsSP signals_sp, const DummySignalElement &element)
Definition Target.cpp:4064
Architecture * GetArchitecturePlugin() const
Definition Target.h:1321
llvm::json::Value ReportStatistics(const lldb_private::StatisticsOptions &options)
Get metrics associated with this target in JSON format.
Definition Target.cpp:5970
friend class TargetList
Definition Target.h:581
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:2797
TargetStats & GetStatistics()
Definition Target.h:2183
void EnableAllBreakpoints(bool internal_also=false)
Definition Target.cpp:1159
Status Launch(ProcessLaunchInfo &launch_info, Stream *stream)
Definition Target.cpp:3554
bool DisableBreakpointByID(lldb::break_id_t break_id)
Definition Target.cpp:1196
lldb::BreakpointSP CreateBreakpointAtUserEntry(Status &error)
Definition Target.cpp:448
BreakpointName * FindBreakpointName(ConstString name, bool can_create, Status &error)
Definition Target.cpp:884
std::map< lldb::user_id_t, StopHookSP > StopHookCollection
Definition Target.h:2128
llvm::Expected< lldb::TraceSP > CreateTrace()
Create a Trace object for the current target using the using the default supported tracing technology...
Definition Target.cpp:3726
lldb::TraceSP m_trace_sp
An optional lldb_private::Trace object containing processor trace information of this target.
Definition Target.h:2150
lldb::user_id_t GetGloballyUniqueID() const
Get the globally unique ID for this target.
Definition Target.h:681
bool RemoveAllWatchpoints(bool end_to_end=true)
Definition Target.cpp:1396
bool ReadPointerFromMemory(const Address &addr, Status &error, Address &pointer_addr, bool force_live_memory=false)
Definition Target.cpp:2380
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:3139
WatchpointList m_watchpoint_list
Definition Target.h:2104
BreakpointList m_breakpoint_list
Definition Target.h:2091
lldb::SourceManagerUP m_source_manager_up
Definition Target.h:2126
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:2101
bool RemoveWatchpointByID(lldb::watch_id_t watch_id)
Definition Target.cpp:1562
bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr, uint32_t stop_id=SectionLoadHistory::eStopIDNow, bool allow_section_end=false)
Definition Target.cpp:3449
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:2278
HookSP GetHookByID(lldb::user_id_t uid)
Definition Target.cpp:4749
void DeleteBreakpointName(ConstString name)
Definition Target.cpp:906
void NotifyWillClearList(const ModuleList &module_list) override
Definition Target.cpp:1872
bool SetArchitecture(const ArchSpec &arch_spec, bool set_platform=false, bool merge=true)
Set the architecture for this target.
Definition Target.cpp:1756
void ClearBreakpointResolverOverrides()
Definition Target.h:1056
bool RemoveBreakpointResolverOverride(lldb::user_id_t override_id)
Definition Target.h:1051
void NotifyModuleAdded(const ModuleList &module_list, const lldb::ModuleSP &module_sp) override
Implementing of ModuleList::Notifier.
Definition Target.cpp:1874
llvm::Expected< lldb::TypeSystemSP > GetScratchTypeSystemForLanguage(lldb::LanguageType language, bool create_on_demand=true)
Definition Target.cpp:2673
void ConfigureBreakpointName(BreakpointName &bp_name, const BreakpointOptions &options, const BreakpointName::Permissions &permissions)
Definition Target.cpp:922
lldb_private::SummaryStatisticsSP GetSummaryStatisticsSPForProviderName(lldb_private::TypeSummaryImpl &summary_provider)
Definition Target.cpp:3533
lldb::SearchFilterSP GetSearchFilterForModuleAndCUList(const FileSpecList *containingModules, const FileSpecList *containingSourceFiles)
Definition Target.cpp:721
lldb::ModuleSP GetExecutableModule()
Gets the module for the main executable.
Definition Target.cpp:1594
bool SetStopHookActiveStateByID(lldb::user_id_t uid, bool active_state)
Definition Target.cpp:3163
const lldb::ProcessSP & CreateProcess(lldb::ListenerSP listener_sp, llvm::StringRef plugin_name, const FileSpec *crash_file, bool can_connect)
Definition Target.cpp:315
void SetAllStopHooksActiveState(bool active_state)
Definition Target.cpp:3174
std::vector< StopHookSP > m_internal_stop_hooks
Definition Target.h:2131
lldb::ExpressionVariableSP GetPersistentVariable(ConstString name)
Definition Target.cpp:2986
void NotifyModulesRemoved(lldb_private::ModuleList &module_list) override
Definition Target.cpp:1906
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:3117
size_t ReadCStringFromMemory(const Address &addr, std::string &out_str, Status &error, bool force_live_memory=false)
Definition Target.cpp:2188
void SetAllHooksEnabledState(bool enabled)
Definition Target.cpp:4772
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:2077
std::recursive_mutex m_frame_provider_descriptors_mutex
Definition Target.h:2120
lldb::user_id_t m_target_unique_id
The globally unique ID assigned to this target.
Definition Target.h:2142
void ModulesDidUnload(ModuleList &module_list, bool delete_locations)
Definition Target.cpp:1954
void CalculateExecutionContext(ExecutionContext &exe_ctx) override
Reconstruct the object's execution context into sc.
Definition Target.cpp:2655
llvm::Expected< lldb::DisassemblerSP > ReadInstructions(const Address &start_addr, uint32_t count, const char *flavor_string=nullptr)
Definition Target.cpp:3080
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:3751
void NotifyModuleUpdated(const ModuleList &module_list, const lldb::ModuleSP &old_module_sp, const lldb::ModuleSP &new_module_sp) override
Definition Target.cpp:1894
SummaryStatisticsCache m_summary_statistics_cache
Definition Target.h:2089
Target(const Target &)=delete
void RegisterInternalStopHooks()
Status SerializeBreakpointsToFile(const FileSpec &file, const BreakpointIDList &bp_ids, bool append)
Definition Target.cpp:1237
void DidExec()
Called as the last function in Process::DidExec().
Definition Target.cpp:1621
void SaveScriptedLaunchInfo(lldb_private::ProcessInfo &process_info)
Definition Target.cpp:3543
bool GetSuppressStopHooks()
Definition Target.h:1958
std::string m_label
Definition Target.h:2086
lldb::user_id_t m_stop_hook_next_id
Definition Target.h:2130
static FileSpecList GetDefaultExecutableSearchPaths()
Definition Target.cpp:2858
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:758
void NotifyBreakpointChanged(Breakpoint &bp, lldb::BreakpointEventType event_kind)
Sends a breakpoint notification event.
Definition Target.cpp:5988
lldb::SearchFilterSP GetSearchFilterForModule(const FileSpec *containingModule)
Definition Target.cpp:686
llvm::StringMapEntry< DummySignalValues > DummySignalElement
Definition Target.h:2020
std::recursive_mutex & GetAPIMutex()
Definition Target.cpp:5957
static llvm::StringRef GetStaticBroadcasterClass()
Definition Target.cpp:174
static FileSpecList GetDefaultDebugFileSearchPaths()
Definition Target.cpp:2862
void EnableAllowedBreakpoints()
Definition Target.cpp:1169
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:2062
llvm::Error SetLabel(llvm::StringRef label)
Set a label for a target.
Definition Target.cpp:2877
uint32_t m_latest_stop_hook_id
Definition Target.h:2132
void RunModuleHooks(bool is_load)
Definition Target.cpp:4777
std::map< lldb::user_id_t, BreakpointResolverOverrideUP > m_breakpoint_overrides
Definition Target.h:2098
StackFrameRecognizerManager & GetFrameRecognizerManager()
Definition Target.h:1996
void RemoveAllowedBreakpoints()
Definition Target.cpp:1121
bool DisableAllWatchpoints(bool end_to_end=true)
Definition Target.cpp:1425
bool RunStopHooks(bool at_initial_stop=false)
Definition Target.cpp:3198
void ClearSectionLoadList()
Definition Target.cpp:5982
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:2265
lldb::PlatformSP m_platform_sp
The platform for this target.
Definition Target.h:2076
void UndoCreateHook(lldb::user_id_t uid)
Removes the most recently created hook.
Definition Target.cpp:4735
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:2827
FileSpecList GetSafeAutoLoadPaths() const
Get the list of paths that LLDB will consider automatically loading scripting resources from.
Definition Target.cpp:6004
static TargetProperties & GetGlobalProperties()
Definition Target.cpp:3413
Status Install(ProcessLaunchInfo *launch_info)
Definition Target.cpp:3421
HookSP GetHookAtIndex(size_t index)
Definition Target.cpp:4756
lldb::PlatformSP GetPlatform()
Definition Target.h:1972
void NotifyModuleRemoved(const ModuleList &module_list, const lldb::ModuleSP &module_sp) override
Definition Target.cpp:1884
lldb::BreakpointSP CreateAddressInModuleBreakpoint(lldb::addr_t file_addr, bool internal, const FileSpec &file_spec, bool request_hardware)
Definition Target.cpp:592
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:503
void RemoveAllBreakpoints(bool internal_also=false)
Definition Target.cpp:1130
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:486
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:2866
void ResetBreakpointHitCounts()
Resets the hit count of all breakpoints.
Definition Target.cpp:1233
std::unique_ptr< BreakpointResolverOverride > BreakpointResolverOverrideUP
Definition Target.h:1014
const ModuleList & GetImages() const
Get accessor for the images for this process.
Definition Target.h:1240
const ArchSpec & GetArchitecture() const
Definition Target.h:1282
WatchpointList & GetWatchpointList()
Definition Target.h:954
@ eBroadcastBitWatchpointChanged
Definition Target.h:589
@ eBroadcastBitBreakpointChanged
Definition Target.h:586
@ eBroadcastBitNewTargetCreated
Definition Target.h:592
unsigned m_next_persistent_variable_index
Definition Target.h:2141
bool EnableBreakpointByID(lldb::break_id_t break_id)
Definition Target.cpp:1214
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:2369
void InvalidateThreadFrameProviders()
Invalidate all potentially cached frame providers for all threads and trigger a stack changed event f...
Definition Target.cpp:3916
TargetStats m_stats
Definition Target.h:2166
bool IgnoreAllWatchpoints(uint32_t ignore_count)
Definition Target.cpp:1507
void AddBreakpoint(lldb::BreakpointSP breakpoint_sp, bool internal)
Definition Target.cpp:829
std::string m_target_session_name
The target session name for this target, used to name debugging sessions in DAP.
Definition Target.h:2145
TypeSystemMap m_scratch_type_system_map
Definition Target.h:2112
void AddBreakpointName(std::unique_ptr< BreakpointName > bp_name)
Definition Target.cpp:879
void SetTargetSessionName(llvm::StringRef target_session_name)
Set the target session name for this target.
Definition Target.h:714
SectionLoadHistory m_section_load_history
Definition Target.h:2090
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)
void GetBreakpointNames(std::vector< std::string > &names)
Definition Target.cpp:945
bool IsDummyTarget() const
Definition Target.h:670
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:179
size_t UnloadModuleSections(const lldb::ModuleSP &module_sp)
Definition Target.cpp:3490
llvm::StringRef GetTargetSessionName()
Get the target session name for this target.
Definition Target.h:702
const std::string & GetLabel() const
Definition Target.h:683
std::map< lldb::user_id_t, HookSP > HookCollection
Definition Target.h:2138
bool m_valid
This records the last natural stop at which we ran a stop-hook.
Definition Target.h:2134
bool DisableWatchpointByID(lldb::watch_id_t watch_id)
Definition Target.cpp:1524
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:4022
void ClearScriptedFrameProviderDescriptors()
Clear all scripted frame provider descriptors for this target.
Definition Target.cpp:3898
std::map< ConstString, std::unique_ptr< BreakpointName > > BreakpointNameList
Definition Target.h:2093
lldb::WatchpointSP m_last_created_watchpoint
Definition Target.h:2105
Status CreateBreakpointsFromFile(const FileSpec &file, BreakpointIDList &new_bps)
Definition Target.cpp:1329
Debugger & m_debugger
Definition Target.h:2075
void SetREPL(lldb::LanguageType language, lldb::REPLSP repl_sp)
Definition Target.cpp:380
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)
void SetExecutableModule(lldb::ModuleSP &module_sp, LoadDependentFiles load_dependent_files=eLoadDependentsDefault)
Set the main executable module.
Definition Target.cpp:1627
lldb::StackFrameRecognizerManagerUP m_frame_recognizer_manager_up
Stores the frame recognizers of this target.
Definition Target.h:2152
HookCollection m_hooks
Definition Target.h:2139
lldb::REPLSP GetREPL(Status &err, lldb::LanguageType language, const char *repl_options, bool can_create)
Definition Target.cpp:329
std::shared_ptr< Hook > HookSP
Definition Target.h:1913
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:2764
ModuleList m_images
The list of images for this process (shared libraries and anything dynamically loaded).
Definition Target.h:2087
lldb::ProcessSP CalculateProcess() override
Definition Target.cpp:2649
void PrintDummySignals(Stream &strm, Args &signals)
Print all the signals set in this target.
Definition Target.cpp:4116
void SetPlatform(const lldb::PlatformSP &platform_sp)
Definition Target.h:1974
bool SetSectionLoadAddress(const lldb::SectionSP &section, lldb::addr_t load_addr, bool warn_multiple=false)
Definition Target.cpp:3460
Status Attach(ProcessAttachInfo &attach_info, Stream *stream)
Definition Target.cpp:3757
std::map< lldb::LanguageType, lldb::REPLSP > REPLMap
Definition Target.h:2123
static void SetDefaultArchitecture(const ArchSpec &arch)
Definition Target.cpp:2870
lldb::BreakpointSP m_last_created_breakpoint
Definition Target.h:2103
lldb::WatchpointSP GetLastCreatedWatchpoint()
Definition Target.h:950
void RemoveNameFromBreakpoint(lldb::BreakpointSP &bp_sp, ConstString name)
Definition Target.cpp:917
bool RemoveStopHookByID(lldb::user_id_t uid)
Definition Target.cpp:3146
friend class Debugger
Definition Target.h:582
lldb::BreakpointSP GetLastCreatedBreakpoint()
Definition Target.h:842
static void SettingsInitialize()
Definition Target.cpp:2854
~Target() override
Definition Target.cpp:218
bool EnableAllWatchpoints(bool end_to_end=true)
Definition Target.cpp:1452
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:2084
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:2908
bool MergeArchitecture(const ArchSpec &arch_spec)
Definition Target.cpp:1847
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:58
@ eLoadScriptFromSymFileTrue
Definition Target.h:59
@ eLoadScriptFromSymFileTrusted
Definition Target.h:62
@ eLoadScriptFromSymFileFalse
Definition Target.h:60
@ eLoadScriptFromSymFileWarn
Definition Target.h:61
ExecutionPolicy
Expression execution policies.
DynamicClassInfoHelper
Definition Target.h:77
@ eDynamicClassInfoHelperCopyRealizedClassList
Definition Target.h:80
@ eDynamicClassInfoHelperGetRealizedClassList
Definition Target.h:81
@ eDynamicClassInfoHelperAuto
Definition Target.h:78
@ eDynamicClassInfoHelperRealizedClassesStruct
Definition Target.h:79
OptionEnumValues GetDynamicValueTypes()
Definition Target.cpp:4825
@ eImportStdModuleFalse
Definition Target.h:72
@ eImportStdModuleFallback
Definition Target.h:73
@ eImportStdModuleTrue
Definition Target.h:74
LoadCWDlldbinitFile
Definition Target.h:65
@ eLoadCWDlldbinitTrue
Definition Target.h:66
@ eLoadCWDlldbinitFalse
Definition Target.h:67
@ eLoadCWDlldbinitWarn
Definition Target.h:68
llvm::ArrayRef< OptionEnumValueElement > OptionEnumValues
@ eInlineBreakpointsNever
Definition Target.h:53
@ eInlineBreakpointsAlways
Definition Target.h:55
@ eInlineBreakpointsHeaders
Definition Target.h:54
ExpressionEvaluationPhase
Expression Evaluation Stages.
std::shared_ptr< lldb_private::Trace > TraceSP
std::shared_ptr< lldb_private::ScriptedHookInterface > ScriptedHookInterfaceSP
std::shared_ptr< lldb_private::ScriptedStopHookInterface > ScriptedStopHookInterfaceSP
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::shared_ptr< lldb_private::Thread > ThreadSP
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:87
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:88
uint64_t user_id_t
Definition lldb-types.h:82
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
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:2016
UserID(lldb::user_id_t uid=LLDB_INVALID_UID)
Construct with optional user ID.
Definition UserID.h:33