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/StringRef.h"
45
46namespace lldb_private {
47
49
55
61
67
73
80
85
87public:
88 TargetProperties(Target *target);
89
91
93
94 void SetDefaultArchitecture(const ArchSpec &arch);
95
96 bool GetMoveToNearestCode() const;
97
99
101
102 bool GetPreloadSymbols() const;
103
104 void SetPreloadSymbols(bool b);
105
106 bool GetDisableASLR() const;
107
108 void SetDisableASLR(bool b);
109
110 bool GetInheritTCC() const;
111
112 void SetInheritTCC(bool b);
113
114 bool GetDetachOnError() const;
115
116 void SetDetachOnError(bool b);
117
118 bool GetDisableSTDIO() const;
119
120 void SetDisableSTDIO(bool b);
121
122 llvm::StringRef GetLaunchWorkingDirectory() const;
123
124 bool GetParallelModuleLoad() const;
125
126 const char *GetDisassemblyFlavor() const;
127
128 const char *GetDisassemblyCPU() const;
129
130 const char *GetDisassemblyFeatures() const;
131
133
135
136 llvm::StringRef GetArg0() const;
137
138 void SetArg0(llvm::StringRef arg);
139
140 bool GetRunArguments(Args &args) const;
141
142 void SetRunArguments(const Args &args);
143
144 // Get the whole environment including the platform inherited environment and
145 // the target specific environment, excluding the unset environment variables.
147 // Get the platform inherited environment, excluding the unset environment
148 // variables.
150 // Get the target specific environment only, without the platform inherited
151 // environment.
153 // Set the target specific environment.
154 void SetEnvironment(Environment env);
155
156 bool GetSkipPrologue() const;
157
159
161
162 bool GetAutoSourceMapRelative() const;
163
165
167
169
171
173
175
177
178 bool GetEnableAutoApplyFixIts() const;
179
180 uint64_t GetNumberOfRetriesWithFixits() const;
181
182 bool GetEnableNotifyAboutFixIts() const;
183
185
186 bool GetEnableSyntheticValue() const;
187
189
190 uint32_t GetMaxZeroPaddingInFloatFormat() const;
191
193
194 /// Get the max depth value, augmented with a bool to indicate whether the
195 /// depth is the default.
196 ///
197 /// When the user has customized the max depth, the bool will be false.
198 ///
199 /// \returns the max depth, and true if the max depth is the system default,
200 /// otherwise false.
201 std::pair<uint32_t, bool> GetMaximumDepthOfChildrenToDisplay() const;
202
203 uint32_t GetMaximumSizeOfStringSummary() const;
204
205 uint32_t GetMaximumMemReadSize() const;
206
210
211 void SetStandardInputPath(llvm::StringRef path);
212 void SetStandardOutputPath(llvm::StringRef path);
213 void SetStandardErrorPath(llvm::StringRef path);
214
215 void SetStandardInputPath(const char *path) = delete;
216 void SetStandardOutputPath(const char *path) = delete;
217 void SetStandardErrorPath(const char *path) = delete;
218
220
222
223 llvm::StringRef GetExpressionPrefixContents();
224
225 uint64_t GetExprErrorLimit() const;
226
227 uint64_t GetExprAllocAddress() const;
228
229 uint64_t GetExprAllocSize() const;
230
231 uint64_t GetExprAllocAlign() const;
232
233 bool GetUseHexImmediates() const;
234
235 bool GetUseFastStepping() const;
236
238
240
242
244
246
247 bool GetUserSpecifiedTrapHandlerNames(Args &args) const;
248
249 void SetUserSpecifiedTrapHandlerNames(const Args &args);
250
252
254
256
258
260
261 void SetProcessLaunchInfo(const ProcessLaunchInfo &launch_info);
262
263 bool GetInjectLocalVariables(ExecutionContext *exe_ctx) const;
264
265 bool GetUseDIL(ExecutionContext *exe_ctx) const;
266
267 void SetUseDIL(ExecutionContext *exe_ctx, bool b);
268
270
272
273 bool GetAutoInstallMainExecutable() const;
274
276
277 void SetDebugUtilityExpression(bool debug);
278
279 bool GetDebugUtilityExpression() const;
280
281private:
282 std::optional<bool>
283 GetExperimentalPropertyValue(size_t prop_idx,
284 ExecutionContext *exe_ctx = nullptr) const;
285
286 // Callbacks for m_launch_info.
297
298 // Settings checker for target.jit-save-objects-dir:
299 void CheckJITObjectsDir();
300
302
303 // Member variables.
305 std::unique_ptr<TargetExperimentalProperties> m_experimental_properties_up;
307};
308
310public:
312
313// MSVC has a bug here that reports C4268: 'const' static/global data
314// initialized with compiler generated default constructor fills the object
315// with zeros. Confirmed that MSVC is *not* zero-initializing, it's just a
316// bogus warning.
317#if defined(_MSC_VER)
318#pragma warning(push)
319#pragma warning(disable : 4268)
320#endif
321 static constexpr std::chrono::milliseconds default_timeout{500};
322#if defined(_MSC_VER)
323#pragma warning(pop)
324#endif
325
328
330
334
336
337 void SetLanguage(lldb::LanguageType language_type) {
338 m_language = SourceLanguage(language_type);
339 }
340
342 m_preferred_lookup_contexts = std::move(contexts);
343 }
344
348
349 /// Set the language using a pair of language code and version as
350 /// defined by the DWARF 6 specification.
351 /// WARNING: These codes may change until DWARF 6 is finalized.
352 void SetLanguage(uint16_t name, uint32_t version) {
353 m_language = SourceLanguage(name, version);
354 }
355
356 bool DoesCoerceToId() const { return m_coerce_to_id; }
357
358 const char *GetPrefix() const {
359 return (m_prefix.empty() ? nullptr : m_prefix.c_str());
360 }
361
362 void SetPrefix(const char *prefix) {
363 if (prefix && prefix[0])
364 m_prefix = prefix;
365 else
366 m_prefix.clear();
367 }
368
369 void SetCoerceToId(bool coerce = true) { m_coerce_to_id = coerce; }
370
371 bool DoesUnwindOnError() const { return m_unwind_on_error; }
372
373 void SetUnwindOnError(bool unwind = false) { m_unwind_on_error = unwind; }
374
376
377 void SetIgnoreBreakpoints(bool ignore = false) {
378 m_ignore_breakpoints = ignore;
379 }
380
381 bool DoesKeepInMemory() const { return m_keep_in_memory; }
382
383 void SetKeepInMemory(bool keep = true) { m_keep_in_memory = keep; }
384
386
387 void
391
392 const Timeout<std::micro> &GetTimeout() const { return m_timeout; }
393
394 void SetTimeout(const Timeout<std::micro> &timeout) { m_timeout = timeout; }
395
399
401 m_one_thread_timeout = timeout;
402 }
403
404 bool GetTryAllThreads() const { return m_try_others; }
405
406 void SetTryAllThreads(bool try_others = true) { m_try_others = try_others; }
407
408 bool GetStopOthers() const { return m_stop_others; }
409
410 void SetStopOthers(bool stop_others = true) { m_stop_others = stop_others; }
411
412 bool GetDebug() const { return m_debug; }
413
414 void SetDebug(bool b) {
415 m_debug = b;
416 if (m_debug)
418 }
419
421
423
424 bool GetColorizeErrors() const { return m_ansi_color_errors; }
425
427
428 bool GetTrapExceptions() const { return m_trap_exceptions; }
429
431
432 bool GetREPLEnabled() const { return m_repl; }
433
434 void SetREPLEnabled(bool b) { m_repl = b; }
435
438 m_cancel_callback = callback;
439 }
440
442 return ((m_cancel_callback != nullptr)
444 : false);
445 }
446
447 // Allows the expression contents to be remapped to point to the specified
448 // file and line using #line directives.
449 void SetPoundLine(const char *path, uint32_t line) const {
450 if (path && path[0]) {
451 m_pound_line_file = path;
452 m_pound_line_line = line;
453 } else {
454 m_pound_line_file.clear();
456 }
457 }
458
459 const char *GetPoundLineFilePath() const {
460 return (m_pound_line_file.empty() ? nullptr : m_pound_line_file.c_str());
461 }
462
463 uint32_t GetPoundLineLine() const { return m_pound_line_line; }
464
466
470
472
474
475 void SetRetriesWithFixIts(uint64_t number_of_retries) {
476 m_retries_with_fixits = number_of_retries;
477 }
478
479 uint64_t GetRetriesWithFixIts() const { return m_retries_with_fixits; }
480
482
484
485 /// Set language-plugin specific option called \c option_name to
486 /// the specified boolean \c value.
487 llvm::Error SetBooleanLanguageOption(llvm::StringRef option_name, bool value);
488
489 /// Get the language-plugin specific boolean option called \c option_name.
490 ///
491 /// If the option doesn't exist or is not a boolean option, returns false.
492 /// Otherwise returns the boolean value of the option.
493 llvm::Expected<bool>
494 GetBooleanLanguageOption(llvm::StringRef option_name) const;
495
496 void SetCppIgnoreContextQualifiers(bool value);
497
499
500private:
502
504
507 std::string m_prefix;
508 bool m_coerce_to_id = false;
509 bool m_unwind_on_error = true;
511 bool m_keep_in_memory = false;
512 bool m_try_others = true;
513 bool m_stop_others = true;
514 bool m_debug = false;
515 bool m_trap_exceptions = true;
516 bool m_repl = false;
522 /// True if the executed code should be treated as utility code that is only
523 /// used by LLDB internally.
525
530 void *m_cancel_callback_baton = nullptr;
531 // If m_pound_line_file is not empty and m_pound_line_line is non-zero, use
532 // #line %u "%s" before the expression content to remap where the source
533 // originates
534 mutable std::string m_pound_line_file;
535 mutable uint32_t m_pound_line_line = 0;
536
537 /// Dictionary mapping names of language-plugin specific options
538 /// to values.
540
541 /// During expression evaluation, any SymbolContext in this list will be
542 /// used for symbol/function lookup before any other context (except for
543 /// the module corresponding to the current frame).
545};
546
547// Target
548class Target : public std::enable_shared_from_this<Target>,
549 public TargetProperties,
550 public Broadcaster,
552 public ModuleList::Notifier {
553public:
554 friend class TargetList;
555 friend class Debugger;
556
557 /// Broadcaster event bits definitions.
558 enum {
566 };
567
568 // These two functions fill out the Broadcaster interface:
569
570 static llvm::StringRef GetStaticBroadcasterClass();
571
572 llvm::StringRef GetBroadcasterClass() const override {
574 }
575
576 // This event data class is for use by the TargetList to broadcast new target
577 // notifications.
578 class TargetEventData : public EventData {
579 public:
580 TargetEventData(const lldb::TargetSP &target_sp);
581
582 TargetEventData(const lldb::TargetSP &target_sp,
583 const ModuleList &module_list);
584
585 // Constructor for eBroadcastBitNewTargetCreated events. For this event
586 // type:
587 // - target_sp is the parent target (the subject/broadcaster of the event)
588 // - created_target_sp is the newly created target
589 TargetEventData(const lldb::TargetSP &target_sp,
590 const lldb::TargetSP &created_target_sp);
591
593
594 static llvm::StringRef GetFlavorString();
595
596 llvm::StringRef GetFlavor() const override {
598 }
599
600 void Dump(Stream *s) const override;
601
602 static const TargetEventData *GetEventDataFromEvent(const Event *event_ptr);
603
604 static lldb::TargetSP GetTargetFromEvent(const Event *event_ptr);
605
606 // For eBroadcastBitNewTargetCreated events, returns the newly created
607 // target. For other event types, returns an invalid target.
608 static lldb::TargetSP GetCreatedTargetFromEvent(const Event *event_ptr);
609
610 static ModuleList GetModuleListFromEvent(const Event *event_ptr);
611
612 const lldb::TargetSP &GetTarget() const { return m_target_sp; }
613
615 return m_created_target_sp;
616 }
617
618 const ModuleList &GetModuleList() const { return m_module_list; }
619
620 private:
624
626 const TargetEventData &operator=(const TargetEventData &) = delete;
627 };
628
629 ~Target() override;
630
631 static void SettingsInitialize();
632
633 static void SettingsTerminate();
634
636
638
640
641 static void SetDefaultArchitecture(const ArchSpec &arch);
642
643 bool IsDummyTarget() const { return m_is_dummy_target; }
644
645 /// Get the globally unique ID for this target.
646 ///
647 /// This ID is unique across all debugger instances and all targets,
648 /// within the same lldb process. The ID is assigned
649 /// during target construction and remains constant for the target's lifetime.
650 /// The first target created (typically the dummy target) gets ID 1.
651 ///
652 /// \return
653 /// The globally unique ID for this target.
655
656 const std::string &GetLabel() const { return m_label; }
657
658 /// Set a label for a target.
659 ///
660 /// The label cannot be used by another target or be only integral.
661 ///
662 /// \return
663 /// The label for this target or an error if the label didn't match the
664 /// requirements.
665 llvm::Error SetLabel(llvm::StringRef label);
666
667 /// Get the target session name for this target.
668 ///
669 /// Provides a meaningful name for IDEs or tools to display for dynamically
670 /// created targets. Defaults to "Session {ID}" based on the globally unique
671 /// ID.
672 ///
673 /// \return
674 /// The target session name for this target.
675 llvm::StringRef GetTargetSessionName() { return m_target_session_name; }
676
677 /// Set the target session name for this target.
678 ///
679 /// This should typically be set along with the event
680 /// eBroadcastBitNewTargetCreated. Useful for scripts or triggers that
681 /// automatically create targets and want to provide meaningful names that
682 /// IDEs or other tools can display to help users identify the origin and
683 /// purpose of each target.
684 ///
685 /// \param[in] target_session_name
686 /// The target session name to set for this target.
687 void SetTargetSessionName(llvm::StringRef target_session_name) {
688 m_target_session_name = target_session_name.str();
689 }
690
691 /// Find a binary on the system and return its Module,
692 /// or return an existing Module that is already in the Target.
693 ///
694 /// Given a ModuleSpec, find a binary satisifying that specification,
695 /// or identify a matching Module already present in the Target,
696 /// and return a shared pointer to it.
697 ///
698 /// Note that this function previously also preloaded the module's symbols
699 /// depending on a setting. This function no longer does any module
700 /// preloading because that can potentially cause deadlocks when called in
701 /// parallel with this function.
702 ///
703 /// \param[in] module_spec
704 /// The criteria that must be matched for the binary being loaded.
705 /// e.g. UUID, architecture, file path.
706 ///
707 /// \param[in] notify
708 /// If notify is true, and the Module is new to this Target,
709 /// Target::ModulesDidLoad will be called. See note in
710 /// Target::ModulesDidLoad about thread-safety with
711 /// Target::GetOrCreateModule.
712 /// If notify is false, it is assumed that the caller is adding
713 /// multiple Modules and will call ModulesDidLoad with the
714 /// full list at the end.
715 /// ModulesDidLoad must be called when a Module/Modules have
716 /// been added to the target, one way or the other.
717 ///
718 /// \param[out] error_ptr
719 /// Optional argument, pointing to a Status object to fill in
720 /// with any results / messages while attempting to find/load
721 /// this binary. Many callers will be internal functions that
722 /// will handle / summarize the failures in a custom way and
723 /// don't use these messages.
724 ///
725 /// \return
726 /// An empty ModuleSP will be returned if no matching file
727 /// was found. If error_ptr was non-nullptr, an error message
728 /// will likely be provided.
729 lldb::ModuleSP GetOrCreateModule(const ModuleSpec &module_spec, bool notify,
730 Status *error_ptr = nullptr);
731
732 // Settings accessors
733
735
736 std::recursive_mutex &GetAPIMutex();
737
739
740 void CleanupProcess();
741
742 /// Dump a description of this object to a Stream.
743 ///
744 /// Dump a description of the contents of this object to the
745 /// supplied stream \a s. The dumped content will be only what has
746 /// been loaded or parsed up to this point at which this function
747 /// is called, so this is a good way to see what has been parsed
748 /// in a target.
749 ///
750 /// \param[in] s
751 /// The stream to which to dump the object description.
752 void Dump(Stream *s, lldb::DescriptionLevel description_level);
753
754 // If listener_sp is null, the listener of the owning Debugger object will be
755 // used.
757 llvm::StringRef plugin_name,
758 const FileSpec *crash_file,
759 bool can_connect);
760
761 const lldb::ProcessSP &GetProcessSP() const;
762
763 bool IsValid() { return m_valid; }
764
765 void Destroy();
766
767 Status Launch(ProcessLaunchInfo &launch_info,
768 Stream *stream); // Optional stream to receive first stop info
769
770 Status Attach(ProcessAttachInfo &attach_info,
771 Stream *stream); // Optional stream to receive first stop info
772
773 /// Add or update a scripted frame provider descriptor for this target.
774 /// All new threads in this target will check if they match any descriptors
775 /// to create their frame providers.
776 ///
777 /// \param[in] descriptor
778 /// The descriptor to add or update.
779 ///
780 /// \return
781 /// The descriptor identifier if the registration succeeded, otherwise an
782 /// llvm::Error.
783 llvm::Expected<uint32_t> AddScriptedFrameProviderDescriptor(
784 const ScriptedFrameProviderDescriptor &descriptor);
785
786 /// Remove a scripted frame provider descriptor by id.
787 ///
788 /// \param[in] id
789 /// The id of the descriptor to remove.
790 ///
791 /// \return
792 /// True if a descriptor was removed, false if no descriptor with that
793 /// id existed.
795
796 /// Clear all scripted frame provider descriptors for this target.
798
799 /// Get all scripted frame provider descriptors for this target.
800 const llvm::DenseMap<uint32_t, ScriptedFrameProviderDescriptor> &
802
803protected:
804 /// Invalidate all potentially cached frame providers for all threads
805 /// and trigger a stack changed event for all threads.
807
808public:
809 // This part handles the breakpoints.
810
811 BreakpointList &GetBreakpointList(bool internal = false);
812
813 const BreakpointList &GetBreakpointList(bool internal = false) const;
814
818
820
822
823 // Use this to create a file and line breakpoint to a given module or all
824 // module it is nullptr
825 lldb::BreakpointSP CreateBreakpoint(const FileSpecList *containingModules,
826 const FileSpec &file, uint32_t line_no,
827 uint32_t column, lldb::addr_t offset,
828 LazyBool check_inlines,
829 LazyBool skip_prologue, bool internal,
830 bool request_hardware,
831 LazyBool move_to_nearest_code);
832
833 // Use this to create breakpoint that matches regex against the source lines
834 // in files given in source_file_list: If function_names is non-empty, also
835 // filter by function after the matches are made.
837 const FileSpecList *containingModules,
838 const FileSpecList *source_file_list,
839 const std::unordered_set<std::string> &function_names,
840 RegularExpression source_regex, bool internal, bool request_hardware,
841 LazyBool move_to_nearest_code);
842
843 // Use this to create a breakpoint from a load address
844 lldb::BreakpointSP CreateBreakpoint(lldb::addr_t load_addr, bool internal,
845 bool request_hardware);
846
847 // Use this to create a breakpoint from a file address and a module file spec
849 bool internal,
850 const FileSpec &file_spec,
851 bool request_hardware);
852
853 // Use this to create Address breakpoints:
854 lldb::BreakpointSP CreateBreakpoint(const Address &addr, bool internal,
855 bool request_hardware);
856
857 // Use this to create a function breakpoint by regexp in
858 // containingModule/containingSourceFiles, or all modules if it is nullptr
859 // When "skip_prologue is set to eLazyBoolCalculate, we use the current
860 // target setting, else we use the values passed in
862 const FileSpecList *containingModules,
863 const FileSpecList *containingSourceFiles, RegularExpression func_regexp,
864 lldb::LanguageType requested_language, LazyBool skip_prologue,
865 bool internal, bool request_hardware);
866
867 // Use this to create a function breakpoint by name in containingModule, or
868 // all modules if it is nullptr When "skip_prologue is set to
869 // eLazyBoolCalculate, we use the current target setting, else we use the
870 // values passed in. func_name_type_mask is or'ed values from the
871 // FunctionNameType enum.
873 const FileSpecList *containingModules,
874 const FileSpecList *containingSourceFiles, const char *func_name,
875 lldb::FunctionNameType func_name_type_mask, lldb::LanguageType language,
876 lldb::addr_t offset, bool offset_is_insn_count, LazyBool skip_prologue,
877 bool internal, bool request_hardware);
878
880 CreateExceptionBreakpoint(enum lldb::LanguageType language, bool catch_bp,
881 bool throw_bp, bool internal,
882 Args *additional_args = nullptr,
883 Status *additional_args_error = nullptr);
884
886 const llvm::StringRef class_name, const FileSpecList *containingModules,
887 const FileSpecList *containingSourceFiles, bool internal,
888 bool request_hardware, StructuredData::ObjectSP extra_args_sp,
889 Status *creation_error = nullptr);
890
891 // This is the same as the func_name breakpoint except that you can specify a
892 // vector of names. This is cheaper than a regular expression breakpoint in
893 // the case where you just want to set a breakpoint on a set of names you
894 // already know. func_name_type_mask is or'ed values from the
895 // FunctionNameType enum.
897 const FileSpecList *containingModules,
898 const FileSpecList *containingSourceFiles, const char *func_names[],
899 size_t num_names, lldb::FunctionNameType func_name_type_mask,
900 lldb::LanguageType language, lldb::addr_t offset, LazyBool skip_prologue,
901 bool internal, bool request_hardware);
902
904 CreateBreakpoint(const FileSpecList *containingModules,
905 const FileSpecList *containingSourceFiles,
906 const std::vector<std::string> &func_names,
907 lldb::FunctionNameType func_name_type_mask,
908 lldb::LanguageType language, lldb::addr_t m_offset,
909 LazyBool skip_prologue, bool internal,
910 bool request_hardware);
911
912 // Use this to create a general breakpoint:
914 lldb::BreakpointResolverSP &resolver_sp,
915 bool internal, bool request_hardware,
916 bool resolve_indirect_symbols);
917
918 // Use this to create a watchpoint:
920 const CompilerType *type, uint32_t kind,
921 Status &error);
922
926
928
929 // Manages breakpoint names:
930 void AddNameToBreakpoint(BreakpointID &id, llvm::StringRef name,
931 Status &error);
932
933 void AddNameToBreakpoint(lldb::BreakpointSP &bp_sp, llvm::StringRef name,
934 Status &error);
935
937
938 BreakpointName *FindBreakpointName(ConstString name, bool can_create,
939 Status &error);
940
942
944 const BreakpointOptions &options,
945 const BreakpointName::Permissions &permissions);
947
948 void AddBreakpointName(std::unique_ptr<BreakpointName> bp_name);
949
950 void GetBreakpointNames(std::vector<std::string> &names);
951
952 // This call removes ALL breakpoints regardless of permission.
953 void RemoveAllBreakpoints(bool internal_also = false);
954
955 // This removes all the breakpoints, but obeys the ePermDelete on them.
957
958 void DisableAllBreakpoints(bool internal_also = false);
959
961
962 void EnableAllBreakpoints(bool internal_also = false);
963
965
967
969
971
972 /// Resets the hit count of all breakpoints.
974
975 // The flag 'end_to_end', default to true, signifies that the operation is
976 // performed end to end, for both the debugger and the debuggee.
977
978 bool RemoveAllWatchpoints(bool end_to_end = true);
979
980 bool DisableAllWatchpoints(bool end_to_end = true);
981
982 bool EnableAllWatchpoints(bool end_to_end = true);
983
985
987
988 bool IgnoreAllWatchpoints(uint32_t ignore_count);
989
991
993
995
996 bool IgnoreWatchpointByID(lldb::watch_id_t watch_id, uint32_t ignore_count);
997
999 const BreakpointIDList &bp_ids,
1000 bool append);
1001
1003 BreakpointIDList &new_bps);
1004
1006 std::vector<std::string> &names,
1007 BreakpointIDList &new_bps);
1008
1009 /// Get \a load_addr as a callable code load address for this target
1010 ///
1011 /// Take \a load_addr and potentially add any address bits that are
1012 /// needed to make the address callable. For ARM this can set bit
1013 /// zero (if it already isn't) if \a load_addr is a thumb function.
1014 /// If \a addr_class is set to AddressClass::eInvalid, then the address
1015 /// adjustment will always happen. If it is set to an address class
1016 /// that doesn't have code in it, LLDB_INVALID_ADDRESS will be
1017 /// returned.
1019 lldb::addr_t load_addr,
1020 AddressClass addr_class = AddressClass::eInvalid) const;
1021
1022 /// Get \a load_addr as an opcode for this target.
1023 ///
1024 /// Take \a load_addr and potentially strip any address bits that are
1025 /// needed to make the address point to an opcode. For ARM this can
1026 /// clear bit zero (if it already isn't) if \a load_addr is a
1027 /// thumb function and load_addr is in code.
1028 /// If \a addr_class is set to AddressClass::eInvalid, then the address
1029 /// adjustment will always happen. If it is set to an address class
1030 /// that doesn't have code in it, LLDB_INVALID_ADDRESS will be
1031 /// returned.
1034 AddressClass addr_class = AddressClass::eInvalid) const;
1035
1036 // Get load_addr as breakable load address for this target. Take a addr and
1037 // check if for any reason there is a better address than this to put a
1038 // breakpoint on. If there is then return that address. For MIPS, if
1039 // instruction at addr is a delay slot instruction then this method will find
1040 // the address of its previous instruction and return that address.
1042
1043 /// This call may preload module symbols, and may do so in parallel depending
1044 /// on the following target settings:
1045 /// - TargetProperties::GetPreloadSymbols()
1046 /// - TargetProperties::GetParallelModuleLoad()
1047 ///
1048 /// Warning: if preloading is active and this is called in parallel with
1049 /// Target::GetOrCreateModule, this may result in a ABBA deadlock situation.
1050 void ModulesDidLoad(ModuleList &module_list);
1051
1052 void ModulesDidUnload(ModuleList &module_list, bool delete_locations);
1053
1054 void SymbolsDidLoad(ModuleList &module_list);
1055
1056 void ClearModules(bool delete_locations);
1057
1058 /// Called as the last function in Process::DidExec().
1059 ///
1060 /// Process::DidExec() will clear a lot of state in the process,
1061 /// then try to reload a dynamic loader plugin to discover what
1062 /// binaries are currently available and then this function should
1063 /// be called to allow the target to do any cleanup after everything
1064 /// has been figured out. It can remove breakpoints that no longer
1065 /// make sense as the exec might have changed the target
1066 /// architecture, and unloaded some modules that might get deleted.
1067 void DidExec();
1068
1069 /// Gets the module for the main executable.
1070 ///
1071 /// Each process has a notion of a main executable that is the file
1072 /// that will be executed or attached to. Executable files can have
1073 /// dependent modules that are discovered from the object files, or
1074 /// discovered at runtime as things are dynamically loaded.
1075 ///
1076 /// \return
1077 /// The shared pointer to the executable module which can
1078 /// contains a nullptr Module object if no executable has been
1079 /// set.
1080 ///
1081 /// \see DynamicLoader
1082 /// \see ObjectFile::GetDependentModules (FileSpecList&)
1083 /// \see Process::SetExecutableModule(lldb::ModuleSP&)
1085
1087
1088 /// Set the main executable module.
1089 ///
1090 /// Each process has a notion of a main executable that is the file
1091 /// that will be executed or attached to. Executable files can have
1092 /// dependent modules that are discovered from the object files, or
1093 /// discovered at runtime as things are dynamically loaded.
1094 ///
1095 /// Setting the executable causes any of the current dependent
1096 /// image information to be cleared and replaced with the static
1097 /// dependent image information found by calling
1098 /// ObjectFile::GetDependentModules (FileSpecList&) on the main
1099 /// executable and any modules on which it depends. Calling
1100 /// Process::GetImages() will return the newly found images that
1101 /// were obtained from all of the object files.
1102 ///
1103 /// \param[in] module_sp
1104 /// A shared pointer reference to the module that will become
1105 /// the main executable for this process.
1106 ///
1107 /// \param[in] load_dependent_files
1108 /// If \b true then ask the object files to track down any
1109 /// known dependent files.
1110 ///
1111 /// \see ObjectFile::GetDependentModules (FileSpecList&)
1112 /// \see Process::GetImages()
1114 lldb::ModuleSP &module_sp,
1115 LoadDependentFiles load_dependent_files = eLoadDependentsDefault);
1116
1117 bool LoadScriptingResources(std::list<Status> &errors,
1118 Stream &feedback_stream,
1119 bool continue_on_error = true) {
1120 return m_images.LoadScriptingResourcesInTarget(
1121 this, errors, feedback_stream, continue_on_error);
1122 }
1123
1124 /// Get accessor for the images for this process.
1125 ///
1126 /// Each process has a notion of a main executable that is the file
1127 /// that will be executed or attached to. Executable files can have
1128 /// dependent modules that are discovered from the object files, or
1129 /// discovered at runtime as things are dynamically loaded. After
1130 /// a main executable has been set, the images will contain a list
1131 /// of all the files that the executable depends upon as far as the
1132 /// object files know. These images will usually contain valid file
1133 /// virtual addresses only. When the process is launched or attached
1134 /// to, the DynamicLoader plug-in will discover where these images
1135 /// were loaded in memory and will resolve the load virtual
1136 /// addresses is each image, and also in images that are loaded by
1137 /// code.
1138 ///
1139 /// \return
1140 /// A list of Module objects in a module list.
1141 const ModuleList &GetImages() const { return m_images; }
1142
1144
1145 /// Return whether this FileSpec corresponds to a module that should be
1146 /// considered for general searches.
1147 ///
1148 /// This API will be consulted by the SearchFilterForUnconstrainedSearches
1149 /// and any module that returns \b true will not be searched. Note the
1150 /// SearchFilterForUnconstrainedSearches is the search filter that
1151 /// gets used in the CreateBreakpoint calls when no modules is provided.
1152 ///
1153 /// The target call at present just consults the Platform's call of the
1154 /// same name.
1155 ///
1156 /// \param[in] module_spec
1157 /// Path to the module.
1158 ///
1159 /// \return \b true if the module should be excluded, \b false otherwise.
1160 bool ModuleIsExcludedForUnconstrainedSearches(const FileSpec &module_spec);
1161
1162 /// Return whether this module should be considered for general searches.
1163 ///
1164 /// This API will be consulted by the SearchFilterForUnconstrainedSearches
1165 /// and any module that returns \b true will not be searched. Note the
1166 /// SearchFilterForUnconstrainedSearches is the search filter that
1167 /// gets used in the CreateBreakpoint calls when no modules is provided.
1168 ///
1169 /// The target call at present just consults the Platform's call of the
1170 /// same name.
1171 ///
1172 /// FIXME: When we get time we should add a way for the user to set modules
1173 /// that they
1174 /// don't want searched, in addition to or instead of the platform ones.
1175 ///
1176 /// \param[in] module_sp
1177 /// A shared pointer reference to the module that checked.
1178 ///
1179 /// \return \b true if the module should be excluded, \b false otherwise.
1180 bool
1182
1183 const ArchSpec &GetArchitecture() const { return m_arch.GetSpec(); }
1184
1185 /// Returns the name of the target's ABI plugin.
1186 llvm::StringRef GetABIName() const;
1187
1188 /// Set the architecture for this target.
1189 ///
1190 /// If the current target has no Images read in, then this just sets the
1191 /// architecture, which will be used to select the architecture of the
1192 /// ExecutableModule when that is set. If the current target has an
1193 /// ExecutableModule, then calling SetArchitecture with a different
1194 /// architecture from the currently selected one will reset the
1195 /// ExecutableModule to that slice of the file backing the ExecutableModule.
1196 /// If the file backing the ExecutableModule does not contain a fork of this
1197 /// architecture, then this code will return false, and the architecture
1198 /// won't be changed. If the input arch_spec is the same as the already set
1199 /// architecture, this is a no-op.
1200 ///
1201 /// \param[in] arch_spec
1202 /// The new architecture.
1203 ///
1204 /// \param[in] set_platform
1205 /// If \b true, then the platform will be adjusted if the currently
1206 /// selected platform is not compatible with the architecture being set.
1207 /// If \b false, then just the architecture will be set even if the
1208 /// currently selected platform isn't compatible (in case it might be
1209 /// manually set following this function call).
1210 ///
1211 /// \param[in] merged
1212 /// If true, arch_spec is merged with the current
1213 /// architecture. Otherwise it's replaced.
1214 ///
1215 /// \return
1216 /// \b true if the architecture was successfully set, \b false otherwise.
1217 bool SetArchitecture(const ArchSpec &arch_spec, bool set_platform = false,
1218 bool merge = true);
1219
1220 bool MergeArchitecture(const ArchSpec &arch_spec);
1221
1222 Architecture *GetArchitecturePlugin() const { return m_arch.GetPlugin(); }
1223
1224 Debugger &GetDebugger() const { return m_debugger; }
1225
1226 size_t ReadMemoryFromFileCache(const Address &addr, void *dst, size_t dst_len,
1227 Status &error);
1228
1229 // Reading memory through the target allows us to skip going to the process
1230 // for reading memory if possible and it allows us to try and read from any
1231 // constant sections in our object files on disk. If you always want live
1232 // program memory, read straight from the process. If you possibly want to
1233 // read from const sections in object files, read from the target. This
1234 // version of ReadMemory will try and read memory from the process if the
1235 // process is alive. The order is:
1236 // 1 - if (force_live_memory == false) and the address falls in a read-only
1237 // section, then read from the file cache
1238 // 2 - if there is a process, then read from memory
1239 // 3 - if there is no process, then read from the file cache
1240 //
1241 // If did_read_live_memory is provided, will indicate if the read was from
1242 // live memory, or from file contents. A caller which needs to treat these two
1243 // sources differently should use this argument to disambiguate where the data
1244 // was read from.
1245 //
1246 // The method is virtual for mocking in the unit tests.
1247 virtual size_t ReadMemory(const Address &addr, void *dst, size_t dst_len,
1248 Status &error, bool force_live_memory = false,
1249 lldb::addr_t *load_addr_ptr = nullptr,
1250 bool *did_read_live_memory = nullptr);
1251
1252 size_t ReadCStringFromMemory(const Address &addr, std::string &out_str,
1253 Status &error, bool force_live_memory = false);
1254
1255 size_t ReadCStringFromMemory(const Address &addr, char *dst,
1256 size_t dst_max_len, Status &result_error,
1257 bool force_live_memory = false);
1258
1259 /// Read a NULL terminated string from memory
1260 ///
1261 /// This function will read a cache page at a time until a NULL string
1262 /// terminator is found. It will stop reading if an aligned sequence of NULL
1263 /// termination \a type_width bytes is not found before reading \a
1264 /// cstr_max_len bytes. The results are always guaranteed to be NULL
1265 /// terminated, and that no more than (max_bytes - type_width) bytes will be
1266 /// read.
1267 ///
1268 /// \param[in] addr
1269 /// The address to start the memory read.
1270 ///
1271 /// \param[in] dst
1272 /// A character buffer containing at least max_bytes.
1273 ///
1274 /// \param[in] max_bytes
1275 /// The maximum number of bytes to read.
1276 ///
1277 /// \param[in] error
1278 /// The error status of the read operation.
1279 ///
1280 /// \param[in] type_width
1281 /// The size of the null terminator (1 to 4 bytes per
1282 /// character). Defaults to 1.
1283 ///
1284 /// \return
1285 /// The error status or the number of bytes prior to the null terminator.
1286 size_t ReadStringFromMemory(const Address &addr, char *dst, size_t max_bytes,
1287 Status &error, size_t type_width,
1288 bool force_live_memory = true);
1289
1290 size_t ReadScalarIntegerFromMemory(const Address &addr, uint32_t byte_size,
1291 bool is_signed, Scalar &scalar,
1292 Status &error,
1293 bool force_live_memory = false);
1294
1295 int64_t ReadSignedIntegerFromMemory(const Address &addr,
1296 size_t integer_byte_size,
1297 int64_t fail_value, Status &error,
1298 bool force_live_memory = false);
1299
1300 uint64_t ReadUnsignedIntegerFromMemory(const Address &addr,
1301 size_t integer_byte_size,
1302 uint64_t fail_value, Status &error,
1303 bool force_live_memory = false);
1304
1305 bool ReadPointerFromMemory(const Address &addr, Status &error,
1306 Address &pointer_addr,
1307 bool force_live_memory = false);
1308
1309 bool HasLoadedSections();
1310
1312
1313 void ClearSectionLoadList();
1314
1315 void DumpSectionLoadList(Stream &s);
1316
1317 static Target *GetTargetFromContexts(const ExecutionContext *exe_ctx_ptr,
1318 const SymbolContext *sc_ptr);
1319
1320 // lldb::ExecutionContextScope pure virtual functions
1322
1324
1326
1328
1329 void CalculateExecutionContext(ExecutionContext &exe_ctx) override;
1330
1332
1333 llvm::Expected<lldb::TypeSystemSP>
1335 bool create_on_demand = true);
1336
1337 std::vector<lldb::TypeSystemSP>
1338 GetScratchTypeSystems(bool create_on_demand = true);
1339
1342
1343 // Creates a UserExpression for the given language, the rest of the
1344 // parameters have the same meaning as for the UserExpression constructor.
1345 // Returns a new-ed object which the caller owns.
1346
1348 GetUserExpressionForLanguage(llvm::StringRef expr, llvm::StringRef prefix,
1349 SourceLanguage language,
1350 Expression::ResultType desired_type,
1351 const EvaluateExpressionOptions &options,
1352 ValueObject *ctx_obj, Status &error);
1353
1354 // Creates a FunctionCaller for the given language, the rest of the
1355 // parameters have the same meaning as for the FunctionCaller constructor.
1356 // Since a FunctionCaller can't be
1357 // IR Interpreted, it makes no sense to call this with an
1358 // ExecutionContextScope that lacks
1359 // a Process.
1360 // Returns a new-ed object which the caller owns.
1361
1363 const CompilerType &return_type,
1364 const Address &function_address,
1365 const ValueList &arg_value_list,
1366 const char *name, Status &error);
1367
1368 /// Creates and installs a UtilityFunction for the given language.
1369 llvm::Expected<std::unique_ptr<UtilityFunction>>
1370 CreateUtilityFunction(std::string expression, std::string name,
1371 lldb::LanguageType language, ExecutionContext &exe_ctx);
1372
1373 // Install any files through the platform that need be to installed prior to
1374 // launching or attaching.
1375 Status Install(ProcessLaunchInfo *launch_info);
1376
1377 bool ResolveFileAddress(lldb::addr_t load_addr, Address &so_addr);
1378
1379 bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr,
1380 uint32_t stop_id = SectionLoadHistory::eStopIDNow,
1381 bool allow_section_end = false);
1382
1383 bool SetSectionLoadAddress(const lldb::SectionSP &section,
1384 lldb::addr_t load_addr,
1385 bool warn_multiple = false);
1386
1387 size_t UnloadModuleSections(const lldb::ModuleSP &module_sp);
1388
1389 size_t UnloadModuleSections(const ModuleList &module_list);
1390
1391 bool SetSectionUnloaded(const lldb::SectionSP &section_sp);
1392
1393 bool SetSectionUnloaded(const lldb::SectionSP &section_sp,
1394 lldb::addr_t load_addr);
1395
1397
1399 lldb_private::TypeSummaryImpl &summary_provider);
1401
1402 /// Set the \a Trace object containing processor trace information of this
1403 /// target.
1404 ///
1405 /// \param[in] trace_sp
1406 /// The trace object.
1407 void SetTrace(const lldb::TraceSP &trace_sp);
1408
1409 /// Get the \a Trace object containing processor trace information of this
1410 /// target.
1411 ///
1412 /// \return
1413 /// The trace object. It might be undefined.
1415
1416 /// Create a \a Trace object for the current target using the using the
1417 /// default supported tracing technology for this process.
1418 ///
1419 /// \return
1420 /// The new \a Trace or an \a llvm::Error if a \a Trace already exists or
1421 /// the trace couldn't be created.
1422 llvm::Expected<lldb::TraceSP> CreateTrace();
1423
1424 /// If a \a Trace object is present, this returns it, otherwise a new Trace is
1425 /// created with \a Trace::CreateTrace.
1426 llvm::Expected<lldb::TraceSP> GetTraceOrCreate();
1427
1428 // Since expressions results can persist beyond the lifetime of a process,
1429 // and the const expression results are available after a process is gone, we
1430 // provide a way for expressions to be evaluated from the Target itself. If
1431 // an expression is going to be run, then it should have a frame filled in in
1432 // the execution context.
1434 llvm::StringRef expression, ExecutionContextScope *exe_scope,
1435 lldb::ValueObjectSP &result_valobj_sp,
1437 std::string *fixed_expression = nullptr, ValueObject *ctx_obj = nullptr);
1438
1440
1442
1443 /// This method will return the address of the starting function for
1444 /// this binary, e.g. main() or its equivalent. This can be used as
1445 /// an address of a function that is not called once a binary has
1446 /// started running - e.g. as a return address for inferior function
1447 /// calls that are unambiguous completion of the function call, not
1448 /// called during the course of the inferior function code running.
1449 ///
1450 /// If no entry point can be found, an invalid address is returned.
1451 ///
1452 /// \param [out] err
1453 /// This object will be set to failure if no entry address could
1454 /// be found, and may contain a helpful error message.
1455 //
1456 /// \return
1457 /// Returns the entry address for this program, or an error
1458 /// if none can be found.
1459 llvm::Expected<lldb_private::Address> GetEntryPointAddress();
1460
1461 CompilerType GetRegisterType(const std::string &name,
1462 const lldb_private::RegisterFlags &flags,
1463 uint32_t byte_size);
1464
1465 /// Sends a breakpoint notification event.
1467 lldb::BreakpointEventType event_kind);
1468 /// Sends a breakpoint notification event.
1470 const lldb::EventDataSP &breakpoint_data_sp);
1471
1472 llvm::Expected<lldb::DisassemblerSP>
1473 ReadInstructions(const Address &start_addr, uint32_t count,
1474 const char *flavor_string = nullptr);
1475
1476 // Target Stop Hooks
1477 class StopHook : public UserID {
1478 public:
1479 StopHook(const StopHook &rhs);
1480 virtual ~StopHook() = default;
1481
1482 enum class StopHookKind : uint32_t {
1486 };
1493
1495
1496 // Set the specifier. The stop hook will own the specifier, and is
1497 // responsible for deleting it when we're done.
1498 void SetSpecifier(SymbolContextSpecifier *specifier);
1499
1501
1502 bool ExecutionContextPasses(const ExecutionContext &exe_ctx);
1503
1504 // Called on stop, this gets passed the ExecutionContext for each "stop
1505 // with a reason" thread. It should add to the stream whatever text it
1506 // wants to show the user, and return False to indicate it wants the target
1507 // not to stop.
1509 lldb::StreamSP output) = 0;
1510
1511 // Set the Thread Specifier. The stop hook will own the thread specifier,
1512 // and is responsible for deleting it when we're done.
1513 void SetThreadSpecifier(ThreadSpec *specifier);
1514
1516
1517 bool IsActive() { return m_active; }
1518
1519 void SetIsActive(bool is_active) { m_active = is_active; }
1520
1521 void SetAutoContinue(bool auto_continue) {
1522 m_auto_continue = auto_continue;
1523 }
1524
1525 bool GetAutoContinue() const { return m_auto_continue; }
1526
1527 void SetRunAtInitialStop(bool at_initial_stop) {
1528 m_at_initial_stop = at_initial_stop;
1529 }
1530
1532
1533 void SetSuppressOutput(bool suppress_output) {
1534 m_suppress_output = suppress_output;
1535 }
1536
1537 bool GetSuppressOutput() const { return m_suppress_output; }
1538
1539 void GetDescription(Stream &s, lldb::DescriptionLevel level) const;
1541 lldb::DescriptionLevel level) const = 0;
1542
1543 protected:
1546 std::unique_ptr<ThreadSpec> m_thread_spec_up;
1547 bool m_active = true;
1548 bool m_auto_continue = false;
1550 bool m_suppress_output = false;
1551
1552 StopHook(lldb::TargetSP target_sp, lldb::user_id_t uid);
1553 };
1554
1556 public:
1557 ~StopHookCommandLine() override = default;
1558
1560 void SetActionFromString(const std::string &strings);
1561 void SetActionFromStrings(const std::vector<std::string> &strings);
1562
1564 lldb::StreamSP output_sp) override;
1566 lldb::DescriptionLevel level) const override;
1567
1568 private:
1570 // Use CreateStopHook to make a new empty stop hook. Use SetActionFromString
1571 // to fill it with commands, and SetSpecifier to set the specifier shared
1572 // pointer (can be null, that will match anything.)
1574 : StopHook(target_sp, uid) {}
1575 friend class Target;
1576 };
1577
1579 public:
1580 ~StopHookScripted() override = default;
1582 lldb::StreamSP output) override;
1583
1584 Status SetScriptCallback(std::string class_name,
1585 StructuredData::ObjectSP extra_args_sp);
1586
1588 lldb::DescriptionLevel level) const override;
1589
1590 private:
1591 std::string m_class_name;
1592 /// This holds the dictionary of keys & values that can be used to
1593 /// parametrize any given callback's behavior.
1596
1597 /// Use CreateStopHook to make a new empty stop hook. Use SetScriptCallback
1598 /// to set the script to execute, and SetSpecifier to set the specifier
1599 /// shared pointer (can be null, that will match anything.)
1601 : StopHook(target_sp, uid) {}
1602 friend class Target;
1603 };
1604
1605 class StopHookCoded : public StopHook {
1606 public:
1607 ~StopHookCoded() override = default;
1608
1610 lldb::StreamSP output);
1611
1612 void SetCallback(llvm::StringRef name, HandleStopCallback *callback) {
1613 m_name = name;
1614 m_callback = callback;
1615 }
1616
1618 lldb::StreamSP output) override {
1619 return m_callback(exc_ctx, output);
1620 }
1621
1623 lldb::DescriptionLevel level) const override {
1624 s.Indent();
1625 s.Printf("%s (built-in)\n", m_name.c_str());
1626 }
1627
1628 private:
1629 std::string m_name;
1631
1632 /// Use CreateStopHook to make a new empty stop hook. Use SetCallback to set
1633 /// the callback to execute, and SetSpecifier to set the specifier shared
1634 /// pointer (can be null, that will match anything.)
1636 : StopHook(target_sp, uid) {}
1637 friend class Target;
1638 };
1639
1641
1642 typedef std::shared_ptr<StopHook> StopHookSP;
1643
1644 /// Add an empty stop hook to the Target's stop hook list, and returns a
1645 /// shared pointer to the new hook.
1646 StopHookSP CreateStopHook(StopHook::StopHookKind kind, bool internal = false);
1647
1648 /// If you tried to create a stop hook, and that failed, call this to
1649 /// remove the stop hook, as it will also reset the stop hook counter.
1651
1652 // Runs the stop hooks that have been registered for this target.
1653 // Returns true if the stop hooks cause the target to resume.
1654 // Pass at_initial_stop if this is the stop where lldb gains
1655 // control over the process for the first time.
1656 bool RunStopHooks(bool at_initial_stop = false);
1657
1658 bool SetSuppresStopHooks(bool suppress) {
1659 bool old_value = m_suppress_stop_hooks;
1660 m_suppress_stop_hooks = suppress;
1661 return old_value;
1662 }
1663
1665
1667
1668 void RemoveAllStopHooks();
1669
1670 StopHookSP GetStopHookByID(lldb::user_id_t uid);
1671
1672 bool SetStopHookActiveStateByID(lldb::user_id_t uid, bool active_state);
1673
1674 void SetAllStopHooksActiveState(bool active_state);
1675
1676 const std::vector<StopHookSP> GetStopHooks(bool internal = false) const;
1677
1679
1680 void SetPlatform(const lldb::PlatformSP &platform_sp) {
1681 m_platform_sp = platform_sp;
1682 }
1683
1685
1686 // Methods.
1688 GetSearchFilterForModule(const FileSpec *containingModule);
1689
1691 GetSearchFilterForModuleList(const FileSpecList *containingModuleList);
1692
1694 GetSearchFilterForModuleAndCUList(const FileSpecList *containingModules,
1695 const FileSpecList *containingSourceFiles);
1696
1698 const char *repl_options, bool can_create);
1699
1700 void SetREPL(lldb::LanguageType language, lldb::REPLSP repl_sp);
1701
1705
1707
1708 /// Add a signal for the target. This will get copied over to the process
1709 /// if the signal exists on that target. Only the values with Yes and No are
1710 /// set, Calculate values will be ignored.
1711protected:
1720 using DummySignalElement = llvm::StringMapEntry<DummySignalValues>;
1721 static bool UpdateSignalFromDummy(lldb::UnixSignalsSP signals_sp,
1722 const DummySignalElement &element);
1723 static bool ResetSignalFromDummy(lldb::UnixSignalsSP signals_sp,
1724 const DummySignalElement &element);
1725
1726public:
1727 /// Add a signal to the Target's list of stored signals/actions. These
1728 /// values will get copied into any processes launched from
1729 /// this target.
1730 void AddDummySignal(llvm::StringRef name, LazyBool pass, LazyBool print,
1731 LazyBool stop);
1732 /// Updates the signals in signals_sp using the stored dummy signals.
1733 /// If warning_stream_sp is not null, if any stored signals are not found in
1734 /// the current process, a warning will be emitted here.
1736 lldb::StreamSP warning_stream_sp);
1737 /// Clear the dummy signals in signal_names from the target, or all signals
1738 /// if signal_names is empty. Also remove the behaviors they set from the
1739 /// process's signals if it exists.
1740 void ClearDummySignals(Args &signal_names);
1741 /// Print all the signals set in this target.
1742 void PrintDummySignals(Stream &strm, Args &signals);
1743
1744protected:
1745 /// Implementing of ModuleList::Notifier.
1746
1747 void NotifyModuleAdded(const ModuleList &module_list,
1748 const lldb::ModuleSP &module_sp) override;
1749
1750 void NotifyModuleRemoved(const ModuleList &module_list,
1751 const lldb::ModuleSP &module_sp) override;
1752
1753 void NotifyModuleUpdated(const ModuleList &module_list,
1754 const lldb::ModuleSP &old_module_sp,
1755 const lldb::ModuleSP &new_module_sp) override;
1756
1757 void NotifyWillClearList(const ModuleList &module_list) override;
1758
1759 void NotifyModulesRemoved(lldb_private::ModuleList &module_list) override;
1760
1761 class Arch {
1762 public:
1763 explicit Arch(const ArchSpec &spec);
1764 const Arch &operator=(const ArchSpec &spec);
1765
1766 const ArchSpec &GetSpec() const { return m_spec; }
1767 Architecture *GetPlugin() const { return m_plugin_up.get(); }
1768
1769 private:
1771 std::unique_ptr<Architecture> m_plugin_up;
1772 };
1773
1774 // Member variables.
1776 lldb::PlatformSP m_platform_sp; ///< The platform for this target.
1777 std::recursive_mutex m_mutex; ///< An API mutex that is used by the lldb::SB*
1778 /// classes make the SB interface thread safe
1779 /// When the private state thread calls SB API's - usually because it is
1780 /// running OS plugin or Python ThreadPlan code - it should not block on the
1781 /// API mutex that is held by the code that kicked off the sequence of events
1782 /// that led us to run the code. We hand out this mutex instead when we
1783 /// detect that code is running on the private state thread.
1784 std::recursive_mutex m_private_mutex;
1786 std::string m_label;
1787 ModuleList m_images; ///< The list of images for this process (shared
1788 /// libraries and anything dynamically loaded).
1794 std::map<ConstString, std::unique_ptr<BreakpointName>>;
1796
1800 // We want to tightly control the process destruction process so we can
1801 // correctly tear down everything that we need to, so the only class that
1802 // knows about the process lifespan is this target class.
1807
1808 /// Map of scripted frame provider descriptors for this target.
1809 /// Keys are the provider descriptors ids, values are the descriptors.
1810 /// Used to initialize frame providers for new threads.
1811 llvm::DenseMap<uint32_t, ScriptedFrameProviderDescriptor>
1813 mutable std::recursive_mutex m_frame_provider_descriptors_mutex;
1814
1815 typedef std::map<lldb::LanguageType, lldb::REPLSP> REPLMap;
1817
1819
1820 typedef std::map<lldb::user_id_t, StopHookSP> StopHookCollection;
1823 std::vector<StopHookSP> m_internal_stop_hooks;
1824 uint32_t m_latest_stop_hook_id; /// This records the last natural stop at
1825 /// which we ran a stop-hook.
1827 bool m_suppress_stop_hooks; /// Used to not run stop hooks for expressions
1831 LLDB_INVALID_GLOBALLY_UNIQUE_TARGET_ID; ///< The globally unique ID
1832 /// assigned to this target
1833 std::string m_target_session_name; ///< The target session name for this
1834 /// target, used to name debugging
1835 /// sessions in DAP.
1836 /// An optional \a lldb_private::Trace object containing processor trace
1837 /// information of this target.
1839 /// Stores the frame recognizers of this target.
1841 /// These are used to set the signal state when you don't have a process and
1842 /// more usefully in the Dummy target where you can't know exactly what
1843 /// signals you will have.
1844 llvm::StringMap<DummySignalValues> m_dummy_signals;
1845
1846 static void ImageSearchPathsChanged(const PathMappingList &path_list,
1847 void *baton);
1848
1849 // Utilities for `statistics` command.
1850private:
1851 // Target metrics storage.
1853
1854public:
1855 /// Get metrics associated with this target in JSON format.
1856 ///
1857 /// Target metrics help measure timings and information that is contained in
1858 /// a target. These are designed to help measure performance of a debug
1859 /// session as well as represent the current state of the target, like
1860 /// information on the currently modules, currently set breakpoints and more.
1861 ///
1862 /// \return
1863 /// Returns a JSON value that contains all target metrics.
1864 llvm::json::Value
1866
1867 void ResetStatistics();
1868
1870
1871protected:
1872 /// Construct with optional file and arch.
1873 ///
1874 /// This member is private. Clients must use
1875 /// TargetList::CreateTarget(const FileSpec*, const ArchSpec*)
1876 /// so all targets can be tracked from the central target list.
1877 ///
1878 /// \see TargetList::CreateTarget(const FileSpec*, const ArchSpec*)
1879 Target(Debugger &debugger, const ArchSpec &target_arch,
1880 const lldb::PlatformSP &platform_sp, bool is_dummy_target);
1881
1882 // Helper function.
1883 bool ProcessIsValid();
1884
1885 // Copy breakpoints, stop hooks and so forth from the dummy target:
1886 void PrimeFromDummyTarget(Target &target);
1887
1888 void AddBreakpoint(lldb::BreakpointSP breakpoint_sp, bool internal);
1889
1891
1892 /// Return a recommended size for memory reads at \a addr, optimizing for
1893 /// cache usage.
1895
1896 Target(const Target &) = delete;
1897 const Target &operator=(const Target &) = delete;
1898
1900 return m_section_load_history.GetCurrentSectionLoadList();
1901 }
1902};
1903
1904} // namespace lldb_private
1905
1906#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:87
void SetPreferredSymbolContexts(SymbolContextList contexts)
Definition Target.h:341
void SetOneThreadTimeout(const Timeout< std::micro > &timeout)
Definition Target.h:400
void SetUnwindOnError(bool unwind=false)
Definition Target.h:373
SourceLanguage GetLanguage() const
Definition Target.h:335
const char * GetPoundLineFilePath() const
Definition Target.h:459
lldb::DynamicValueType m_use_dynamic
Definition Target.h:526
void SetExecutionPolicy(ExecutionPolicy policy=eExecutionPolicyAlways)
Definition Target.h:331
Timeout< std::micro > m_one_thread_timeout
Definition Target.h:528
bool InvokeCancelCallback(lldb::ExpressionEvaluationPhase phase) const
Definition Target.h:441
lldb::DynamicValueType GetUseDynamic() const
Definition Target.h:385
void SetKeepInMemory(bool keep=true)
Definition Target.h:383
void SetCoerceToId(bool coerce=true)
Definition Target.h:369
void SetLanguage(lldb::LanguageType language_type)
Definition Target.h:337
ExecutionPolicy GetExecutionPolicy() const
Definition Target.h:329
Timeout< std::micro > m_timeout
Definition Target.h:527
void SetCppIgnoreContextQualifiers(bool value)
Definition Target.cpp:5433
const StructuredData::Dictionary & GetLanguageOptions() const
Definition Target.cpp:5411
llvm::Expected< bool > GetBooleanLanguageOption(llvm::StringRef option_name) const
Get the language-plugin specific boolean option called option_name.
Definition Target.cpp:5395
void SetPrefix(const char *prefix)
Definition Target.h:362
void SetTryAllThreads(bool try_others=true)
Definition Target.h:406
static constexpr std::chrono::milliseconds default_timeout
Definition Target.h:321
void SetPoundLine(const char *path, uint32_t line) const
Definition Target.h:449
void SetRetriesWithFixIts(uint64_t number_of_retries)
Definition Target.h:475
SymbolContextList m_preferred_lookup_contexts
During expression evaluation, any SymbolContext in this list will be used for symbol/function lookup ...
Definition Target.h:544
void SetTimeout(const Timeout< std::micro > &timeout)
Definition Target.h:394
static constexpr ExecutionPolicy default_execution_policy
Definition Target.h:326
void SetStopOthers(bool stop_others=true)
Definition Target.h:410
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:524
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:5378
StructuredData::DictionarySP m_language_options_sp
Dictionary mapping names of language-plugin specific options to values.
Definition Target.h:539
void SetCancelCallback(lldb::ExpressionCancelCallback callback, void *baton)
Definition Target.h:436
const Timeout< std::micro > & GetTimeout() const
Definition Target.h:392
const SymbolContextList & GetPreferredSymbolContexts() const
Definition Target.h:345
void SetIgnoreBreakpoints(bool ignore=false)
Definition Target.h:377
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:352
void SetUseDynamic(lldb::DynamicValueType dynamic=lldb::eDynamicCanRunTarget)
Definition Target.h:388
lldb::ExpressionCancelCallback m_cancel_callback
Definition Target.h:529
const Timeout< std::micro > & GetOneThreadTimeout() const
Definition Target.h:396
"lldb/Target/ExecutionContextScope.h" Inherit from this if your object can reconstruct its execution ...
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
A file collection class.
A file utility class.
Definition FileSpec.h:57
Encapsulates a function that can be called.
A collection class for Module objects.
Definition ModuleList.h:125
A class that describes an executable image and its associated object and symbol files.
Definition Module.h:90
Class that provides a registry of known stack frame recognizers.
An error handling class.
Definition Status.h:118
A stream class that can stream formatted output to a file.
Definition Stream.h:28
size_t Indent(llvm::StringRef s="")
Indent the current line in the stream.
Definition Stream.cpp:157
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Definition Stream.cpp:134
std::shared_ptr< Dictionary > DictionarySP
std::shared_ptr< Object > ObjectSP
A class that wraps a std::map of SummaryStatistics objects behind a mutex.
Definition Statistics.h: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:4978
FileSpecList GetDebugFileSearchPaths()
Definition Target.cpp:4859
llvm::StringRef GetLaunchWorkingDirectory() const
Definition Target.cpp:4665
bool GetDisplayRecognizedArguments() const
Definition Target.cpp:5136
ImportStdModule GetImportStdModule() const
Definition Target.cpp:4875
void AppendExecutableSearchPaths(const FileSpec &)
Definition Target.cpp:4846
bool GetEnableSyntheticValue() const
Definition Target.cpp:4945
void SetStandardInputPath(const char *path)=delete
ProcessLaunchInfo m_launch_info
Definition Target.h:304
uint64_t GetExprAllocAlign() const
Definition Target.cpp:5057
MemoryModuleLoadLevel GetMemoryModuleLoadLevel() const
Definition Target.cpp:5108
llvm::StringRef GetArg0() const
Definition Target.cpp:4718
uint32_t GetMaximumMemReadSize() const
Definition Target.cpp:4984
void SetRunArguments(const Args &args)
Definition Target.cpp:4735
FileSpec GetStandardErrorPath() const
Definition Target.cpp:5010
bool GetEnableNotifyAboutFixIts() const
Definition Target.cpp:4901
bool SetPreferDynamicValue(lldb::DynamicValueType d)
Definition Target.cpp:4602
void SetDisplayRecognizedArguments(bool b)
Definition Target.cpp:5142
std::optional< bool > GetExperimentalPropertyValue(size_t prop_idx, ExecutionContext *exe_ctx=nullptr) const
Definition Target.cpp:4541
const ProcessLaunchInfo & GetProcessLaunchInfo() const
Definition Target.cpp:5147
Environment ComputeEnvironment() const
Definition Target.cpp:4741
void SetStandardOutputPath(const char *path)=delete
bool GetUserSpecifiedTrapHandlerNames(Args &args) const
Definition Target.cpp:5115
uint64_t GetExprErrorLimit() const
Definition Target.cpp:5039
bool GetEnableAutoImportClangModules() const
Definition Target.cpp:4869
bool GetDebugUtilityExpression() const
Definition Target.cpp:5253
DynamicClassInfoHelper GetDynamicClassInfoHelper() const
Definition Target.cpp:4882
FileSpec GetStandardOutputPath() const
Definition Target.cpp:5000
void SetDisplayRuntimeSupportValues(bool b)
Definition Target.cpp:5131
uint32_t GetMaximumNumberOfChildrenToDisplay() const
Definition Target.cpp:4963
void SetRequireHardwareBreakpoints(bool b)
Definition Target.cpp:5185
bool GetAutoInstallMainExecutable() const
Definition Target.cpp:5190
const char * GetDisassemblyFeatures() const
Definition Target.cpp:4697
RealpathPrefixes GetSourceRealpathPrefixes() const
Definition Target.cpp:4713
uint64_t GetNumberOfRetriesWithFixits() const
Definition Target.cpp:4895
uint64_t GetExprAllocSize() const
Definition Target.cpp:5051
llvm::StringRef GetExpressionPrefixContents()
Definition Target.cpp:5025
PathMappingList & GetObjectPathMap() const
Definition Target.cpp:4832
const char * GetDisassemblyFlavor() const
Definition Target.cpp:4677
FileSpec GetStandardInputPath() const
Definition Target.cpp:4990
lldb::DynamicValueType GetPreferDynamicValue() const
Definition Target.cpp:4595
InlineStrategy GetInlineStrategy() const
Definition Target.cpp:4704
Environment GetTargetEnvironment() const
Definition Target.cpp:4801
bool GetDisplayRuntimeSupportValues() const
Definition Target.cpp:5125
void SetUserSpecifiedTrapHandlerNames(const Args &args)
Definition Target.cpp:5120
uint32_t GetMaxZeroPaddingInFloatFormat() const
Definition Target.cpp:4957
uint64_t GetExprAllocAddress() const
Definition Target.cpp:5045
LoadCWDlldbinitFile GetLoadCWDlldbinitFile() const
Definition Target.cpp:5094
Environment GetInheritedEnvironment() const
Definition Target.cpp:4773
void SetArg0(llvm::StringRef arg)
Definition Target.cpp:4724
bool GetInjectLocalVariables(ExecutionContext *exe_ctx) const
Definition Target.cpp:4552
void SetStandardErrorPath(const char *path)=delete
bool ShowHexVariableValuesWithLeadingZeroes() const
Definition Target.cpp:4951
SourceLanguage GetLanguage() const
Definition Target.cpp:5020
Environment GetEnvironment() const
Definition Target.cpp:4769
void SetProcessLaunchInfo(const ProcessLaunchInfo &launch_info)
Definition Target.cpp:5151
FileSpec GetSaveJITObjectsDir() const
Definition Target.cpp:4907
void SetEnvironment(Environment env)
Definition Target.cpp:4812
LoadScriptFromSymFile GetLoadScriptFromSymbolFile() const
Definition Target.cpp:5087
const char * GetDisassemblyCPU() const
Definition Target.cpp:4690
void SetStandardErrorPath(llvm::StringRef path)
Definition Target.cpp:5015
bool GetRunArguments(Args &args) const
Definition Target.cpp:4730
FileSpecList GetExecutableSearchPaths()
Definition Target.cpp:4854
ArchSpec GetDefaultArchitecture() const
Definition Target.cpp:4579
Disassembler::HexImmediateStyle GetHexImmediateStyle() const
Definition Target.cpp:5101
void SetUseDIL(ExecutionContext *exe_ctx, bool b)
Definition Target.cpp:4570
std::unique_ptr< TargetExperimentalProperties > m_experimental_properties_up
Definition Target.h:305
FileSpecList GetClangModuleSearchPaths()
Definition Target.cpp:4864
void SetStandardOutputPath(llvm::StringRef path)
Definition Target.cpp:5005
bool GetRequireHardwareBreakpoints() const
Definition Target.cpp:5179
PathMappingList & GetSourcePathMap() const
Definition Target.cpp:4824
bool GetAutoSourceMapRelative() const
Definition Target.cpp:4840
bool GetUseDIL(ExecutionContext *exe_ctx) const
Definition Target.cpp:4558
void SetDefaultArchitecture(const ArchSpec &arch)
Definition Target.cpp:4584
void SetStandardInputPath(llvm::StringRef path)
Definition Target.cpp:4995
TargetProperties(Target *target)
Definition Target.cpp:4465
bool GetDisplayExpressionsInCrashlogs() const
Definition Target.cpp:5081
bool GetEnableAutoApplyFixIts() const
Definition Target.cpp:4889
void SetDebugUtilityExpression(bool debug)
Definition Target.cpp:5259
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:4970
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:1771
const ArchSpec & GetSpec() const
Definition Target.h:1766
const Arch & operator=(const ArchSpec &spec)
Definition Target.cpp:164
Arch(const ArchSpec &spec)
Definition Target.cpp:160
Architecture * GetPlugin() const
Definition Target.h:1767
void GetSubclassDescription(Stream &s, lldb::DescriptionLevel level) const override
Definition Target.h:1622
HandleStopCallback * m_callback
Definition Target.h:1630
StopHookResult HandleStop(ExecutionContext &exc_ctx, lldb::StreamSP output) override
Definition Target.h:1617
StopHookCoded(lldb::TargetSP target_sp, lldb::user_id_t uid)
Use CreateStopHook to make a new empty stop hook.
Definition Target.h:1635
void SetCallback(llvm::StringRef name, HandleStopCallback *callback)
Definition Target.h:1612
StopHookResult(ExecutionContext &exc_ctx, lldb::StreamSP output) HandleStopCallback
Definition Target.h:1609
void SetActionFromString(const std::string &strings)
Definition Target.cpp:4086
StopHookCommandLine(lldb::TargetSP target_sp, lldb::user_id_t uid)
Definition Target.h:1573
void SetActionFromStrings(const std::vector< std::string > &strings)
Definition Target.cpp:4090
StopHookResult HandleStop(ExecutionContext &exc_ctx, lldb::StreamSP output_sp) override
Definition Target.cpp:4097
void GetSubclassDescription(Stream &s, lldb::DescriptionLevel level) const override
Definition Target.cpp:4068
Status SetScriptCallback(std::string class_name, StructuredData::ObjectSP extra_args_sp)
Definition Target.cpp:4131
StopHookResult HandleStop(ExecutionContext &exc_ctx, lldb::StreamSP output) override
Definition Target.cpp:4171
StopHookScripted(lldb::TargetSP target_sp, lldb::user_id_t uid)
Use CreateStopHook to make a new empty stop hook.
Definition Target.h:1600
void GetSubclassDescription(Stream &s, lldb::DescriptionLevel level) const override
Definition Target.cpp:4190
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:1594
lldb::ScriptedStopHookInterfaceSP m_interface_sp
Definition Target.h:1595
bool GetRunAtInitialStop() const
Definition Target.h:1531
SymbolContextSpecifier * GetSpecifier()
Definition Target.h:1500
void SetSpecifier(SymbolContextSpecifier *specifier)
Definition Target.cpp:4006
virtual StopHookResult HandleStop(ExecutionContext &exe_ctx, lldb::StreamSP output)=0
std::unique_ptr< ThreadSpec > m_thread_spec_up
Definition Target.h:1546
void SetIsActive(bool is_active)
Definition Target.h:1519
void SetSuppressOutput(bool suppress_output)
Definition Target.h:1533
void SetThreadSpecifier(ThreadSpec *specifier)
Definition Target.cpp:4010
ThreadSpec * GetThreadSpecifier()
Definition Target.h:1515
StopHook(const StopHook &rhs)
Definition Target.cpp:3998
bool ExecutionContextPasses(const ExecutionContext &exe_ctx)
Definition Target.cpp:4014
lldb::TargetSP & GetTarget()
Definition Target.h:1494
void SetRunAtInitialStop(bool at_initial_stop)
Definition Target.h:1527
lldb::SymbolContextSpecifierSP m_specifier_sp
Definition Target.h:1545
virtual void GetSubclassDescription(Stream &s, lldb::DescriptionLevel level) const =0
void GetDescription(Stream &s, lldb::DescriptionLevel level) const
Definition Target.cpp:4030
void SetAutoContinue(bool auto_continue)
Definition Target.h:1521
const ModuleList & GetModuleList() const
Definition Target.h:618
void Dump(Stream *s) const override
Definition Target.cpp:5284
static llvm::StringRef GetFlavorString()
Definition Target.cpp:5280
static lldb::TargetSP GetCreatedTargetFromEvent(const Event *event_ptr)
Definition Target.cpp:5313
static ModuleList GetModuleListFromEvent(const Event *event_ptr)
Definition Target.cpp:5322
static const TargetEventData * GetEventDataFromEvent(const Event *event_ptr)
Definition Target.cpp:5294
llvm::StringRef GetFlavor() const override
Definition Target.h:596
const lldb::TargetSP & GetTarget() const
Definition Target.h:612
TargetEventData(const lldb::TargetSP &target_sp)
Definition Target.cpp:5266
TargetEventData(const TargetEventData &)=delete
const lldb::TargetSP & GetCreatedTarget() const
Definition Target.h:614
const TargetEventData & operator=(const TargetEventData &)=delete
static lldb::TargetSP GetTargetFromEvent(const Event *event_ptr)
Definition Target.cpp:5304
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:1859
lldb::ThreadSP CalculateThread() override
Definition Target.cpp:2593
llvm::Expected< uint32_t > AddScriptedFrameProviderDescriptor(const ScriptedFrameProviderDescriptor &descriptor)
Add or update a scripted frame provider descriptor for this target.
Definition Target.cpp:3722
StopHookCollection m_stop_hooks
Definition Target.h:1821
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:244
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:909
lldb::TraceSP GetTrace()
Get the Trace object containing processor trace information of this target.
Definition Target.cpp:3597
PathMappingList & GetImageSearchPathList()
Definition Target.cpp:2602
void FinalizeFileActions(ProcessLaunchInfo &info)
Definition Target.cpp:3790
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:2990
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:2998
ModuleList & GetImages()
Definition Target.h:1143
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:761
static Target * GetTargetFromContexts(const ExecutionContext *exe_ctx_ptr, const SymbolContext *sc_ptr)
Definition Target.cpp:2835
lldb::addr_t GetBreakableLoadAddress(lldb::addr_t addr)
Definition Target.cpp:3005
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:3938
bool SetSuppresStopHooks(bool suppress)
Definition Target.h:1658
static void ImageSearchPathsChanged(const PathMappingList &path_list, void *baton)
Definition Target.cpp:2606
llvm::Expected< lldb_private::Address > GetEntryPointAddress()
This method will return the address of the starting function for this binary, e.g.
Definition Target.cpp:2956
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:727
lldb::BreakpointSP GetBreakpointByID(lldb::break_id_t break_id)
Definition Target.cpp:422
std::shared_ptr< StopHook > StopHookSP
Definition Target.h:1642
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:572
void SymbolsDidLoad(ModuleList &module_list)
Definition Target.cpp:1882
bool ClearAllWatchpointHistoricValues()
Definition Target.cpp:1423
const std::vector< StopHookSP > GetStopHooks(bool internal=false) const
Definition Target.cpp:3118
void SetTrace(const lldb::TraceSP &trace_sp)
Set the Trace object containing processor trace information of this target.
Definition Target.cpp:3595
BreakpointList & GetBreakpointList(bool internal=false)
Definition Target.cpp:408
CompilerType GetRegisterType(const std::string &name, const lldb_private::RegisterFlags &flags, uint32_t byte_size)
Definition Target.cpp:2642
BreakpointNameList m_breakpoint_names
Definition Target.h:1795
lldb_private::SummaryStatisticsCache & GetSummaryStatisticsCache()
Definition Target.cpp:3412
lldb::addr_t GetSectionLoadAddress(const lldb::SectionSP &section_sp)
Definition Target.cpp:5347
llvm::StringRef GetABIName() const
Returns the name of the target's ABI plugin.
Definition Target.cpp:397
SourceManager & GetSourceManager()
Definition Target.cpp:3042
lldb::SearchFilterSP GetSearchFilterForModuleList(const FileSpecList *containingModuleList)
Definition Target.cpp:690
StopHookSP GetStopHookByID(lldb::user_id_t uid)
Definition Target.cpp:3084
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:1844
lldb::ProcessSP m_process_sp
Definition Target.h:1803
Debugger & GetDebugger() const
Definition Target.h:1224
lldb::SearchFilterSP m_search_filter_sp
Definition Target.h:1804
PersistentExpressionState * GetPersistentExpressionStateForLanguage(lldb::LanguageType language)
Definition Target.cpp:2685
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:3926
bool m_is_dummy_target
Used to not run stop hooks for expressions.
Definition Target.h:1828
static bool UpdateSignalFromDummy(lldb::UnixSignalsSP signals_sp, const DummySignalElement &element)
Definition Target.cpp:3884
PathMappingList m_image_search_paths
Definition Target.h:1805
bool ModuleIsExcludedForUnconstrainedSearches(const FileSpec &module_spec)
Return whether this FileSpec corresponds to a module that should be considered for general searches.
Definition Target.cpp:1938
lldb::StackFrameSP CalculateStackFrame() override
Definition Target.cpp:2595
SectionLoadList & GetSectionLoadList()
Definition Target.h:1899
lldb::addr_t GetPersistentSymbol(ConstString name)
Definition Target.cpp:2936
void PrimeFromDummyTarget(Target &target)
Definition Target.cpp:220
bool RemoveScriptedFrameProviderDescriptor(uint32_t id)
Remove a scripted frame provider descriptor by id.
Definition Target.cpp:3745
static void SettingsTerminate()
Definition Target.cpp:2797
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:3328
bool ClearAllWatchpointHitCounts()
Definition Target.cpp:1409
size_t ReadMemoryFromFileCache(const Address &addr, void *dst, size_t dst_len, Status &error)
Definition Target.cpp:1970
void ClearAllLoadedSections()
Definition Target.cpp:3404
std::vector< lldb::TypeSystemSP > GetScratchTypeSystems(bool create_on_demand=true)
Definition Target.cpp:2651
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:2269
void AddNameToBreakpoint(BreakpointID &id, llvm::StringRef name, Status &error)
Definition Target.cpp:829
bool LoadScriptingResources(std::list< Status > &errors, Stream &feedback_stream, bool continue_on_error=true)
Definition Target.h:1117
void DumpSectionLoadList(Stream &s)
Definition Target.cpp:5353
void DeleteCurrentProcess()
Definition Target.cpp:279
BreakpointList m_internal_breakpoint_list
Definition Target.h:1792
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:2300
void DisableAllowedBreakpoints()
Definition Target.cpp:1083
bool SetSectionUnloaded(const lldb::SectionSP &section_sp)
Definition Target.cpp:3382
lldb::TargetSP CalculateTarget() override
Definition Target.cpp:2589
const lldb::ProcessSP & GetProcessSP() const
Definition Target.cpp:313
void ClearModules(bool delete_locations)
Definition Target.cpp:1563
bool RemoveBreakpointByID(lldb::break_id_t break_id)
Definition Target.cpp:1107
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:2352
static bool ResetSignalFromDummy(lldb::UnixSignalsSP signals_sp, const DummySignalElement &element)
Definition Target.cpp:3911
Architecture * GetArchitecturePlugin() const
Definition Target.h:1222
llvm::json::Value ReportStatistics(const lldb_private::StatisticsOptions &options)
Get metrics associated with this target in JSON format.
Definition Target.cpp:5339
friend class TargetList
Definition Target.h:554
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:2738
TargetStats & GetStatistics()
Definition Target.h:1869
void EnableAllBreakpoints(bool internal_also=false)
Definition Target.cpp:1090
Status Launch(ProcessLaunchInfo &launch_info, Stream *stream)
Definition Target.cpp:3427
bool DisableBreakpointByID(lldb::break_id_t break_id)
Definition Target.cpp:1127
lldb::BreakpointSP CreateBreakpointAtUserEntry(Status &error)
Definition Target.cpp:434
BreakpointName * FindBreakpointName(ConstString name, bool can_create, Status &error)
Definition Target.cpp:861
std::map< lldb::user_id_t, StopHookSP > StopHookCollection
Definition Target.h:1820
llvm::Expected< lldb::TraceSP > CreateTrace()
Create a Trace object for the current target using the using the default supported tracing technology...
Definition Target.cpp:3599
lldb::TraceSP m_trace_sp
An optional lldb_private::Trace object containing processor trace information of this target.
Definition Target.h:1838
lldb::user_id_t GetGloballyUniqueID() const
Get the globally unique ID for this target.
Definition Target.h:654
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:2322
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:3070
WatchpointList m_watchpoint_list
Definition Target.h:1798
BreakpointList m_breakpoint_list
Definition Target.h:1791
lldb::SourceManagerUP m_source_manager_up
Definition Target.h:1818
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:3322
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:2220
const llvm::DenseMap< uint32_t, ScriptedFrameProviderDescriptor > & GetScriptedFrameProviderDescriptors() const
Get all scripted frame provider descriptors for this target.
Definition Target.cpp:3769
void DeleteBreakpointName(ConstString name)
Definition Target.cpp:885
void NotifyWillClearList(const ModuleList &module_list) override
Definition Target.cpp:1821
bool SetArchitecture(const ArchSpec &arch_spec, bool set_platform=false, bool merge=true)
Set the architecture for this target.
Definition Target.cpp:1705
void NotifyModuleAdded(const ModuleList &module_list, const lldb::ModuleSP &module_sp) override
Implementing of ModuleList::Notifier.
Definition Target.cpp:1823
llvm::Expected< lldb::TypeSystemSP > GetScratchTypeSystemForLanguage(lldb::LanguageType language, bool create_on_demand=true)
Definition Target.cpp:2615
void ConfigureBreakpointName(BreakpointName &bp_name, const BreakpointOptions &options, const BreakpointName::Permissions &permissions)
Definition Target.cpp:901
lldb_private::SummaryStatisticsSP GetSummaryStatisticsSPForProviderName(lldb_private::TypeSummaryImpl &summary_provider)
Definition Target.cpp:3406
lldb::SearchFilterSP GetSearchFilterForModuleAndCUList(const FileSpecList *containingModules, const FileSpecList *containingSourceFiles)
Definition Target.cpp:707
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:3094
const lldb::ProcessSP & CreateProcess(lldb::ListenerSP listener_sp, llvm::StringRef plugin_name, const FileSpec *crash_file, bool can_connect)
Definition Target.cpp:301
void SetAllStopHooksActiveState(bool active_state)
Definition Target.cpp:3105
std::vector< StopHookSP > m_internal_stop_hooks
Definition Target.h:1823
lldb::ExpressionVariableSP GetPersistentVariable(ConstString name)
Definition Target.cpp:2917
void NotifyModulesRemoved(lldb_private::ModuleList &module_list) override
Definition Target.cpp:1855
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:3048
size_t ReadCStringFromMemory(const Address &addr, std::string &out_str, Status &error, bool force_live_memory=false)
Definition Target.cpp:2130
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:1777
std::recursive_mutex m_frame_provider_descriptors_mutex
Definition Target.h:1813
lldb::user_id_t m_target_unique_id
The globally unique ID assigned to this target.
Definition Target.h:1830
void ModulesDidUnload(ModuleList &module_list, bool delete_locations)
Definition Target.cpp:1898
void CalculateExecutionContext(ExecutionContext &exe_ctx) override
Reconstruct the object's execution context into sc.
Definition Target.cpp:2597
llvm::Expected< lldb::DisassemblerSP > ReadInstructions(const Address &start_addr, uint32_t count, const char *flavor_string=nullptr)
Definition Target.cpp:3011
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:3624
void NotifyModuleUpdated(const ModuleList &module_list, const lldb::ModuleSP &old_module_sp, const lldb::ModuleSP &new_module_sp) override
Definition Target.cpp:1843
SummaryStatisticsCache m_summary_statistics_cache
Definition Target.h:1789
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:1570
void SaveScriptedLaunchInfo(lldb_private::ProcessInfo &process_info)
Definition Target.cpp:3416
bool GetSuppressStopHooks()
Definition Target.h:1664
std::string m_label
Definition Target.h:1786
lldb::user_id_t m_stop_hook_next_id
Definition Target.h:1822
static FileSpecList GetDefaultExecutableSearchPaths()
Definition Target.cpp:2799
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:744
void NotifyBreakpointChanged(Breakpoint &bp, lldb::BreakpointEventType event_kind)
Sends a breakpoint notification event.
Definition Target.cpp:5357
lldb::SearchFilterSP GetSearchFilterForModule(const FileSpec *containingModule)
Definition Target.cpp:672
llvm::StringMapEntry< DummySignalValues > DummySignalElement
Definition Target.h:1720
std::recursive_mutex & GetAPIMutex()
Definition Target.cpp:5330
static llvm::StringRef GetStaticBroadcasterClass()
Definition Target.cpp:170
static FileSpecList GetDefaultDebugFileSearchPaths()
Definition Target.cpp:2803
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:2004
llvm::Error SetLabel(llvm::StringRef label)
Set a label for a target.
Definition Target.cpp:2818
uint32_t m_latest_stop_hook_id
Definition Target.h:1824
StackFrameRecognizerManager & GetFrameRecognizerManager()
Definition Target.h:1702
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:3129
void ClearSectionLoadList()
Definition Target.cpp:5351
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:2207
lldb::PlatformSP m_platform_sp
The platform for this target.
Definition Target.h:1776
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:2768
static TargetProperties & GetGlobalProperties()
Definition Target.cpp:3286
Status Install(ProcessLaunchInfo *launch_info)
Definition Target.cpp:3294
lldb::PlatformSP GetPlatform()
Definition Target.h:1678
void NotifyModuleRemoved(const ModuleList &module_list, const lldb::ModuleSP &module_sp) override
Definition Target.cpp:1833
lldb::BreakpointSP CreateAddressInModuleBreakpoint(lldb::addr_t file_addr, bool internal, const FileSpec &file_spec, bool request_hardware)
Definition Target.cpp:578
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:489
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:472
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:2807
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:1141
const ArchSpec & GetArchitecture() const
Definition Target.h:1183
WatchpointList & GetWatchpointList()
Definition Target.h:927
@ eBroadcastBitWatchpointChanged
Definition Target.h:562
@ eBroadcastBitBreakpointChanged
Definition Target.h:559
@ eBroadcastBitNewTargetCreated
Definition Target.h:565
unsigned m_next_persistent_variable_index
Definition Target.h:1829
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:2311
void InvalidateThreadFrameProviders()
Invalidate all potentially cached frame providers for all threads and trigger a stack changed event f...
Definition Target.cpp:3775
TargetStats m_stats
Definition Target.h:1852
bool IgnoreAllWatchpoints(uint32_t ignore_count)
Definition Target.cpp:1438
void AddBreakpoint(lldb::BreakpointSP breakpoint_sp, bool internal)
Definition Target.cpp:806
std::string m_target_session_name
The target session name for this target, used to name debugging sessions in DAP.
Definition Target.h:1833
TypeSystemMap m_scratch_type_system_map
Definition Target.h:1806
void AddBreakpointName(std::unique_ptr< BreakpointName > bp_name)
Definition Target.cpp:856
void SetTargetSessionName(llvm::StringRef target_session_name)
Set the target session name for this target.
Definition Target.h:687
SectionLoadHistory m_section_load_history
Definition Target.h:1790
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:643
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:175
size_t UnloadModuleSections(const lldb::ModuleSP &module_sp)
Definition Target.cpp:3363
llvm::StringRef GetTargetSessionName()
Get the target session name for this target.
Definition Target.h:675
llvm::DenseMap< uint32_t, ScriptedFrameProviderDescriptor > m_frame_provider_descriptors
Map of scripted frame provider descriptors for this target.
Definition Target.h:1812
const std::string & GetLabel() const
Definition Target.h:656
bool m_valid
This records the last natural stop at which we ran a stop-hook.
Definition Target.h:1826
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:3869
void ClearScriptedFrameProviderDescriptors()
Clear all scripted frame provider descriptors for this target.
Definition Target.cpp:3758
std::map< ConstString, std::unique_ptr< BreakpointName > > BreakpointNameList
Definition Target.h:1793
lldb::WatchpointSP m_last_created_watchpoint
Definition Target.h:1799
Status CreateBreakpointsFromFile(const FileSpec &file, BreakpointIDList &new_bps)
Definition Target.cpp:1260
Debugger & m_debugger
Definition Target.h:1775
void SetREPL(lldb::LanguageType language, lldb::REPLSP repl_sp)
Definition Target.cpp:366
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:1576
lldb::StackFrameRecognizerManagerUP m_frame_recognizer_manager_up
Stores the frame recognizers of this target.
Definition Target.h:1840
lldb::REPLSP GetREPL(Status &err, lldb::LanguageType language, const char *repl_options, bool can_create)
Definition Target.cpp:315
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:2705
ModuleList m_images
The list of images for this process (shared libraries and anything dynamically loaded).
Definition Target.h:1787
lldb::ProcessSP CalculateProcess() override
Definition Target.cpp:2591
void PrintDummySignals(Stream &strm, Args &signals)
Print all the signals set in this target.
Definition Target.cpp:3963
void SetPlatform(const lldb::PlatformSP &platform_sp)
Definition Target.h:1680
bool SetSectionLoadAddress(const lldb::SectionSP &section, lldb::addr_t load_addr, bool warn_multiple=false)
Definition Target.cpp:3333
Status Attach(ProcessAttachInfo &attach_info, Stream *stream)
Definition Target.cpp:3630
std::map< lldb::LanguageType, lldb::REPLSP > REPLMap
Definition Target.h:1815
static void SetDefaultArchitecture(const ArchSpec &arch)
Definition Target.cpp:2811
lldb::BreakpointSP m_last_created_breakpoint
Definition Target.h:1797
lldb::WatchpointSP GetLastCreatedWatchpoint()
Definition Target.h:923
void RemoveNameFromBreakpoint(lldb::BreakpointSP &bp_sp, ConstString name)
Definition Target.cpp:896
bool RemoveStopHookByID(lldb::user_id_t uid)
Definition Target.cpp:3077
friend class Debugger
Definition Target.h:555
lldb::BreakpointSP GetLastCreatedBreakpoint()
Definition Target.h:815
static void SettingsInitialize()
Definition Target.cpp:2795
~Target() override
Definition Target.cpp:214
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:1784
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:2849
bool MergeArchitecture(const ArchSpec &arch_spec)
Definition Target.cpp:1796
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:56
@ eLoadScriptFromSymFileTrue
Definition Target.h:57
@ eLoadScriptFromSymFileFalse
Definition Target.h:58
@ eLoadScriptFromSymFileWarn
Definition Target.h:59
ExecutionPolicy
Expression execution policies.
DynamicClassInfoHelper
Definition Target.h:74
@ eDynamicClassInfoHelperCopyRealizedClassList
Definition Target.h:77
@ eDynamicClassInfoHelperGetRealizedClassList
Definition Target.h:78
@ eDynamicClassInfoHelperAuto
Definition Target.h:75
@ eDynamicClassInfoHelperRealizedClassesStruct
Definition Target.h:76
OptionEnumValues GetDynamicValueTypes()
Definition Target.cpp:4248
@ eImportStdModuleFalse
Definition Target.h:69
@ eImportStdModuleFallback
Definition Target.h:70
@ eImportStdModuleTrue
Definition Target.h:71
LoadCWDlldbinitFile
Definition Target.h:62
@ eLoadCWDlldbinitTrue
Definition Target.h:63
@ eLoadCWDlldbinitFalse
Definition Target.h:64
@ eLoadCWDlldbinitWarn
Definition Target.h:65
llvm::ArrayRef< OptionEnumValueElement > OptionEnumValues
@ eInlineBreakpointsNever
Definition Target.h:51
@ eInlineBreakpointsAlways
Definition Target.h:53
@ eInlineBreakpointsHeaders
Definition Target.h:52
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
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:1716
UserID(lldb::user_id_t uid=LLDB_INVALID_UID)
Construct with optional user ID.
Definition UserID.h:33