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"
43#include "lldb/lldb-public.h"
44#include "llvm/ADT/MapVector.h"
45#include "llvm/ADT/StringRef.h"
46
47namespace lldb_private {
48
50
56
63
69
75
82
87
89public:
90 TargetProperties(Target *target);
91
93
95
96 void SetDefaultArchitecture(const ArchSpec &arch);
97
98 bool GetMoveToNearestCode() const;
99
101
103
104 bool GetPreloadSymbols() const;
105
106 void SetPreloadSymbols(bool b);
107
108 bool GetDisableASLR() const;
109
110 void SetDisableASLR(bool b);
111
112 bool GetInheritTCC() const;
113
114 void SetInheritTCC(bool b);
115
116 bool GetDetachOnError() const;
117
118 void SetDetachOnError(bool b);
119
120 bool GetDisableSTDIO() const;
121
122 void SetDisableSTDIO(bool b);
123
124 llvm::StringRef GetLaunchWorkingDirectory() const;
125
126 bool GetParallelModuleLoad() const;
127
128 const char *GetDisassemblyFlavor() const;
129
130 const char *GetDisassemblyCPU() const;
131
132 const char *GetDisassemblyFeatures() const;
133
135
137
138 llvm::StringRef GetArg0() const;
139
140 void SetArg0(llvm::StringRef arg);
141
142 bool GetRunArguments(Args &args) const;
143
144 void SetRunArguments(const Args &args);
145
146 // Get the whole environment including the platform inherited environment and
147 // the target specific environment, excluding the unset environment variables.
149 // Get the platform inherited environment, excluding the unset environment
150 // variables.
152 // Get the target specific environment only, without the platform inherited
153 // environment.
155 // Set the target specific environment.
156 void SetEnvironment(Environment env);
157
158 bool GetSkipPrologue() const;
159
161
163
164 bool GetAutoSourceMapRelative() const;
165
167
169
171
173
175
177
179
180 bool GetEnableAutoApplyFixIts() const;
181
182 uint64_t GetNumberOfRetriesWithFixits() const;
183
184 bool GetEnableNotifyAboutFixIts() const;
185
187
188 bool GetEnableSyntheticValue() const;
189
191
192 uint32_t GetMaxZeroPaddingInFloatFormat() const;
193
195
196 /// Get the max depth value, augmented with a bool to indicate whether the
197 /// depth is the default.
198 ///
199 /// When the user has customized the max depth, the bool will be false.
200 ///
201 /// \returns the max depth, and true if the max depth is the system default,
202 /// otherwise false.
203 std::pair<uint32_t, bool> GetMaximumDepthOfChildrenToDisplay() const;
204
205 uint32_t GetMaximumSizeOfStringSummary() const;
206
207 uint32_t GetMaximumMemReadSize() const;
208
212
213 void SetStandardInputPath(llvm::StringRef path);
214 void SetStandardOutputPath(llvm::StringRef path);
215 void SetStandardErrorPath(llvm::StringRef path);
216
217 void SetStandardInputPath(const char *path) = delete;
218 void SetStandardOutputPath(const char *path) = delete;
219 void SetStandardErrorPath(const char *path) = delete;
220
222
224
225 llvm::StringRef GetExpressionPrefixContents();
226
227 uint64_t GetExprErrorLimit() const;
228
229 uint64_t GetExprAllocAddress() const;
230
231 uint64_t GetExprAllocSize() const;
232
233 uint64_t GetExprAllocAlign() const;
234
235 bool GetUseHexImmediates() const;
236
237 bool GetUseFastStepping() const;
238
240
242
243 /// Set the target-wide target.load-script-from-symbol-file setting.
244 /// See \c SetAutoLoadScriptsForModule for overriding this setting
245 /// per-module.
247
249
251
253
254 bool GetUserSpecifiedTrapHandlerNames(Args &args) const;
255
256 void SetUserSpecifiedTrapHandlerNames(const Args &args);
257
259
261
263
265
267
268 void SetProcessLaunchInfo(const ProcessLaunchInfo &launch_info);
269
270 bool GetInjectLocalVariables(ExecutionContext *exe_ctx) const;
271
272 bool GetUseDIL(ExecutionContext *exe_ctx) const;
273
274 void SetUseDIL(ExecutionContext *exe_ctx, bool b);
275
277
279
280 bool GetAutoInstallMainExecutable() const;
281
283
284 void SetDebugUtilityExpression(bool debug);
285
286 bool GetDebugUtilityExpression() const;
287
288 void SetCheckValueObjectOwnership(bool check);
289
290 bool GetCheckValueObjectOwnership() const;
291
292 std::optional<LoadScriptFromSymFile>
293 GetAutoLoadScriptsForModule(llvm::StringRef module_name) const;
294
295 /// Set the \c LoadScriptFromSymFile for a module called \c module_name
296 /// (excluding file extension). LLDB will prefer this over the target-wide
297 /// target.load-script-from-symbol-file setting
298 /// (see \c SetLoadScriptFromSymbolFile).
299 void SetAutoLoadScriptsForModule(llvm::StringRef module_name,
300 LoadScriptFromSymFile load_style);
301
302private:
303 std::optional<bool>
304 GetExperimentalPropertyValue(size_t prop_idx,
305 ExecutionContext *exe_ctx = nullptr) const;
306
307 // Callbacks for m_launch_info.
318
319 // Settings checker for target.jit-save-objects-dir:
320 void CheckJITObjectsDir();
321
323
324 // Member variables.
326 std::unique_ptr<TargetExperimentalProperties> m_experimental_properties_up;
328};
329
331public:
333
334// MSVC has a bug here that reports C4268: 'const' static/global data
335// initialized with compiler generated default constructor fills the object
336// with zeros. Confirmed that MSVC is *not* zero-initializing, it's just a
337// bogus warning.
338#if defined(_MSC_VER)
339#pragma warning(push)
340#pragma warning(disable : 4268)
341#endif
342 static constexpr std::chrono::milliseconds default_timeout{500};
343#if defined(_MSC_VER)
344#pragma warning(pop)
345#endif
346
349
351
355
357
358 void SetLanguage(lldb::LanguageType language_type) {
359 m_language = SourceLanguage(language_type);
360 }
361
363 m_preferred_lookup_contexts = std::move(contexts);
364 }
365
369
370 /// Set the language using a pair of language code and version as
371 /// defined by the DWARF 6 specification.
372 /// WARNING: These codes may change until DWARF 6 is finalized.
373 void SetLanguage(uint16_t name, uint32_t version) {
374 m_language = SourceLanguage(name, version);
375 }
376
377 bool DoesCoerceToId() const { return m_coerce_to_id; }
378
379 const char *GetPrefix() const {
380 return (m_prefix.empty() ? nullptr : m_prefix.c_str());
381 }
382
383 void SetPrefix(const char *prefix) {
384 if (prefix && prefix[0])
385 m_prefix = prefix;
386 else
387 m_prefix.clear();
388 }
389
390 void SetCoerceToId(bool coerce = true) { m_coerce_to_id = coerce; }
391
392 bool DoesUnwindOnError() const { return m_unwind_on_error; }
393
394 void SetUnwindOnError(bool unwind = false) { m_unwind_on_error = unwind; }
395
397
398 void SetIgnoreBreakpoints(bool ignore = false) {
399 m_ignore_breakpoints = ignore;
400 }
401
402 bool DoesKeepInMemory() const { return m_keep_in_memory; }
403
404 void SetKeepInMemory(bool keep = true) { m_keep_in_memory = keep; }
405
407
408 void
412
413 const Timeout<std::micro> &GetTimeout() const { return m_timeout; }
414
415 void SetTimeout(const Timeout<std::micro> &timeout) { m_timeout = timeout; }
416
420
422 m_one_thread_timeout = timeout;
423 }
424
425 bool GetTryAllThreads() const { return m_try_others; }
426
427 void SetTryAllThreads(bool try_others = true) { m_try_others = try_others; }
428
429 bool GetStopOthers() const { return m_stop_others; }
430
431 void SetStopOthers(bool stop_others = true) { m_stop_others = stop_others; }
432
433 bool GetDebug() const { return m_debug; }
434
435 void SetDebug(bool b) {
436 m_debug = b;
437 if (m_debug)
439 }
440
442
444
445 bool GetColorizeErrors() const { return m_ansi_color_errors; }
446
448
449 bool GetTrapExceptions() const { return m_trap_exceptions; }
450
452
453 bool GetStopOnFork() const { return m_stop_on_fork; }
454
455 void SetStopOnFork(bool b) { m_stop_on_fork = b; }
456
457 bool GetREPLEnabled() const { return m_repl; }
458
459 void SetREPLEnabled(bool b) { m_repl = b; }
460
463 m_cancel_callback = callback;
464 }
465
467 return ((m_cancel_callback != nullptr)
469 : false);
470 }
471
472 // Allows the expression contents to be remapped to point to the specified
473 // file and line using #line directives.
474 void SetPoundLine(const char *path, uint32_t line) const {
475 if (path && path[0]) {
476 m_pound_line_file = path;
477 m_pound_line_line = line;
478 } else {
479 m_pound_line_file.clear();
481 }
482 }
483
484 const char *GetPoundLineFilePath() const {
485 return (m_pound_line_file.empty() ? nullptr : m_pound_line_file.c_str());
486 }
487
488 uint32_t GetPoundLineLine() const { return m_pound_line_line; }
489
491
495
497
499
500 void SetRetriesWithFixIts(uint64_t number_of_retries) {
501 m_retries_with_fixits = number_of_retries;
502 }
503
504 uint64_t GetRetriesWithFixIts() const { return m_retries_with_fixits; }
505
507
509
510 /// Set language-plugin specific option called \c option_name to
511 /// the specified boolean \c value.
512 llvm::Error SetBooleanLanguageOption(llvm::StringRef option_name, bool value);
513
514 /// Get the language-plugin specific boolean option called \c option_name.
515 ///
516 /// If the option doesn't exist or is not a boolean option, returns false.
517 /// Otherwise returns the boolean value of the option.
518 llvm::Expected<bool>
519 GetBooleanLanguageOption(llvm::StringRef option_name) const;
520
521 void SetCppIgnoreContextQualifiers(bool value);
522
524
525private:
527
529
532 std::string m_prefix;
533 bool m_coerce_to_id = false;
534 bool m_unwind_on_error = true;
536 bool m_keep_in_memory = false;
537 bool m_try_others = true;
538 bool m_stop_others = true;
539 bool m_debug = false;
540 bool m_trap_exceptions = true;
541 bool m_stop_on_fork = false;
542 bool m_repl = false;
548 /// True if the executed code should be treated as utility code that is only
549 /// used by LLDB internally.
551
556 void *m_cancel_callback_baton = nullptr;
557 // If m_pound_line_file is not empty and m_pound_line_line is non-zero, use
558 // #line %u "%s" before the expression content to remap where the source
559 // originates
560 mutable std::string m_pound_line_file;
561 mutable uint32_t m_pound_line_line = 0;
562
563 /// Dictionary mapping names of language-plugin specific options
564 /// to values.
566
567 /// During expression evaluation, any SymbolContext in this list will be
568 /// used for symbol/function lookup before any other context (except for
569 /// the module corresponding to the current frame).
571};
572
573// Target
574class Target : public std::enable_shared_from_this<Target>,
575 public TargetProperties,
576 public Broadcaster,
578 public ModuleList::Notifier {
579public:
580 friend class TargetList;
581 friend class Debugger;
582
583 /// Broadcaster event bits definitions.
584 enum {
592 };
593
594 // These two functions fill out the Broadcaster interface:
595
596 static llvm::StringRef GetStaticBroadcasterClass();
597
598 llvm::StringRef GetBroadcasterClass() const override {
600 }
601
602 // This event data class is for use by the TargetList to broadcast new target
603 // notifications.
604 class TargetEventData : public EventData {
605 public:
606 TargetEventData(const lldb::TargetSP &target_sp);
607
608 TargetEventData(const lldb::TargetSP &target_sp,
609 const ModuleList &module_list);
610
611 // Constructor for eBroadcastBitNewTargetCreated events. For this event
612 // type:
613 // - target_sp is the parent target (the subject/broadcaster of the event)
614 // - created_target_sp is the newly created target
615 TargetEventData(const lldb::TargetSP &target_sp,
616 const lldb::TargetSP &created_target_sp);
617
619
620 static llvm::StringRef GetFlavorString();
621
622 llvm::StringRef GetFlavor() const override {
624 }
625
626 void Dump(Stream *s) const override;
627
628 static const TargetEventData *GetEventDataFromEvent(const Event *event_ptr);
629
630 static lldb::TargetSP GetTargetFromEvent(const Event *event_ptr);
631
632 // For eBroadcastBitNewTargetCreated events, returns the newly created
633 // target. For other event types, returns an invalid target.
634 static lldb::TargetSP GetCreatedTargetFromEvent(const Event *event_ptr);
635
636 static ModuleList GetModuleListFromEvent(const Event *event_ptr);
637
638 const lldb::TargetSP &GetTarget() const { return m_target_sp; }
639
641 return m_created_target_sp;
642 }
643
644 const ModuleList &GetModuleList() const { return m_module_list; }
645
646 private:
650
652 const TargetEventData &operator=(const TargetEventData &) = delete;
653 };
654
655 ~Target() override;
656
657 static void SettingsInitialize();
658
659 static void SettingsTerminate();
660
662
664
666
667 static void SetDefaultArchitecture(const ArchSpec &arch);
668
669 bool IsDummyTarget() const { return m_is_dummy_target; }
670
671 /// Get the globally unique ID for this target.
672 ///
673 /// This ID is unique across all debugger instances and all targets,
674 /// within the same lldb process. The ID is assigned
675 /// during target construction and remains constant for the target's lifetime.
676 /// The first target created (typically the dummy target) gets ID 1.
677 ///
678 /// \return
679 /// The globally unique ID for this target.
681
682 const std::string &GetLabel() const { return m_label; }
683
684 /// Set a label for a target.
685 ///
686 /// The label cannot be used by another target or be only integral.
687 ///
688 /// \return
689 /// The label for this target or an error if the label didn't match the
690 /// requirements.
691 llvm::Error SetLabel(llvm::StringRef label);
692
693 /// Get the target session name for this target.
694 ///
695 /// Provides a meaningful name for IDEs or tools to display for dynamically
696 /// created targets. Defaults to "Session {ID}" based on the globally unique
697 /// ID.
698 ///
699 /// \return
700 /// The target session name for this target.
701 llvm::StringRef GetTargetSessionName() { return m_target_session_name; }
702
703 /// Set the target session name for this target.
704 ///
705 /// This should typically be set along with the event
706 /// eBroadcastBitNewTargetCreated. Useful for scripts or triggers that
707 /// automatically create targets and want to provide meaningful names that
708 /// IDEs or other tools can display to help users identify the origin and
709 /// purpose of each target.
710 ///
711 /// \param[in] target_session_name
712 /// The target session name to set for this target.
713 void SetTargetSessionName(llvm::StringRef target_session_name) {
714 m_target_session_name = target_session_name.str();
715 }
716
717 /// Find a binary on the system and return its Module,
718 /// or return an existing Module that is already in the Target.
719 ///
720 /// Given a ModuleSpec, find a binary satisifying that specification,
721 /// or identify a matching Module already present in the Target,
722 /// and return a shared pointer to it.
723 ///
724 /// Note that this function previously also preloaded the module's symbols
725 /// depending on a setting. This function no longer does any module
726 /// preloading because that can potentially cause deadlocks when called in
727 /// parallel with this function.
728 ///
729 /// \param[in] module_spec
730 /// The criteria that must be matched for the binary being loaded.
731 /// e.g. UUID, architecture, file path.
732 ///
733 /// \param[in] notify
734 /// If notify is true, and the Module is new to this Target,
735 /// Target::ModulesDidLoad will be called. See note in
736 /// Target::ModulesDidLoad about thread-safety with
737 /// Target::GetOrCreateModule.
738 /// If notify is false, it is assumed that the caller is adding
739 /// multiple Modules and will call ModulesDidLoad with the
740 /// full list at the end.
741 /// ModulesDidLoad must be called when a Module/Modules have
742 /// been added to the target, one way or the other.
743 ///
744 /// \param[out] error_ptr
745 /// Optional argument, pointing to a Status object to fill in
746 /// with any results / messages while attempting to find/load
747 /// this binary. Many callers will be internal functions that
748 /// will handle / summarize the failures in a custom way and
749 /// don't use these messages.
750 ///
751 /// \return
752 /// An empty ModuleSP will be returned if no matching file
753 /// was found. If error_ptr was non-nullptr, an error message
754 /// will likely be provided.
755 lldb::ModuleSP GetOrCreateModule(const ModuleSpec &module_spec, bool notify,
756 Status *error_ptr = nullptr);
757
758 // Settings accessors
759
761
762 std::recursive_mutex &GetAPIMutex();
763
765
766 void CleanupProcess();
767
768 /// Dump a description of this object to a Stream.
769 ///
770 /// Dump a description of the contents of this object to the
771 /// supplied stream \a s. The dumped content will be only what has
772 /// been loaded or parsed up to this point at which this function
773 /// is called, so this is a good way to see what has been parsed
774 /// in a target.
775 ///
776 /// \param[in] s
777 /// The stream to which to dump the object description.
778 void Dump(Stream *s, lldb::DescriptionLevel description_level);
779
780 // If listener_sp is null, the listener of the owning Debugger object will be
781 // used.
783 llvm::StringRef plugin_name,
784 const FileSpec *crash_file,
785 bool can_connect);
786
787 const lldb::ProcessSP &GetProcessSP() const;
788
789 bool IsValid() { return m_valid; }
790
791 void Destroy();
792
793 Status Launch(ProcessLaunchInfo &launch_info,
794 Stream *stream); // Optional stream to receive first stop info
795
796 Status Attach(ProcessAttachInfo &attach_info,
797 Stream *stream); // Optional stream to receive first stop info
798
799 /// Add or update a scripted frame provider descriptor for this target.
800 /// All new threads in this target will check if they match any descriptors
801 /// to create their frame providers.
802 ///
803 /// \param[in] descriptor
804 /// The descriptor to add or update.
805 ///
806 /// \return
807 /// The descriptor identifier if the registration succeeded, otherwise an
808 /// llvm::Error.
809 llvm::Expected<uint32_t> AddScriptedFrameProviderDescriptor(
810 const ScriptedFrameProviderDescriptor &descriptor);
811
812 /// Remove a scripted frame provider descriptor by id.
813 ///
814 /// \param[in] id
815 /// The id of the descriptor to remove.
816 ///
817 /// \return
818 /// True if a descriptor was removed, false if no descriptor with that
819 /// id existed.
821
822 /// Clear all scripted frame provider descriptors for this target.
824
825 /// Get all scripted frame provider descriptors for this target.
826 const llvm::MapVector<uint32_t, ScriptedFrameProviderDescriptor> &
828
829protected:
830 /// Invalidate all potentially cached frame providers for all threads
831 /// and trigger a stack changed event for all threads.
833
834public:
835 // This part handles the breakpoints.
836
837 BreakpointList &GetBreakpointList(bool internal = false);
838
839 const BreakpointList &GetBreakpointList(bool internal = false) const;
840
844
846
848
849 // Use this to create a file and line breakpoint to a given module or all
850 // module it is nullptr
851 lldb::BreakpointSP CreateBreakpoint(const FileSpecList *containingModules,
852 const FileSpec &file, uint32_t line_no,
853 uint32_t column, lldb::addr_t offset,
854 LazyBool check_inlines,
855 LazyBool skip_prologue, bool internal,
856 bool request_hardware,
857 LazyBool move_to_nearest_code);
858
859 // Use this to create breakpoint that matches regex against the source lines
860 // in files given in source_file_list: If function_names is non-empty, also
861 // filter by function after the matches are made.
863 const FileSpecList *containingModules,
864 const FileSpecList *source_file_list,
865 const std::unordered_set<std::string> &function_names,
866 RegularExpression source_regex, bool internal, bool request_hardware,
867 LazyBool move_to_nearest_code);
868
869 // Use this to create a breakpoint from a load address
870 lldb::BreakpointSP CreateBreakpoint(lldb::addr_t load_addr, bool internal,
871 bool request_hardware);
872
873 // Use this to create a breakpoint from a file address and a module file spec
875 bool internal,
876 const FileSpec &file_spec,
877 bool request_hardware);
878
879 // Use this to create Address breakpoints:
880 lldb::BreakpointSP CreateBreakpoint(const Address &addr, bool internal,
881 bool request_hardware);
882
883 // Use this to create a function breakpoint by regexp in
884 // containingModule/containingSourceFiles, or all modules if it is nullptr
885 // When "skip_prologue is set to eLazyBoolCalculate, we use the current
886 // target setting, else we use the values passed in
888 const FileSpecList *containingModules,
889 const FileSpecList *containingSourceFiles, RegularExpression func_regexp,
890 lldb::LanguageType requested_language, LazyBool skip_prologue,
891 bool internal, bool request_hardware);
892
893 // Use this to create a function breakpoint by name in containingModule, or
894 // all modules if it is nullptr When "skip_prologue is set to
895 // eLazyBoolCalculate, we use the current target setting, else we use the
896 // values passed in. func_name_type_mask is or'ed values from the
897 // FunctionNameType enum.
899 const FileSpecList *containingModules,
900 const FileSpecList *containingSourceFiles, const char *func_name,
901 lldb::FunctionNameType func_name_type_mask, lldb::LanguageType language,
902 lldb::addr_t offset, bool offset_is_insn_count, LazyBool skip_prologue,
903 bool internal, bool request_hardware);
904
906 CreateExceptionBreakpoint(enum lldb::LanguageType language, bool catch_bp,
907 bool throw_bp, bool internal,
908 Args *additional_args = nullptr,
909 Status *additional_args_error = nullptr);
910
912 const llvm::StringRef class_name, const FileSpecList *containingModules,
913 const FileSpecList *containingSourceFiles, bool internal,
914 bool request_hardware, StructuredData::ObjectSP extra_args_sp,
915 Status *creation_error = nullptr);
916
917 // This is the same as the func_name breakpoint except that you can specify a
918 // vector of names. This is cheaper than a regular expression breakpoint in
919 // the case where you just want to set a breakpoint on a set of names you
920 // already know. func_name_type_mask is or'ed values from the
921 // FunctionNameType enum.
923 const FileSpecList *containingModules,
924 const FileSpecList *containingSourceFiles, const char *func_names[],
925 size_t num_names, lldb::FunctionNameType func_name_type_mask,
926 lldb::LanguageType language, lldb::addr_t offset, LazyBool skip_prologue,
927 bool internal, bool request_hardware);
928
930 CreateBreakpoint(const FileSpecList *containingModules,
931 const FileSpecList *containingSourceFiles,
932 const std::vector<std::string> &func_names,
933 lldb::FunctionNameType func_name_type_mask,
934 lldb::LanguageType language, lldb::addr_t m_offset,
935 LazyBool skip_prologue, bool internal,
936 bool request_hardware);
937
938 // Use this to create a general breakpoint:
940 lldb::BreakpointResolverSP &resolver_sp,
941 bool internal, bool request_hardware,
942 bool resolve_indirect_symbols);
943
944 // Use this to create a watchpoint:
946 const CompilerType *type, uint32_t kind,
947 Status &error);
948
952
954
955 // Manages breakpoint names:
956 void AddNameToBreakpoint(BreakpointID &id, llvm::StringRef name,
957 Status &error);
958
959 void AddNameToBreakpoint(lldb::BreakpointSP &bp_sp, llvm::StringRef name,
960 Status &error);
961
963
964 BreakpointName *FindBreakpointName(ConstString name, bool can_create,
965 Status &error);
966
968
970 const BreakpointOptions &options,
971 const BreakpointName::Permissions &permissions);
973
974 void AddBreakpointName(std::unique_ptr<BreakpointName> bp_name);
975
976 void GetBreakpointNames(std::vector<std::string> &names);
977
978 // This call removes ALL breakpoints regardless of permission.
979 void RemoveAllBreakpoints(bool internal_also = false);
980
981 // This removes all the breakpoints, but obeys the ePermDelete on them.
983
984 void DisableAllBreakpoints(bool internal_also = false);
985
987
988 void EnableAllBreakpoints(bool internal_also = false);
989
991
993
995
997
998 /// Resets the hit count of all breakpoints.
1000
1001 // The flag 'end_to_end', default to true, signifies that the operation is
1002 // performed end to end, for both the debugger and the debuggee.
1003
1004 bool RemoveAllWatchpoints(bool end_to_end = true);
1005
1006 bool DisableAllWatchpoints(bool end_to_end = true);
1007
1008 bool EnableAllWatchpoints(bool end_to_end = true);
1009
1011
1013
1014 bool IgnoreAllWatchpoints(uint32_t ignore_count);
1015
1017
1019
1021
1022 bool IgnoreWatchpointByID(lldb::watch_id_t watch_id, uint32_t ignore_count);
1023
1025 const BreakpointIDList &bp_ids,
1026 bool append);
1027
1029 BreakpointIDList &new_bps);
1030
1032 std::vector<std::string> &names,
1033 BreakpointIDList &new_bps);
1034
1035 /// Get \a load_addr as a callable code load address for this target
1036 ///
1037 /// Take \a load_addr and potentially add any address bits that are
1038 /// needed to make the address callable. For ARM this can set bit
1039 /// zero (if it already isn't) if \a load_addr is a thumb function.
1040 /// If \a addr_class is set to AddressClass::eInvalid, then the address
1041 /// adjustment will always happen. If it is set to an address class
1042 /// that doesn't have code in it, LLDB_INVALID_ADDRESS will be
1043 /// returned.
1045 lldb::addr_t load_addr,
1046 AddressClass addr_class = AddressClass::eInvalid) const;
1047
1048 /// Get \a load_addr as an opcode for this target.
1049 ///
1050 /// Take \a load_addr and potentially strip any address bits that are
1051 /// needed to make the address point to an opcode. For ARM this can
1052 /// clear bit zero (if it already isn't) if \a load_addr is a
1053 /// thumb function and load_addr is in code.
1054 /// If \a addr_class is set to AddressClass::eInvalid, then the address
1055 /// adjustment will always happen. If it is set to an address class
1056 /// that doesn't have code in it, LLDB_INVALID_ADDRESS will be
1057 /// returned.
1060 AddressClass addr_class = AddressClass::eInvalid) const;
1061
1062 // Get load_addr as breakable load address for this target. Take a addr and
1063 // check if for any reason there is a better address than this to put a
1064 // breakpoint on. If there is then return that address. For MIPS, if
1065 // instruction at addr is a delay slot instruction then this method will find
1066 // the address of its previous instruction and return that address.
1068
1069 /// This call may preload module symbols, and may do so in parallel depending
1070 /// on the following target settings:
1071 /// - TargetProperties::GetPreloadSymbols()
1072 /// - TargetProperties::GetParallelModuleLoad()
1073 ///
1074 /// Warning: if preloading is active and this is called in parallel with
1075 /// Target::GetOrCreateModule, this may result in a ABBA deadlock situation.
1076 void ModulesDidLoad(ModuleList &module_list);
1077
1078 void ModulesDidUnload(ModuleList &module_list, bool delete_locations);
1079
1080 void SymbolsDidLoad(ModuleList &module_list);
1081
1082 void ClearModules(bool delete_locations);
1083
1084 /// Called as the last function in Process::DidExec().
1085 ///
1086 /// Process::DidExec() will clear a lot of state in the process,
1087 /// then try to reload a dynamic loader plugin to discover what
1088 /// binaries are currently available and then this function should
1089 /// be called to allow the target to do any cleanup after everything
1090 /// has been figured out. It can remove breakpoints that no longer
1091 /// make sense as the exec might have changed the target
1092 /// architecture, and unloaded some modules that might get deleted.
1093 void DidExec();
1094
1095 /// Gets the module for the main executable.
1096 ///
1097 /// Each process has a notion of a main executable that is the file
1098 /// that will be executed or attached to. Executable files can have
1099 /// dependent modules that are discovered from the object files, or
1100 /// discovered at runtime as things are dynamically loaded.
1101 ///
1102 /// \return
1103 /// The shared pointer to the executable module which can
1104 /// contains a nullptr Module object if no executable has been
1105 /// set.
1106 ///
1107 /// \see DynamicLoader
1108 /// \see ObjectFile::GetDependentModules (FileSpecList&)
1109 /// \see Process::SetExecutableModule(lldb::ModuleSP&)
1111
1113
1114 /// Set the main executable module.
1115 ///
1116 /// Each process has a notion of a main executable that is the file
1117 /// that will be executed or attached to. Executable files can have
1118 /// dependent modules that are discovered from the object files, or
1119 /// discovered at runtime as things are dynamically loaded.
1120 ///
1121 /// Setting the executable causes any of the current dependent
1122 /// image information to be cleared and replaced with the static
1123 /// dependent image information found by calling
1124 /// ObjectFile::GetDependentModules (FileSpecList&) on the main
1125 /// executable and any modules on which it depends. Calling
1126 /// Process::GetImages() will return the newly found images that
1127 /// were obtained from all of the object files.
1128 ///
1129 /// \param[in] module_sp
1130 /// A shared pointer reference to the module that will become
1131 /// the main executable for this process.
1132 ///
1133 /// \param[in] load_dependent_files
1134 /// If \b true then ask the object files to track down any
1135 /// known dependent files.
1136 ///
1137 /// \see ObjectFile::GetDependentModules (FileSpecList&)
1138 /// \see Process::GetImages()
1140 lldb::ModuleSP &module_sp,
1141 LoadDependentFiles load_dependent_files = eLoadDependentsDefault);
1142
1143 bool LoadScriptingResources(std::list<Status> &errors,
1144 bool continue_on_error = true) {
1145 return m_images.LoadScriptingResourcesInTarget(this, errors,
1146 continue_on_error);
1147 }
1148
1149 /// Get accessor for the images for this process.
1150 ///
1151 /// Each process has a notion of a main executable that is the file
1152 /// that will be executed or attached to. Executable files can have
1153 /// dependent modules that are discovered from the object files, or
1154 /// discovered at runtime as things are dynamically loaded. After
1155 /// a main executable has been set, the images will contain a list
1156 /// of all the files that the executable depends upon as far as the
1157 /// object files know. These images will usually contain valid file
1158 /// virtual addresses only. When the process is launched or attached
1159 /// to, the DynamicLoader plug-in will discover where these images
1160 /// were loaded in memory and will resolve the load virtual
1161 /// addresses is each image, and also in images that are loaded by
1162 /// code.
1163 ///
1164 /// \return
1165 /// A list of Module objects in a module list.
1166 const ModuleList &GetImages() const { return m_images; }
1167
1169
1170 /// Return whether this FileSpec corresponds to a module that should be
1171 /// considered for general searches.
1172 ///
1173 /// This API will be consulted by the SearchFilterForUnconstrainedSearches
1174 /// and any module that returns \b true will not be searched. Note the
1175 /// SearchFilterForUnconstrainedSearches is the search filter that
1176 /// gets used in the CreateBreakpoint calls when no modules is provided.
1177 ///
1178 /// The target call at present just consults the Platform's call of the
1179 /// same name.
1180 ///
1181 /// \param[in] module_spec
1182 /// Path to the module.
1183 ///
1184 /// \return \b true if the module should be excluded, \b false otherwise.
1185 bool ModuleIsExcludedForUnconstrainedSearches(const FileSpec &module_spec);
1186
1187 /// Return whether this module should be considered for general searches.
1188 ///
1189 /// This API will be consulted by the SearchFilterForUnconstrainedSearches
1190 /// and any module that returns \b true will not be searched. Note the
1191 /// SearchFilterForUnconstrainedSearches is the search filter that
1192 /// gets used in the CreateBreakpoint calls when no modules is provided.
1193 ///
1194 /// The target call at present just consults the Platform's call of the
1195 /// same name.
1196 ///
1197 /// FIXME: When we get time we should add a way for the user to set modules
1198 /// that they
1199 /// don't want searched, in addition to or instead of the platform ones.
1200 ///
1201 /// \param[in] module_sp
1202 /// A shared pointer reference to the module that checked.
1203 ///
1204 /// \return \b true if the module should be excluded, \b false otherwise.
1205 bool
1207
1208 const ArchSpec &GetArchitecture() const { return m_arch.GetSpec(); }
1209
1210 /// Returns the name of the target's ABI plugin.
1211 llvm::StringRef GetABIName() const;
1212
1213 /// Set the architecture for this target.
1214 ///
1215 /// If the current target has no Images read in, then this just sets the
1216 /// architecture, which will be used to select the architecture of the
1217 /// ExecutableModule when that is set. If the current target has an
1218 /// ExecutableModule, then calling SetArchitecture with a different
1219 /// architecture from the currently selected one will reset the
1220 /// ExecutableModule to that slice of the file backing the ExecutableModule.
1221 /// If the file backing the ExecutableModule does not contain a fork of this
1222 /// architecture, then this code will return false, and the architecture
1223 /// won't be changed. If the input arch_spec is the same as the already set
1224 /// architecture, this is a no-op.
1225 ///
1226 /// \param[in] arch_spec
1227 /// The new architecture.
1228 ///
1229 /// \param[in] set_platform
1230 /// If \b true, then the platform will be adjusted if the currently
1231 /// selected platform is not compatible with the architecture being set.
1232 /// If \b false, then just the architecture will be set even if the
1233 /// currently selected platform isn't compatible (in case it might be
1234 /// manually set following this function call).
1235 ///
1236 /// \param[in] merged
1237 /// If true, arch_spec is merged with the current
1238 /// architecture. Otherwise it's replaced.
1239 ///
1240 /// \return
1241 /// \b true if the architecture was successfully set, \b false otherwise.
1242 bool SetArchitecture(const ArchSpec &arch_spec, bool set_platform = false,
1243 bool merge = true);
1244
1245 bool MergeArchitecture(const ArchSpec &arch_spec);
1246
1247 Architecture *GetArchitecturePlugin() const { return m_arch.GetPlugin(); }
1248
1249 Debugger &GetDebugger() const { return m_debugger; }
1250
1251 size_t ReadMemoryFromFileCache(const Address &addr, void *dst, size_t dst_len,
1252 Status &error);
1253
1254 // Reading memory through the target allows us to skip going to the process
1255 // for reading memory if possible and it allows us to try and read from any
1256 // constant sections in our object files on disk. If you always want live
1257 // program memory, read straight from the process. If you possibly want to
1258 // read from const sections in object files, read from the target. This
1259 // version of ReadMemory will try and read memory from the process if the
1260 // process is alive. The order is:
1261 // 1 - if (force_live_memory == false) and the address falls in a read-only
1262 // section, then read from the file cache
1263 // 2 - if there is a process, then read from memory
1264 // 3 - if there is no process, then read from the file cache
1265 //
1266 // If did_read_live_memory is provided, will indicate if the read was from
1267 // live memory, or from file contents. A caller which needs to treat these two
1268 // sources differently should use this argument to disambiguate where the data
1269 // was read from.
1270 //
1271 // The method is virtual for mocking in the unit tests.
1272 virtual size_t ReadMemory(const Address &addr, void *dst, size_t dst_len,
1273 Status &error, bool force_live_memory = false,
1274 lldb::addr_t *load_addr_ptr = nullptr,
1275 bool *did_read_live_memory = nullptr);
1276
1277 size_t ReadCStringFromMemory(const Address &addr, std::string &out_str,
1278 Status &error, bool force_live_memory = false);
1279
1280 size_t ReadCStringFromMemory(const Address &addr, char *dst,
1281 size_t dst_max_len, Status &result_error,
1282 bool force_live_memory = false);
1283
1284 /// Read a NULL terminated string from memory
1285 ///
1286 /// This function will read a cache page at a time until a NULL string
1287 /// terminator is found. It will stop reading if an aligned sequence of NULL
1288 /// termination \a type_width bytes is not found before reading \a
1289 /// cstr_max_len bytes. The results are always guaranteed to be NULL
1290 /// terminated, and that no more than (max_bytes - type_width) bytes will be
1291 /// read.
1292 ///
1293 /// \param[in] addr
1294 /// The address to start the memory read.
1295 ///
1296 /// \param[in] dst
1297 /// A character buffer containing at least max_bytes.
1298 ///
1299 /// \param[in] max_bytes
1300 /// The maximum number of bytes to read.
1301 ///
1302 /// \param[in] error
1303 /// The error status of the read operation.
1304 ///
1305 /// \param[in] type_width
1306 /// The size of the null terminator (1 to 4 bytes per
1307 /// character). Defaults to 1.
1308 ///
1309 /// \return
1310 /// The error status or the number of bytes prior to the null terminator.
1311 size_t ReadStringFromMemory(const Address &addr, char *dst, size_t max_bytes,
1312 Status &error, size_t type_width,
1313 bool force_live_memory = true);
1314
1315 size_t ReadScalarIntegerFromMemory(const Address &addr, uint32_t byte_size,
1316 bool is_signed, Scalar &scalar,
1317 Status &error,
1318 bool force_live_memory = false);
1319
1320 int64_t ReadSignedIntegerFromMemory(const Address &addr,
1321 size_t integer_byte_size,
1322 int64_t fail_value, Status &error,
1323 bool force_live_memory = false);
1324
1325 uint64_t ReadUnsignedIntegerFromMemory(const Address &addr,
1326 size_t integer_byte_size,
1327 uint64_t fail_value, Status &error,
1328 bool force_live_memory = false);
1329
1330 bool ReadPointerFromMemory(const Address &addr, Status &error,
1331 Address &pointer_addr,
1332 bool force_live_memory = false);
1333
1334 bool HasLoadedSections();
1335
1337
1338 void ClearSectionLoadList();
1339
1340 void DumpSectionLoadList(Stream &s);
1341
1342 static Target *GetTargetFromContexts(const ExecutionContext *exe_ctx_ptr,
1343 const SymbolContext *sc_ptr);
1344
1345 // lldb::ExecutionContextScope pure virtual functions
1347
1349
1351
1353
1354 void CalculateExecutionContext(ExecutionContext &exe_ctx) override;
1355
1357
1358 llvm::Expected<lldb::TypeSystemSP>
1360 bool create_on_demand = true);
1361
1362 std::vector<lldb::TypeSystemSP>
1363 GetScratchTypeSystems(bool create_on_demand = true);
1364
1367
1368 // Creates a UserExpression for the given language, the rest of the
1369 // parameters have the same meaning as for the UserExpression constructor.
1370 // Returns a new-ed object which the caller owns.
1371
1373 GetUserExpressionForLanguage(llvm::StringRef expr, llvm::StringRef prefix,
1374 SourceLanguage language,
1375 Expression::ResultType desired_type,
1376 const EvaluateExpressionOptions &options,
1377 ValueObject *ctx_obj, Status &error);
1378
1379 // Creates a FunctionCaller for the given language, the rest of the
1380 // parameters have the same meaning as for the FunctionCaller constructor.
1381 // Since a FunctionCaller can't be
1382 // IR Interpreted, it makes no sense to call this with an
1383 // ExecutionContextScope that lacks
1384 // a Process.
1385 // Returns a new-ed object which the caller owns.
1386
1388 const CompilerType &return_type,
1389 const Address &function_address,
1390 const ValueList &arg_value_list,
1391 const char *name, Status &error);
1392
1393 /// Creates and installs a UtilityFunction for the given language.
1394 llvm::Expected<std::unique_ptr<UtilityFunction>>
1395 CreateUtilityFunction(std::string expression, std::string name,
1396 lldb::LanguageType language, ExecutionContext &exe_ctx);
1397
1398 // Install any files through the platform that need be to installed prior to
1399 // launching or attaching.
1400 Status Install(ProcessLaunchInfo *launch_info);
1401
1402 bool ResolveFileAddress(lldb::addr_t load_addr, Address &so_addr);
1403
1404 bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr,
1405 uint32_t stop_id = SectionLoadHistory::eStopIDNow,
1406 bool allow_section_end = false);
1407
1408 bool SetSectionLoadAddress(const lldb::SectionSP &section,
1409 lldb::addr_t load_addr,
1410 bool warn_multiple = false);
1411
1412 size_t UnloadModuleSections(const lldb::ModuleSP &module_sp);
1413
1414 size_t UnloadModuleSections(const ModuleList &module_list);
1415
1416 bool SetSectionUnloaded(const lldb::SectionSP &section_sp);
1417
1418 bool SetSectionUnloaded(const lldb::SectionSP &section_sp,
1419 lldb::addr_t load_addr);
1420
1422
1424 lldb_private::TypeSummaryImpl &summary_provider);
1426
1427 /// Set the \a Trace object containing processor trace information of this
1428 /// target.
1429 ///
1430 /// \param[in] trace_sp
1431 /// The trace object.
1432 void SetTrace(const lldb::TraceSP &trace_sp);
1433
1434 /// Get the \a Trace object containing processor trace information of this
1435 /// target.
1436 ///
1437 /// \return
1438 /// The trace object. It might be undefined.
1440
1441 /// Create a \a Trace object for the current target using the using the
1442 /// default supported tracing technology for this process.
1443 ///
1444 /// \return
1445 /// The new \a Trace or an \a llvm::Error if a \a Trace already exists or
1446 /// the trace couldn't be created.
1447 llvm::Expected<lldb::TraceSP> CreateTrace();
1448
1449 /// If a \a Trace object is present, this returns it, otherwise a new Trace is
1450 /// created with \a Trace::CreateTrace.
1451 llvm::Expected<lldb::TraceSP> GetTraceOrCreate();
1452
1453 // Since expressions results can persist beyond the lifetime of a process,
1454 // and the const expression results are available after a process is gone, we
1455 // provide a way for expressions to be evaluated from the Target itself. If
1456 // an expression is going to be run, then it should have a frame filled in in
1457 // the execution context.
1459 llvm::StringRef expression, ExecutionContextScope *exe_scope,
1460 lldb::ValueObjectSP &result_valobj_sp,
1462 std::string *fixed_expression = nullptr, ValueObject *ctx_obj = nullptr);
1463
1465
1467
1468 /// This method will return the address of the starting function for
1469 /// this binary, e.g. main() or its equivalent. This can be used as
1470 /// an address of a function that is not called once a binary has
1471 /// started running - e.g. as a return address for inferior function
1472 /// calls that are unambiguous completion of the function call, not
1473 /// called during the course of the inferior function code running.
1474 ///
1475 /// If no entry point can be found, an invalid address is returned.
1476 ///
1477 /// \param [out] err
1478 /// This object will be set to failure if no entry address could
1479 /// be found, and may contain a helpful error message.
1480 //
1481 /// \return
1482 /// Returns the entry address for this program, or an error
1483 /// if none can be found.
1484 llvm::Expected<lldb_private::Address> GetEntryPointAddress();
1485
1486 CompilerType GetRegisterType(const std::string &name,
1487 const lldb_private::RegisterFlags &flags,
1488 uint32_t byte_size);
1489
1490 /// Sends a breakpoint notification event.
1492 lldb::BreakpointEventType event_kind);
1493 /// Sends a breakpoint notification event.
1495 const lldb::EventDataSP &breakpoint_data_sp);
1496
1497 llvm::Expected<lldb::DisassemblerSP>
1498 ReadInstructions(const Address &start_addr, uint32_t count,
1499 const char *flavor_string = nullptr);
1500
1501 // Target Stop Hooks
1502 class StopHook : public UserID {
1503 public:
1504 StopHook(const StopHook &rhs);
1505 virtual ~StopHook() = default;
1506
1507 enum class StopHookKind : uint32_t {
1511 };
1518
1520
1521 // Set the specifier. The stop hook will own the specifier, and is
1522 // responsible for deleting it when we're done.
1523 void SetSpecifier(SymbolContextSpecifier *specifier);
1524
1526
1527 bool ExecutionContextPasses(const ExecutionContext &exe_ctx);
1528
1529 // Called on stop, this gets passed the ExecutionContext for each "stop
1530 // with a reason" thread. It should add to the stream whatever text it
1531 // wants to show the user, and return False to indicate it wants the target
1532 // not to stop.
1534 lldb::StreamSP output) = 0;
1535
1536 // Set the Thread Specifier. The stop hook will own the thread specifier,
1537 // and is responsible for deleting it when we're done.
1538 void SetThreadSpecifier(ThreadSpec *specifier);
1539
1541
1542 bool IsActive() { return m_active; }
1543
1544 void SetIsActive(bool is_active) { m_active = is_active; }
1545
1546 void SetAutoContinue(bool auto_continue) {
1547 m_auto_continue = auto_continue;
1548 }
1549
1550 bool GetAutoContinue() const { return m_auto_continue; }
1551
1552 void SetRunAtInitialStop(bool at_initial_stop) {
1553 m_at_initial_stop = at_initial_stop;
1554 }
1555
1557
1558 void SetSuppressOutput(bool suppress_output) {
1559 m_suppress_output = suppress_output;
1560 }
1561
1562 bool GetSuppressOutput() const { return m_suppress_output; }
1563
1564 void GetDescription(Stream &s, lldb::DescriptionLevel level) const;
1566 lldb::DescriptionLevel level) const = 0;
1567
1568 protected:
1571 std::unique_ptr<ThreadSpec> m_thread_spec_up;
1572 bool m_active = true;
1573 bool m_auto_continue = false;
1575 bool m_suppress_output = false;
1576
1577 StopHook(lldb::TargetSP target_sp, lldb::user_id_t uid);
1578 };
1579
1581 public:
1582 ~StopHookCommandLine() override = default;
1583
1585 void SetActionFromString(const std::string &strings);
1586 void SetActionFromStrings(const std::vector<std::string> &strings);
1587
1589 lldb::StreamSP output_sp) override;
1591 lldb::DescriptionLevel level) const override;
1592
1593 private:
1595 // Use CreateStopHook to make a new empty stop hook. Use SetActionFromString
1596 // to fill it with commands, and SetSpecifier to set the specifier shared
1597 // pointer (can be null, that will match anything.)
1599 : StopHook(target_sp, uid) {}
1600 friend class Target;
1601 };
1602
1604 public:
1605 ~StopHookScripted() override = default;
1607 lldb::StreamSP output) override;
1608
1609 Status SetScriptCallback(std::string class_name,
1610 StructuredData::ObjectSP extra_args_sp);
1611
1613 lldb::DescriptionLevel level) const override;
1614
1615 private:
1616 std::string m_class_name;
1617 /// This holds the dictionary of keys & values that can be used to
1618 /// parametrize any given callback's behavior.
1621
1622 /// Use CreateStopHook to make a new empty stop hook. Use SetScriptCallback
1623 /// to set the script to execute, and SetSpecifier to set the specifier
1624 /// shared pointer (can be null, that will match anything.)
1626 : StopHook(target_sp, uid) {}
1627 friend class Target;
1628 };
1629
1630 class StopHookCoded : public StopHook {
1631 public:
1632 ~StopHookCoded() override = default;
1633
1635 lldb::StreamSP output);
1636
1637 void SetCallback(llvm::StringRef name, HandleStopCallback *callback) {
1638 m_name = name;
1639 m_callback = callback;
1640 }
1641
1643 lldb::StreamSP output) override {
1644 return m_callback(exc_ctx, output);
1645 }
1646
1648 lldb::DescriptionLevel level) const override {
1649 s.Indent();
1650 s.Printf("%s (built-in)\n", m_name.c_str());
1651 }
1652
1653 private:
1654 std::string m_name;
1656
1657 /// Use CreateStopHook to make a new empty stop hook. Use SetCallback to set
1658 /// the callback to execute, and SetSpecifier to set the specifier shared
1659 /// pointer (can be null, that will match anything.)
1661 : StopHook(target_sp, uid) {}
1662 friend class Target;
1663 };
1664
1666
1667 typedef std::shared_ptr<StopHook> StopHookSP;
1668
1669 /// Add an empty stop hook to the Target's stop hook list, and returns a
1670 /// shared pointer to the new hook.
1671 StopHookSP CreateStopHook(StopHook::StopHookKind kind, bool internal = false);
1672
1673 /// If you tried to create a stop hook, and that failed, call this to
1674 /// remove the stop hook, as it will also reset the stop hook counter.
1676
1677 // Runs the stop hooks that have been registered for this target.
1678 // Returns true if the stop hooks cause the target to resume.
1679 // Pass at_initial_stop if this is the stop where lldb gains
1680 // control over the process for the first time.
1681 bool RunStopHooks(bool at_initial_stop = false);
1682
1683 bool SetSuppresStopHooks(bool suppress) {
1684 bool old_value = m_suppress_stop_hooks;
1685 m_suppress_stop_hooks = suppress;
1686 return old_value;
1687 }
1688
1690
1692
1693 void RemoveAllStopHooks();
1694
1695 StopHookSP GetStopHookByID(lldb::user_id_t uid);
1696
1697 bool SetStopHookActiveStateByID(lldb::user_id_t uid, bool active_state);
1698
1699 void SetAllStopHooksActiveState(bool active_state);
1700
1701 const std::vector<StopHookSP> GetStopHooks(bool internal = false) const;
1702
1704
1705 void SetPlatform(const lldb::PlatformSP &platform_sp) {
1706 m_platform_sp = platform_sp;
1707 }
1708
1710
1711 // Methods.
1713 GetSearchFilterForModule(const FileSpec *containingModule);
1714
1716 GetSearchFilterForModuleList(const FileSpecList *containingModuleList);
1717
1719 GetSearchFilterForModuleAndCUList(const FileSpecList *containingModules,
1720 const FileSpecList *containingSourceFiles);
1721
1723 const char *repl_options, bool can_create);
1724
1725 void SetREPL(lldb::LanguageType language, lldb::REPLSP repl_sp);
1726
1730
1732
1733 /// Get the list of paths that LLDB will consider automatically loading
1734 /// scripting resources from. Currently whether to load scripts
1735 /// unconditionally is controlled via the
1736 /// `target.load-script-from-symbol-file` setting.
1738
1739 /// Add a signal for the target. This will get copied over to the process
1740 /// if the signal exists on that target. Only the values with Yes and No are
1741 /// set, Calculate values will be ignored.
1742protected:
1751 using DummySignalElement = llvm::StringMapEntry<DummySignalValues>;
1752 static bool UpdateSignalFromDummy(lldb::UnixSignalsSP signals_sp,
1753 const DummySignalElement &element);
1754 static bool ResetSignalFromDummy(lldb::UnixSignalsSP signals_sp,
1755 const DummySignalElement &element);
1756
1757public:
1758 /// Add a signal to the Target's list of stored signals/actions. These
1759 /// values will get copied into any processes launched from
1760 /// this target.
1761 void AddDummySignal(llvm::StringRef name, LazyBool pass, LazyBool print,
1762 LazyBool stop);
1763 /// Updates the signals in signals_sp using the stored dummy signals.
1764 /// If warning_stream_sp is not null, if any stored signals are not found in
1765 /// the current process, a warning will be emitted here.
1767 lldb::StreamSP warning_stream_sp);
1768 /// Clear the dummy signals in signal_names from the target, or all signals
1769 /// if signal_names is empty. Also remove the behaviors they set from the
1770 /// process's signals if it exists.
1771 void ClearDummySignals(Args &signal_names);
1772 /// Print all the signals set in this target.
1773 void PrintDummySignals(Stream &strm, Args &signals);
1774
1775protected:
1776 /// Implementing of ModuleList::Notifier.
1777
1778 void NotifyModuleAdded(const ModuleList &module_list,
1779 const lldb::ModuleSP &module_sp) override;
1780
1781 void NotifyModuleRemoved(const ModuleList &module_list,
1782 const lldb::ModuleSP &module_sp) override;
1783
1784 void NotifyModuleUpdated(const ModuleList &module_list,
1785 const lldb::ModuleSP &old_module_sp,
1786 const lldb::ModuleSP &new_module_sp) override;
1787
1788 void NotifyWillClearList(const ModuleList &module_list) override;
1789
1790 void NotifyModulesRemoved(lldb_private::ModuleList &module_list) override;
1791
1792 class Arch {
1793 public:
1794 explicit Arch(const ArchSpec &spec);
1795 const Arch &operator=(const ArchSpec &spec);
1796
1797 const ArchSpec &GetSpec() const { return m_spec; }
1798 Architecture *GetPlugin() const { return m_plugin_up.get(); }
1799
1800 private:
1802 std::unique_ptr<Architecture> m_plugin_up;
1803 };
1804
1805 // Member variables.
1807 lldb::PlatformSP m_platform_sp; ///< The platform for this target.
1808 std::recursive_mutex m_mutex; ///< An API mutex that is used by the lldb::SB*
1809 /// classes make the SB interface thread safe
1810 /// When the private state thread calls SB API's - usually because it is
1811 /// running OS plugin or Python ThreadPlan code - it should not block on the
1812 /// API mutex that is held by the code that kicked off the sequence of events
1813 /// that led us to run the code. We hand out this mutex instead when we
1814 /// detect that code is running on the private state thread.
1815 std::recursive_mutex m_private_mutex;
1817 std::string m_label;
1818 ModuleList m_images; ///< The list of images for this process (shared
1819 /// libraries and anything dynamically loaded).
1825 std::map<ConstString, std::unique_ptr<BreakpointName>>;
1827
1831 // We want to tightly control the process destruction process so we can
1832 // correctly tear down everything that we need to, so the only class that
1833 // knows about the process lifespan is this target class.
1838
1839 /// Map of scripted frame provider descriptors for this target.
1840 /// Keys are the provider descriptor IDs, values are the descriptors.
1841 /// Insertion order is preserved so that equal-priority providers chain
1842 /// in registration order.
1843 llvm::MapVector<uint32_t, ScriptedFrameProviderDescriptor>
1845 mutable std::recursive_mutex m_frame_provider_descriptors_mutex;
1847
1848 typedef std::map<lldb::LanguageType, lldb::REPLSP> REPLMap;
1850
1852
1853 typedef std::map<lldb::user_id_t, StopHookSP> StopHookCollection;
1856 std::vector<StopHookSP> m_internal_stop_hooks;
1857 uint32_t m_latest_stop_hook_id; /// This records the last natural stop at
1858 /// which we ran a stop-hook.
1860 bool m_suppress_stop_hooks; /// Used to not run stop hooks for expressions
1864 LLDB_INVALID_GLOBALLY_UNIQUE_TARGET_ID; ///< The globally unique ID
1865 /// assigned to this target
1866 std::string m_target_session_name; ///< The target session name for this
1867 /// target, used to name debugging
1868 /// sessions in DAP.
1869 /// An optional \a lldb_private::Trace object containing processor trace
1870 /// information of this target.
1872 /// Stores the frame recognizers of this target.
1874 /// These are used to set the signal state when you don't have a process and
1875 /// more usefully in the Dummy target where you can't know exactly what
1876 /// signals you will have.
1877 llvm::StringMap<DummySignalValues> m_dummy_signals;
1878
1880
1881 static void ImageSearchPathsChanged(const PathMappingList &path_list,
1882 void *baton);
1883
1884 // Utilities for `statistics` command.
1885private:
1886 // Target metrics storage.
1888
1889public:
1890 /// Get metrics associated with this target in JSON format.
1891 ///
1892 /// Target metrics help measure timings and information that is contained in
1893 /// a target. These are designed to help measure performance of a debug
1894 /// session as well as represent the current state of the target, like
1895 /// information on the currently modules, currently set breakpoints and more.
1896 ///
1897 /// \return
1898 /// Returns a JSON value that contains all target metrics.
1899 llvm::json::Value
1901
1902 void ResetStatistics();
1903
1905
1906protected:
1907 /// Construct with optional file and arch.
1908 ///
1909 /// This member is private. Clients must use
1910 /// TargetList::CreateTarget(const FileSpec*, const ArchSpec*)
1911 /// so all targets can be tracked from the central target list.
1912 ///
1913 /// \see TargetList::CreateTarget(const FileSpec*, const ArchSpec*)
1914 Target(Debugger &debugger, const ArchSpec &target_arch,
1915 const lldb::PlatformSP &platform_sp, bool is_dummy_target);
1916
1917 // Helper function.
1918 bool ProcessIsValid();
1919
1920 // Copy breakpoints, stop hooks and so forth from the dummy target:
1921 void PrimeFromDummyTarget(Target &target);
1922
1923 void AddBreakpoint(lldb::BreakpointSP breakpoint_sp, bool internal);
1924
1926
1927 /// Return a recommended size for memory reads at \a addr, optimizing for
1928 /// cache usage.
1930
1931 Target(const Target &) = delete;
1932 const Target &operator=(const Target &) = delete;
1933
1935 return m_section_load_history.GetCurrentSectionLoadList();
1936 }
1937};
1938
1939} // namespace lldb_private
1940
1941#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:362
void SetOneThreadTimeout(const Timeout< std::micro > &timeout)
Definition Target.h:421
void SetUnwindOnError(bool unwind=false)
Definition Target.h:394
SourceLanguage GetLanguage() const
Definition Target.h:356
const char * GetPoundLineFilePath() const
Definition Target.h:484
lldb::DynamicValueType m_use_dynamic
Definition Target.h:552
void SetExecutionPolicy(ExecutionPolicy policy=eExecutionPolicyAlways)
Definition Target.h:352
Timeout< std::micro > m_one_thread_timeout
Definition Target.h:554
bool InvokeCancelCallback(lldb::ExpressionEvaluationPhase phase) const
Definition Target.h:466
lldb::DynamicValueType GetUseDynamic() const
Definition Target.h:406
void SetKeepInMemory(bool keep=true)
Definition Target.h:404
void SetCoerceToId(bool coerce=true)
Definition Target.h:390
void SetLanguage(lldb::LanguageType language_type)
Definition Target.h:358
ExecutionPolicy GetExecutionPolicy() const
Definition Target.h:350
Timeout< std::micro > m_timeout
Definition Target.h:553
void SetCppIgnoreContextQualifiers(bool value)
Definition Target.cpp:5530
const StructuredData::Dictionary & GetLanguageOptions() const
Definition Target.cpp:5508
llvm::Expected< bool > GetBooleanLanguageOption(llvm::StringRef option_name) const
Get the language-plugin specific boolean option called option_name.
Definition Target.cpp:5492
void SetPrefix(const char *prefix)
Definition Target.h:383
void SetTryAllThreads(bool try_others=true)
Definition Target.h:427
static constexpr std::chrono::milliseconds default_timeout
Definition Target.h:342
void SetPoundLine(const char *path, uint32_t line) const
Definition Target.h:474
void SetRetriesWithFixIts(uint64_t number_of_retries)
Definition Target.h:500
SymbolContextList m_preferred_lookup_contexts
During expression evaluation, any SymbolContext in this list will be used for symbol/function lookup ...
Definition Target.h:570
void SetTimeout(const Timeout< std::micro > &timeout)
Definition Target.h:415
static constexpr ExecutionPolicy default_execution_policy
Definition Target.h:347
void SetStopOthers(bool stop_others=true)
Definition Target.h:431
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:550
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:5475
StructuredData::DictionarySP m_language_options_sp
Dictionary mapping names of language-plugin specific options to values.
Definition Target.h:565
void SetCancelCallback(lldb::ExpressionCancelCallback callback, void *baton)
Definition Target.h:461
const Timeout< std::micro > & GetTimeout() const
Definition Target.h:413
const SymbolContextList & GetPreferredSymbolContexts() const
Definition Target.h:366
void SetIgnoreBreakpoints(bool ignore=false)
Definition Target.h:398
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:373
void SetUseDynamic(lldb::DynamicValueType dynamic=lldb::eDynamicCanRunTarget)
Definition Target.h:409
lldb::ExpressionCancelCallback m_cancel_callback
Definition Target.h:555
const Timeout< std::micro > & GetOneThreadTimeout() const
Definition Target.h:417
"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:155
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Definition Stream.cpp:132
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:284
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:5007
FileSpecList GetDebugFileSearchPaths()
Definition Target.cpp:4888
llvm::StringRef GetLaunchWorkingDirectory() const
Definition Target.cpp:4694
bool GetDisplayRecognizedArguments() const
Definition Target.cpp:5171
ImportStdModule GetImportStdModule() const
Definition Target.cpp:4904
void AppendExecutableSearchPaths(const FileSpec &)
Definition Target.cpp:4875
bool GetEnableSyntheticValue() const
Definition Target.cpp:4974
void SetStandardInputPath(const char *path)=delete
ProcessLaunchInfo m_launch_info
Definition Target.h:325
bool GetCheckValueObjectOwnership() const
Definition Target.cpp:5299
uint64_t GetExprAllocAlign() const
Definition Target.cpp:5086
MemoryModuleLoadLevel GetMemoryModuleLoadLevel() const
Definition Target.cpp:5143
llvm::StringRef GetArg0() const
Definition Target.cpp:4747
uint32_t GetMaximumMemReadSize() const
Definition Target.cpp:5013
void SetRunArguments(const Args &args)
Definition Target.cpp:4764
FileSpec GetStandardErrorPath() const
Definition Target.cpp:5039
void SetLoadScriptFromSymbolFile(LoadScriptFromSymFile load_style)
Set the target-wide target.load-script-from-symbol-file setting.
Definition Target.cpp:5123
bool GetEnableNotifyAboutFixIts() const
Definition Target.cpp:4930
bool SetPreferDynamicValue(lldb::DynamicValueType d)
Definition Target.cpp:4631
void SetDisplayRecognizedArguments(bool b)
Definition Target.cpp:5177
std::optional< bool > GetExperimentalPropertyValue(size_t prop_idx, ExecutionContext *exe_ctx=nullptr) const
Definition Target.cpp:4570
const ProcessLaunchInfo & GetProcessLaunchInfo() const
Definition Target.cpp:5182
Environment ComputeEnvironment() const
Definition Target.cpp:4770
void SetStandardOutputPath(const char *path)=delete
bool GetUserSpecifiedTrapHandlerNames(Args &args) const
Definition Target.cpp:5150
uint64_t GetExprErrorLimit() const
Definition Target.cpp:5068
bool GetEnableAutoImportClangModules() const
Definition Target.cpp:4898
bool GetDebugUtilityExpression() const
Definition Target.cpp:5288
DynamicClassInfoHelper GetDynamicClassInfoHelper() const
Definition Target.cpp:4911
FileSpec GetStandardOutputPath() const
Definition Target.cpp:5029
void SetDisplayRuntimeSupportValues(bool b)
Definition Target.cpp:5166
uint32_t GetMaximumNumberOfChildrenToDisplay() const
Definition Target.cpp:4992
void SetRequireHardwareBreakpoints(bool b)
Definition Target.cpp:5220
bool GetAutoInstallMainExecutable() const
Definition Target.cpp:5225
const char * GetDisassemblyFeatures() const
Definition Target.cpp:4726
void SetAutoLoadScriptsForModule(llvm::StringRef module_name, LoadScriptFromSymFile load_style)
Set the LoadScriptFromSymFile for a module called module_name (excluding file extension).
Definition Target.cpp:5325
RealpathPrefixes GetSourceRealpathPrefixes() const
Definition Target.cpp:4742
void SetCheckValueObjectOwnership(bool check)
Definition Target.cpp:5305
uint64_t GetNumberOfRetriesWithFixits() const
Definition Target.cpp:4924
uint64_t GetExprAllocSize() const
Definition Target.cpp:5080
std::optional< LoadScriptFromSymFile > GetAutoLoadScriptsForModule(llvm::StringRef module_name) const
Definition Target.cpp:5311
llvm::StringRef GetExpressionPrefixContents()
Definition Target.cpp:5054
PathMappingList & GetObjectPathMap() const
Definition Target.cpp:4861
const char * GetDisassemblyFlavor() const
Definition Target.cpp:4706
FileSpec GetStandardInputPath() const
Definition Target.cpp:5019
lldb::DynamicValueType GetPreferDynamicValue() const
Definition Target.cpp:4624
InlineStrategy GetInlineStrategy() const
Definition Target.cpp:4733
Environment GetTargetEnvironment() const
Definition Target.cpp:4830
bool GetDisplayRuntimeSupportValues() const
Definition Target.cpp:5160
void SetUserSpecifiedTrapHandlerNames(const Args &args)
Definition Target.cpp:5155
uint32_t GetMaxZeroPaddingInFloatFormat() const
Definition Target.cpp:4986
uint64_t GetExprAllocAddress() const
Definition Target.cpp:5074
LoadCWDlldbinitFile GetLoadCWDlldbinitFile() const
Definition Target.cpp:5129
Environment GetInheritedEnvironment() const
Definition Target.cpp:4802
void SetArg0(llvm::StringRef arg)
Definition Target.cpp:4753
bool GetInjectLocalVariables(ExecutionContext *exe_ctx) const
Definition Target.cpp:4581
void SetStandardErrorPath(const char *path)=delete
bool ShowHexVariableValuesWithLeadingZeroes() const
Definition Target.cpp:4980
SourceLanguage GetLanguage() const
Definition Target.cpp:5049
Environment GetEnvironment() const
Definition Target.cpp:4798
void SetProcessLaunchInfo(const ProcessLaunchInfo &launch_info)
Definition Target.cpp:5186
FileSpec GetSaveJITObjectsDir() const
Definition Target.cpp:4936
void SetEnvironment(Environment env)
Definition Target.cpp:4841
LoadScriptFromSymFile GetLoadScriptFromSymbolFile() const
Definition Target.cpp:5116
const char * GetDisassemblyCPU() const
Definition Target.cpp:4719
void SetStandardErrorPath(llvm::StringRef path)
Definition Target.cpp:5044
bool GetRunArguments(Args &args) const
Definition Target.cpp:4759
FileSpecList GetExecutableSearchPaths()
Definition Target.cpp:4883
ArchSpec GetDefaultArchitecture() const
Definition Target.cpp:4608
Disassembler::HexImmediateStyle GetHexImmediateStyle() const
Definition Target.cpp:5136
void SetUseDIL(ExecutionContext *exe_ctx, bool b)
Definition Target.cpp:4599
std::unique_ptr< TargetExperimentalProperties > m_experimental_properties_up
Definition Target.h:326
FileSpecList GetClangModuleSearchPaths()
Definition Target.cpp:4893
void SetStandardOutputPath(llvm::StringRef path)
Definition Target.cpp:5034
bool GetRequireHardwareBreakpoints() const
Definition Target.cpp:5214
PathMappingList & GetSourcePathMap() const
Definition Target.cpp:4853
bool GetAutoSourceMapRelative() const
Definition Target.cpp:4869
bool GetUseDIL(ExecutionContext *exe_ctx) const
Definition Target.cpp:4587
void SetDefaultArchitecture(const ArchSpec &arch)
Definition Target.cpp:4613
void SetStandardInputPath(llvm::StringRef path)
Definition Target.cpp:5024
TargetProperties(Target *target)
Definition Target.cpp:4494
bool GetDisplayExpressionsInCrashlogs() const
Definition Target.cpp:5110
bool GetEnableAutoApplyFixIts() const
Definition Target.cpp:4918
void SetDebugUtilityExpression(bool debug)
Definition Target.cpp:5294
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:4999
A class that represents statistics for a since lldb_private::Target.
Definition Statistics.h:312
std::unique_ptr< Architecture > m_plugin_up
Definition Target.h:1802
const ArchSpec & GetSpec() const
Definition Target.h:1797
const Arch & operator=(const ArchSpec &spec)
Definition Target.cpp:165
Arch(const ArchSpec &spec)
Definition Target.cpp:161
Architecture * GetPlugin() const
Definition Target.h:1798
void GetSubclassDescription(Stream &s, lldb::DescriptionLevel level) const override
Definition Target.h:1647
HandleStopCallback * m_callback
Definition Target.h:1655
StopHookResult HandleStop(ExecutionContext &exc_ctx, lldb::StreamSP output) override
Definition Target.h:1642
StopHookCoded(lldb::TargetSP target_sp, lldb::user_id_t uid)
Use CreateStopHook to make a new empty stop hook.
Definition Target.h:1660
void SetCallback(llvm::StringRef name, HandleStopCallback *callback)
Definition Target.h:1637
StopHookResult(ExecutionContext &exc_ctx, lldb::StreamSP output) HandleStopCallback
Definition Target.h:1634
void SetActionFromString(const std::string &strings)
Definition Target.cpp:4109
StopHookCommandLine(lldb::TargetSP target_sp, lldb::user_id_t uid)
Definition Target.h:1598
void SetActionFromStrings(const std::vector< std::string > &strings)
Definition Target.cpp:4113
StopHookResult HandleStop(ExecutionContext &exc_ctx, lldb::StreamSP output_sp) override
Definition Target.cpp:4120
void GetSubclassDescription(Stream &s, lldb::DescriptionLevel level) const override
Definition Target.cpp:4091
Status SetScriptCallback(std::string class_name, StructuredData::ObjectSP extra_args_sp)
Definition Target.cpp:4154
StopHookResult HandleStop(ExecutionContext &exc_ctx, lldb::StreamSP output) override
Definition Target.cpp:4194
StopHookScripted(lldb::TargetSP target_sp, lldb::user_id_t uid)
Use CreateStopHook to make a new empty stop hook.
Definition Target.h:1625
void GetSubclassDescription(Stream &s, lldb::DescriptionLevel level) const override
Definition Target.cpp:4213
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:1619
lldb::ScriptedStopHookInterfaceSP m_interface_sp
Definition Target.h:1620
bool GetRunAtInitialStop() const
Definition Target.h:1556
SymbolContextSpecifier * GetSpecifier()
Definition Target.h:1525
void SetSpecifier(SymbolContextSpecifier *specifier)
Definition Target.cpp:4029
virtual StopHookResult HandleStop(ExecutionContext &exe_ctx, lldb::StreamSP output)=0
std::unique_ptr< ThreadSpec > m_thread_spec_up
Definition Target.h:1571
void SetIsActive(bool is_active)
Definition Target.h:1544
void SetSuppressOutput(bool suppress_output)
Definition Target.h:1558
void SetThreadSpecifier(ThreadSpec *specifier)
Definition Target.cpp:4033
ThreadSpec * GetThreadSpecifier()
Definition Target.h:1540
StopHook(const StopHook &rhs)
Definition Target.cpp:4021
bool ExecutionContextPasses(const ExecutionContext &exe_ctx)
Definition Target.cpp:4037
lldb::TargetSP & GetTarget()
Definition Target.h:1519
void SetRunAtInitialStop(bool at_initial_stop)
Definition Target.h:1552
lldb::SymbolContextSpecifierSP m_specifier_sp
Definition Target.h:1570
virtual void GetSubclassDescription(Stream &s, lldb::DescriptionLevel level) const =0
void GetDescription(Stream &s, lldb::DescriptionLevel level) const
Definition Target.cpp:4053
void SetAutoContinue(bool auto_continue)
Definition Target.h:1546
const ModuleList & GetModuleList() const
Definition Target.h:644
void Dump(Stream *s) const override
Definition Target.cpp:5357
static llvm::StringRef GetFlavorString()
Definition Target.cpp:5353
static lldb::TargetSP GetCreatedTargetFromEvent(const Event *event_ptr)
Definition Target.cpp:5386
static ModuleList GetModuleListFromEvent(const Event *event_ptr)
Definition Target.cpp:5395
static const TargetEventData * GetEventDataFromEvent(const Event *event_ptr)
Definition Target.cpp:5367
llvm::StringRef GetFlavor() const override
Definition Target.h:622
const lldb::TargetSP & GetTarget() const
Definition Target.h:638
TargetEventData(const lldb::TargetSP &target_sp)
Definition Target.cpp:5339
TargetEventData(const TargetEventData &)=delete
const lldb::TargetSP & GetCreatedTarget() const
Definition Target.h:640
const TargetEventData & operator=(const TargetEventData &)=delete
static lldb::TargetSP GetTargetFromEvent(const Event *event_ptr)
Definition Target.cpp:5377
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:1841
lldb::ThreadSP CalculateThread() override
Definition Target.cpp:2579
llvm::Expected< uint32_t > AddScriptedFrameProviderDescriptor(const ScriptedFrameProviderDescriptor &descriptor)
Add or update a scripted frame provider descriptor for this target.
Definition Target.cpp:3719
StopHookCollection m_stop_hooks
Definition Target.h:1854
Module * GetExecutableModulePointer()
Definition Target.cpp:1541
void Dump(Stream *s, lldb::DescriptionLevel description_level)
Dump a description of this object to a Stream.
Definition Target.cpp:245
void DisableAllBreakpoints(bool internal_also=false)
Definition Target.cpp:1073
lldb::WatchpointSP CreateWatchpoint(lldb::addr_t addr, size_t size, const CompilerType *type, uint32_t kind, Status &error)
Definition Target.cpp:955
void ApplyNameToBreakpoints(BreakpointName &bp_name)
Definition Target.cpp:908
lldb::TraceSP GetTrace()
Get the Trace object containing processor trace information of this target.
Definition Target.cpp:3594
PathMappingList & GetImageSearchPathList()
Definition Target.cpp:2588
void FinalizeFileActions(ProcessLaunchInfo &info)
Definition Target.cpp:3801
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:2987
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:2995
ModuleList & GetImages()
Definition Target.h:1168
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:762
static Target * GetTargetFromContexts(const ExecutionContext *exe_ctx_ptr, const SymbolContext *sc_ptr)
Definition Target.cpp:2822
lldb::addr_t GetBreakableLoadAddress(lldb::addr_t addr)
Definition Target.cpp:3002
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:3961
bool SetSuppresStopHooks(bool suppress)
Definition Target.h:1683
static void ImageSearchPathsChanged(const PathMappingList &path_list, void *baton)
Definition Target.cpp:2592
llvm::Expected< lldb_private::Address > GetEntryPointAddress()
This method will return the address of the starting function for this binary, e.g.
Definition Target.cpp:2953
bool IgnoreWatchpointByID(lldb::watch_id_t watch_id, uint32_t ignore_count)
Definition Target.cpp:1509
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:728
lldb::BreakpointSP GetBreakpointByID(lldb::break_id_t break_id)
Definition Target.cpp:423
std::shared_ptr< StopHook > StopHookSP
Definition Target.h:1667
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:598
void SymbolsDidLoad(ModuleList &module_list)
Definition Target.cpp:1868
bool ClearAllWatchpointHistoricValues()
Definition Target.cpp:1423
const std::vector< StopHookSP > GetStopHooks(bool internal=false) const
Definition Target.cpp:3115
void SetTrace(const lldb::TraceSP &trace_sp)
Set the Trace object containing processor trace information of this target.
Definition Target.cpp:3592
BreakpointList & GetBreakpointList(bool internal=false)
Definition Target.cpp:409
uint32_t m_next_frame_provider_id
Definition Target.h:1846
CompilerType GetRegisterType(const std::string &name, const lldb_private::RegisterFlags &flags, uint32_t byte_size)
Definition Target.cpp:2628
BreakpointNameList m_breakpoint_names
Definition Target.h:1826
lldb_private::SummaryStatisticsCache & GetSummaryStatisticsCache()
Definition Target.cpp:3409
const llvm::MapVector< uint32_t, ScriptedFrameProviderDescriptor > & GetScriptedFrameProviderDescriptors() const
Get all scripted frame provider descriptors for this target.
Definition Target.cpp:3780
lldb::addr_t GetSectionLoadAddress(const lldb::SectionSP &section_sp)
Definition Target.cpp:5420
llvm::StringRef GetABIName() const
Returns the name of the target's ABI plugin.
Definition Target.cpp:398
SourceManager & GetSourceManager()
Definition Target.cpp:3039
lldb::SearchFilterSP GetSearchFilterForModuleList(const FileSpecList *containingModuleList)
Definition Target.cpp:691
StopHookSP GetStopHookByID(lldb::user_id_t uid)
Definition Target.cpp:3081
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:1877
lldb::ProcessSP m_process_sp
Definition Target.h:1834
Debugger & GetDebugger() const
Definition Target.h:1249
lldb::SearchFilterSP m_search_filter_sp
Definition Target.h:1835
PersistentExpressionState * GetPersistentExpressionStateForLanguage(lldb::LanguageType language)
Definition Target.cpp:2672
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:3949
bool m_is_dummy_target
Used to not run stop hooks for expressions.
Definition Target.h:1861
static bool UpdateSignalFromDummy(lldb::UnixSignalsSP signals_sp, const DummySignalElement &element)
Definition Target.cpp:3907
PathMappingList m_image_search_paths
Definition Target.h:1836
bool ModuleIsExcludedForUnconstrainedSearches(const FileSpec &module_spec)
Return whether this FileSpec corresponds to a module that should be considered for general searches.
Definition Target.cpp:1924
lldb::StackFrameSP CalculateStackFrame() override
Definition Target.cpp:2581
SectionLoadList & GetSectionLoadList()
Definition Target.h:1934
lldb::addr_t GetPersistentSymbol(ConstString name)
Definition Target.cpp:2933
void PrimeFromDummyTarget(Target &target)
Definition Target.cpp:221
bool RemoveScriptedFrameProviderDescriptor(uint32_t id)
Remove a scripted frame provider descriptor by id.
Definition Target.cpp:3755
lldb::RegisterTypeBuilderSP m_register_type_builder_sp
Definition Target.h:1879
static void SettingsTerminate()
Definition Target.cpp:2784
bool EnableWatchpointByID(lldb::watch_id_t watch_id)
Definition Target.cpp:1474
bool ResolveFileAddress(lldb::addr_t load_addr, Address &so_addr)
Definition Target.cpp:3325
bool ClearAllWatchpointHitCounts()
Definition Target.cpp:1409
size_t ReadMemoryFromFileCache(const Address &addr, void *dst, size_t dst_len, Status &error)
Definition Target.cpp:1956
void ClearAllLoadedSections()
Definition Target.cpp:3401
std::vector< lldb::TypeSystemSP > GetScratchTypeSystems(bool create_on_demand=true)
Definition Target.cpp:2638
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:2255
void AddNameToBreakpoint(BreakpointID &id, llvm::StringRef name, Status &error)
Definition Target.cpp:830
void DumpSectionLoadList(Stream &s)
Definition Target.cpp:5426
void DeleteCurrentProcess()
Definition Target.cpp:280
BreakpointList m_internal_breakpoint_list
Definition Target.h:1823
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:2286
void DisableAllowedBreakpoints()
Definition Target.cpp:1083
bool LoadScriptingResources(std::list< Status > &errors, bool continue_on_error=true)
Definition Target.h:1143
bool SetSectionUnloaded(const lldb::SectionSP &section_sp)
Definition Target.cpp:3379
lldb::TargetSP CalculateTarget() override
Definition Target.cpp:2575
const lldb::ProcessSP & GetProcessSP() const
Definition Target.cpp:314
void ClearModules(bool delete_locations)
Definition Target.cpp:1545
bool RemoveBreakpointByID(lldb::break_id_t break_id)
Definition Target.cpp:1107
llvm::MapVector< uint32_t, ScriptedFrameProviderDescriptor > m_frame_provider_descriptors
Map of scripted frame provider descriptors for this target.
Definition Target.h:1844
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:2338
static bool ResetSignalFromDummy(lldb::UnixSignalsSP signals_sp, const DummySignalElement &element)
Definition Target.cpp:3934
Architecture * GetArchitecturePlugin() const
Definition Target.h:1247
llvm::json::Value ReportStatistics(const lldb_private::StatisticsOptions &options)
Get metrics associated with this target in JSON format.
Definition Target.cpp:5412
friend class TargetList
Definition Target.h:580
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:2725
TargetStats & GetStatistics()
Definition Target.h:1904
void EnableAllBreakpoints(bool internal_also=false)
Definition Target.cpp:1090
Status Launch(ProcessLaunchInfo &launch_info, Stream *stream)
Definition Target.cpp:3424
bool DisableBreakpointByID(lldb::break_id_t break_id)
Definition Target.cpp:1127
lldb::BreakpointSP CreateBreakpointAtUserEntry(Status &error)
Definition Target.cpp:435
BreakpointName * FindBreakpointName(ConstString name, bool can_create, Status &error)
Definition Target.cpp:862
std::map< lldb::user_id_t, StopHookSP > StopHookCollection
Definition Target.h:1853
llvm::Expected< lldb::TraceSP > CreateTrace()
Create a Trace object for the current target using the using the default supported tracing technology...
Definition Target.cpp:3596
lldb::TraceSP m_trace_sp
An optional lldb_private::Trace object containing processor trace information of this target.
Definition Target.h:1871
lldb::user_id_t GetGloballyUniqueID() const
Get the globally unique ID for this target.
Definition Target.h:680
bool RemoveAllWatchpoints(bool end_to_end=true)
Definition Target.cpp:1327
bool ReadPointerFromMemory(const Address &addr, Status &error, Address &pointer_addr, bool force_live_memory=false)
Definition Target.cpp:2308
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:3067
WatchpointList m_watchpoint_list
Definition Target.h:1829
BreakpointList m_breakpoint_list
Definition Target.h:1822
lldb::SourceManagerUP m_source_manager_up
Definition Target.h:1851
bool RemoveWatchpointByID(lldb::watch_id_t watch_id)
Definition Target.cpp:1493
bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr, uint32_t stop_id=SectionLoadHistory::eStopIDNow, bool allow_section_end=false)
Definition Target.cpp:3319
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:2206
void DeleteBreakpointName(ConstString name)
Definition Target.cpp:884
void NotifyWillClearList(const ModuleList &module_list) override
Definition Target.cpp:1803
bool SetArchitecture(const ArchSpec &arch_spec, bool set_platform=false, bool merge=true)
Set the architecture for this target.
Definition Target.cpp:1687
void NotifyModuleAdded(const ModuleList &module_list, const lldb::ModuleSP &module_sp) override
Implementing of ModuleList::Notifier.
Definition Target.cpp:1805
llvm::Expected< lldb::TypeSystemSP > GetScratchTypeSystemForLanguage(lldb::LanguageType language, bool create_on_demand=true)
Definition Target.cpp:2601
void ConfigureBreakpointName(BreakpointName &bp_name, const BreakpointOptions &options, const BreakpointName::Permissions &permissions)
Definition Target.cpp:900
lldb_private::SummaryStatisticsSP GetSummaryStatisticsSPForProviderName(lldb_private::TypeSummaryImpl &summary_provider)
Definition Target.cpp:3403
lldb::SearchFilterSP GetSearchFilterForModuleAndCUList(const FileSpecList *containingModules, const FileSpecList *containingSourceFiles)
Definition Target.cpp:708
lldb::ModuleSP GetExecutableModule()
Gets the module for the main executable.
Definition Target.cpp:1525
bool SetStopHookActiveStateByID(lldb::user_id_t uid, bool active_state)
Definition Target.cpp:3091
const lldb::ProcessSP & CreateProcess(lldb::ListenerSP listener_sp, llvm::StringRef plugin_name, const FileSpec *crash_file, bool can_connect)
Definition Target.cpp:302
void SetAllStopHooksActiveState(bool active_state)
Definition Target.cpp:3102
std::vector< StopHookSP > m_internal_stop_hooks
Definition Target.h:1856
lldb::ExpressionVariableSP GetPersistentVariable(ConstString name)
Definition Target.cpp:2914
void NotifyModulesRemoved(lldb_private::ModuleList &module_list) override
Definition Target.cpp:1837
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:3045
size_t ReadCStringFromMemory(const Address &addr, std::string &out_str, Status &error, bool force_live_memory=false)
Definition Target.cpp:2116
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:1808
std::recursive_mutex m_frame_provider_descriptors_mutex
Definition Target.h:1845
lldb::user_id_t m_target_unique_id
The globally unique ID assigned to this target.
Definition Target.h:1863
void ModulesDidUnload(ModuleList &module_list, bool delete_locations)
Definition Target.cpp:1884
void CalculateExecutionContext(ExecutionContext &exe_ctx) override
Reconstruct the object's execution context into sc.
Definition Target.cpp:2583
llvm::Expected< lldb::DisassemblerSP > ReadInstructions(const Address &start_addr, uint32_t count, const char *flavor_string=nullptr)
Definition Target.cpp:3008
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:3621
void NotifyModuleUpdated(const ModuleList &module_list, const lldb::ModuleSP &old_module_sp, const lldb::ModuleSP &new_module_sp) override
Definition Target.cpp:1825
SummaryStatisticsCache m_summary_statistics_cache
Definition Target.h:1820
Target(const Target &)=delete
void RegisterInternalStopHooks()
Status SerializeBreakpointsToFile(const FileSpec &file, const BreakpointIDList &bp_ids, bool append)
Definition Target.cpp:1168
void DidExec()
Called as the last function in Process::DidExec().
Definition Target.cpp:1552
void SaveScriptedLaunchInfo(lldb_private::ProcessInfo &process_info)
Definition Target.cpp:3413
bool GetSuppressStopHooks()
Definition Target.h:1689
std::string m_label
Definition Target.h:1817
lldb::user_id_t m_stop_hook_next_id
Definition Target.h:1855
static FileSpecList GetDefaultExecutableSearchPaths()
Definition Target.cpp:2786
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:745
void NotifyBreakpointChanged(Breakpoint &bp, lldb::BreakpointEventType event_kind)
Sends a breakpoint notification event.
Definition Target.cpp:5430
lldb::SearchFilterSP GetSearchFilterForModule(const FileSpec *containingModule)
Definition Target.cpp:673
llvm::StringMapEntry< DummySignalValues > DummySignalElement
Definition Target.h:1751
std::recursive_mutex & GetAPIMutex()
Definition Target.cpp:5403
static llvm::StringRef GetStaticBroadcasterClass()
Definition Target.cpp:171
static FileSpecList GetDefaultDebugFileSearchPaths()
Definition Target.cpp:2790
void EnableAllowedBreakpoints()
Definition Target.cpp:1100
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:1990
llvm::Error SetLabel(llvm::StringRef label)
Set a label for a target.
Definition Target.cpp:2805
uint32_t m_latest_stop_hook_id
Definition Target.h:1857
StackFrameRecognizerManager & GetFrameRecognizerManager()
Definition Target.h:1727
void RemoveAllowedBreakpoints()
Definition Target.cpp:1052
bool DisableAllWatchpoints(bool end_to_end=true)
Definition Target.cpp:1356
bool RunStopHooks(bool at_initial_stop=false)
Definition Target.cpp:3126
void ClearSectionLoadList()
Definition Target.cpp:5424
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:2193
lldb::PlatformSP m_platform_sp
The platform for this target.
Definition Target.h:1807
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:2755
FileSpecList GetSafeAutoLoadPaths() const
Get the list of paths that LLDB will consider automatically loading scripting resources from.
Definition Target.cpp:5446
static TargetProperties & GetGlobalProperties()
Definition Target.cpp:3283
Status Install(ProcessLaunchInfo *launch_info)
Definition Target.cpp:3291
lldb::PlatformSP GetPlatform()
Definition Target.h:1703
void NotifyModuleRemoved(const ModuleList &module_list, const lldb::ModuleSP &module_sp) override
Definition Target.cpp:1815
lldb::BreakpointSP CreateAddressInModuleBreakpoint(lldb::addr_t file_addr, bool internal, const FileSpec &file_spec, bool request_hardware)
Definition Target.cpp:579
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:490
void RemoveAllBreakpoints(bool internal_also=false)
Definition Target.cpp:1061
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:473
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:2794
void ResetBreakpointHitCounts()
Resets the hit count of all breakpoints.
Definition Target.cpp:1164
const ModuleList & GetImages() const
Get accessor for the images for this process.
Definition Target.h:1166
const ArchSpec & GetArchitecture() const
Definition Target.h:1208
WatchpointList & GetWatchpointList()
Definition Target.h:953
@ eBroadcastBitWatchpointChanged
Definition Target.h:588
@ eBroadcastBitBreakpointChanged
Definition Target.h:585
@ eBroadcastBitNewTargetCreated
Definition Target.h:591
unsigned m_next_persistent_variable_index
Definition Target.h:1862
bool EnableBreakpointByID(lldb::break_id_t break_id)
Definition Target.cpp:1145
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:2297
void InvalidateThreadFrameProviders()
Invalidate all potentially cached frame providers for all threads and trigger a stack changed event f...
Definition Target.cpp:3786
TargetStats m_stats
Definition Target.h:1887
bool IgnoreAllWatchpoints(uint32_t ignore_count)
Definition Target.cpp:1438
void AddBreakpoint(lldb::BreakpointSP breakpoint_sp, bool internal)
Definition Target.cpp:807
std::string m_target_session_name
The target session name for this target, used to name debugging sessions in DAP.
Definition Target.h:1866
TypeSystemMap m_scratch_type_system_map
Definition Target.h:1837
void AddBreakpointName(std::unique_ptr< BreakpointName > bp_name)
Definition Target.cpp:857
void SetTargetSessionName(llvm::StringRef target_session_name)
Set the target session name for this target.
Definition Target.h:713
SectionLoadHistory m_section_load_history
Definition Target.h:1821
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:923
bool IsDummyTarget() const
Definition Target.h:669
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:176
size_t UnloadModuleSections(const lldb::ModuleSP &module_sp)
Definition Target.cpp:3360
llvm::StringRef GetTargetSessionName()
Get the target session name for this target.
Definition Target.h:701
const std::string & GetLabel() const
Definition Target.h:682
bool m_valid
This records the last natural stop at which we ran a stop-hook.
Definition Target.h:1859
bool DisableWatchpointByID(lldb::watch_id_t watch_id)
Definition Target.cpp:1455
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:3892
void ClearScriptedFrameProviderDescriptors()
Clear all scripted frame provider descriptors for this target.
Definition Target.cpp:3768
std::map< ConstString, std::unique_ptr< BreakpointName > > BreakpointNameList
Definition Target.h:1824
lldb::WatchpointSP m_last_created_watchpoint
Definition Target.h:1830
Status CreateBreakpointsFromFile(const FileSpec &file, BreakpointIDList &new_bps)
Definition Target.cpp:1260
Debugger & m_debugger
Definition Target.h:1806
void SetREPL(lldb::LanguageType language, lldb::REPLSP repl_sp)
Definition Target.cpp:367
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:1558
lldb::StackFrameRecognizerManagerUP m_frame_recognizer_manager_up
Stores the frame recognizers of this target.
Definition Target.h:1873
lldb::REPLSP GetREPL(Status &err, lldb::LanguageType language, const char *repl_options, bool can_create)
Definition Target.cpp:316
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:2692
ModuleList m_images
The list of images for this process (shared libraries and anything dynamically loaded).
Definition Target.h:1818
lldb::ProcessSP CalculateProcess() override
Definition Target.cpp:2577
void PrintDummySignals(Stream &strm, Args &signals)
Print all the signals set in this target.
Definition Target.cpp:3986
void SetPlatform(const lldb::PlatformSP &platform_sp)
Definition Target.h:1705
bool SetSectionLoadAddress(const lldb::SectionSP &section, lldb::addr_t load_addr, bool warn_multiple=false)
Definition Target.cpp:3330
Status Attach(ProcessAttachInfo &attach_info, Stream *stream)
Definition Target.cpp:3627
std::map< lldb::LanguageType, lldb::REPLSP > REPLMap
Definition Target.h:1848
static void SetDefaultArchitecture(const ArchSpec &arch)
Definition Target.cpp:2798
lldb::BreakpointSP m_last_created_breakpoint
Definition Target.h:1828
lldb::WatchpointSP GetLastCreatedWatchpoint()
Definition Target.h:949
void RemoveNameFromBreakpoint(lldb::BreakpointSP &bp_sp, ConstString name)
Definition Target.cpp:895
bool RemoveStopHookByID(lldb::user_id_t uid)
Definition Target.cpp:3074
friend class Debugger
Definition Target.h:581
lldb::BreakpointSP GetLastCreatedBreakpoint()
Definition Target.h:841
static void SettingsInitialize()
Definition Target.cpp:2782
~Target() override
Definition Target.cpp:215
bool EnableAllWatchpoints(bool end_to_end=true)
Definition Target.cpp:1383
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:1815
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:2836
bool MergeArchitecture(const ArchSpec &arch_spec)
Definition Target.cpp:1778
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:57
@ eLoadScriptFromSymFileTrue
Definition Target.h:58
@ eLoadScriptFromSymFileTrusted
Definition Target.h:61
@ eLoadScriptFromSymFileFalse
Definition Target.h:59
@ eLoadScriptFromSymFileWarn
Definition Target.h:60
ExecutionPolicy
Expression execution policies.
DynamicClassInfoHelper
Definition Target.h:76
@ eDynamicClassInfoHelperCopyRealizedClassList
Definition Target.h:79
@ eDynamicClassInfoHelperGetRealizedClassList
Definition Target.h:80
@ eDynamicClassInfoHelperAuto
Definition Target.h:77
@ eDynamicClassInfoHelperRealizedClassesStruct
Definition Target.h:78
OptionEnumValues GetDynamicValueTypes()
Definition Target.cpp:4271
@ eImportStdModuleFalse
Definition Target.h:71
@ eImportStdModuleFallback
Definition Target.h:72
@ eImportStdModuleTrue
Definition Target.h:73
LoadCWDlldbinitFile
Definition Target.h:64
@ eLoadCWDlldbinitTrue
Definition Target.h:65
@ eLoadCWDlldbinitFalse
Definition Target.h:66
@ eLoadCWDlldbinitWarn
Definition Target.h:67
llvm::ArrayRef< OptionEnumValueElement > OptionEnumValues
@ eInlineBreakpointsNever
Definition Target.h:52
@ eInlineBreakpointsAlways
Definition Target.h:54
@ eInlineBreakpointsHeaders
Definition Target.h:53
ExpressionEvaluationPhase
Expression Evaluation Stages.
std::shared_ptr< lldb_private::Trace > TraceSP
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:1747
UserID(lldb::user_id_t uid=LLDB_INVALID_UID)
Construct with optional user ID.
Definition UserID.h:33