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
38#include "lldb/lldb-public.h"
39
40namespace lldb_private {
41
43
48};
49
54};
55
60};
61
66};
67
73};
74
76public:
78};
79
81public:
82 TargetProperties(Target *target);
83
85
87
88 void SetDefaultArchitecture(const ArchSpec &arch);
89
90 bool GetMoveToNearestCode() const;
91
93
95
96 bool GetPreloadSymbols() const;
97
98 void SetPreloadSymbols(bool b);
99
100 bool GetDisableASLR() const;
101
102 void SetDisableASLR(bool b);
103
104 bool GetInheritTCC() const;
105
106 void SetInheritTCC(bool b);
107
108 bool GetDetachOnError() const;
109
110 void SetDetachOnError(bool b);
111
112 bool GetDisableSTDIO() const;
113
114 void SetDisableSTDIO(bool b);
115
116 const char *GetDisassemblyFlavor() const;
117
119
120 llvm::StringRef GetArg0() const;
121
122 void SetArg0(llvm::StringRef arg);
123
124 bool GetRunArguments(Args &args) const;
125
126 void SetRunArguments(const Args &args);
127
128 // Get the whole environment including the platform inherited environment and
129 // the target specific environment, excluding the unset environment variables.
131 // Get the platform inherited environment, excluding the unset environment
132 // variables.
134 // Get the target specific environment only, without the platform inherited
135 // environment.
137 // Set the target specific environment.
138 void SetEnvironment(Environment env);
139
140 bool GetSkipPrologue() const;
141
143
144 bool GetAutoSourceMapRelative() const;
145
147
149
151
153
155
157
159
160 bool GetEnableAutoApplyFixIts() const;
161
162 uint64_t GetNumberOfRetriesWithFixits() const;
163
164 bool GetEnableNotifyAboutFixIts() const;
165
167
168 bool GetEnableSyntheticValue() const;
169
171
172 uint32_t GetMaxZeroPaddingInFloatFormat() const;
173
175
176 /// Get the max depth value, augmented with a bool to indicate whether the
177 /// depth is the default.
178 ///
179 /// When the user has customized the max depth, the bool will be false.
180 ///
181 /// \returns the max depth, and true if the max depth is the system default,
182 /// otherwise false.
183 std::pair<uint32_t, bool> GetMaximumDepthOfChildrenToDisplay() const;
184
185 uint32_t GetMaximumSizeOfStringSummary() const;
186
187 uint32_t GetMaximumMemReadSize() const;
188
192
193 void SetStandardInputPath(llvm::StringRef path);
194 void SetStandardOutputPath(llvm::StringRef path);
195 void SetStandardErrorPath(llvm::StringRef path);
196
197 void SetStandardInputPath(const char *path) = delete;
198 void SetStandardOutputPath(const char *path) = delete;
199 void SetStandardErrorPath(const char *path) = delete;
200
202
204
205 llvm::StringRef GetExpressionPrefixContents();
206
207 uint64_t GetExprErrorLimit() const;
208
209 uint64_t GetExprAllocAddress() const;
210
211 uint64_t GetExprAllocSize() const;
212
213 uint64_t GetExprAllocAlign() const;
214
215 bool GetUseHexImmediates() const;
216
217 bool GetUseFastStepping() const;
218
220
222
224
226
228
229 bool GetUserSpecifiedTrapHandlerNames(Args &args) const;
230
231 void SetUserSpecifiedTrapHandlerNames(const Args &args);
232
234
236
238
240
242
243 void SetProcessLaunchInfo(const ProcessLaunchInfo &launch_info);
244
245 bool GetInjectLocalVariables(ExecutionContext *exe_ctx) const;
246
248
250
251 bool GetAutoInstallMainExecutable() const;
252
254
255 void SetDebugUtilityExpression(bool debug);
256
257 bool GetDebugUtilityExpression() const;
258
259private:
260 std::optional<bool>
261 GetExperimentalPropertyValue(size_t prop_idx,
262 ExecutionContext *exe_ctx = nullptr) const;
263
264 // Callbacks for m_launch_info.
275
276 // Settings checker for target.jit-save-objects-dir:
277 void CheckJITObjectsDir();
278
280
281 // Member variables.
283 std::unique_ptr<TargetExperimentalProperties> m_experimental_properties_up;
285};
286
288public:
289// MSVC has a bug here that reports C4268: 'const' static/global data
290// initialized with compiler generated default constructor fills the object
291// with zeros. Confirmed that MSVC is *not* zero-initializing, it's just a
292// bogus warning.
293#if defined(_MSC_VER)
294#pragma warning(push)
295#pragma warning(disable : 4268)
296#endif
297 static constexpr std::chrono::milliseconds default_timeout{500};
298#if defined(_MSC_VER)
299#pragma warning(pop)
300#endif
301
304
306
308
310 m_execution_policy = policy;
311 }
312
314
315 void SetLanguage(lldb::LanguageType language_type) {
316 m_language = SourceLanguage(language_type);
317 }
318
319 /// Set the language using a pair of language code and version as
320 /// defined by the DWARF 6 specification.
321 /// WARNING: These codes may change until DWARF 6 is finalized.
322 void SetLanguage(uint16_t name, uint32_t version) {
323 m_language = SourceLanguage(name, version);
324 }
325
326 bool DoesCoerceToId() const { return m_coerce_to_id; }
327
328 const char *GetPrefix() const {
329 return (m_prefix.empty() ? nullptr : m_prefix.c_str());
330 }
331
332 void SetPrefix(const char *prefix) {
333 if (prefix && prefix[0])
334 m_prefix = prefix;
335 else
336 m_prefix.clear();
337 }
338
339 void SetCoerceToId(bool coerce = true) { m_coerce_to_id = coerce; }
340
341 bool DoesUnwindOnError() const { return m_unwind_on_error; }
342
343 void SetUnwindOnError(bool unwind = false) { m_unwind_on_error = unwind; }
344
346
347 void SetIgnoreBreakpoints(bool ignore = false) {
348 m_ignore_breakpoints = ignore;
349 }
350
351 bool DoesKeepInMemory() const { return m_keep_in_memory; }
352
353 void SetKeepInMemory(bool keep = true) { m_keep_in_memory = keep; }
354
356
357 void
359 m_use_dynamic = dynamic;
360 }
361
362 const Timeout<std::micro> &GetTimeout() const { return m_timeout; }
363
364 void SetTimeout(const Timeout<std::micro> &timeout) { m_timeout = timeout; }
365
368 }
369
371 m_one_thread_timeout = timeout;
372 }
373
374 bool GetTryAllThreads() const { return m_try_others; }
375
376 void SetTryAllThreads(bool try_others = true) { m_try_others = try_others; }
377
378 bool GetStopOthers() const { return m_stop_others; }
379
380 void SetStopOthers(bool stop_others = true) { m_stop_others = stop_others; }
381
382 bool GetDebug() const { return m_debug; }
383
384 void SetDebug(bool b) {
385 m_debug = b;
386 if (m_debug)
388 }
389
391
393
394 bool GetColorizeErrors() const { return m_ansi_color_errors; }
395
397
398 bool GetTrapExceptions() const { return m_trap_exceptions; }
399
401
402 bool GetREPLEnabled() const { return m_repl; }
403
404 void SetREPLEnabled(bool b) { m_repl = b; }
405
408 m_cancel_callback = callback;
409 }
410
412 return ((m_cancel_callback != nullptr)
414 : false);
415 }
416
417 // Allows the expression contents to be remapped to point to the specified
418 // file and line using #line directives.
419 void SetPoundLine(const char *path, uint32_t line) const {
420 if (path && path[0]) {
421 m_pound_line_file = path;
422 m_pound_line_line = line;
423 } else {
424 m_pound_line_file.clear();
426 }
427 }
428
429 const char *GetPoundLineFilePath() const {
430 return (m_pound_line_file.empty() ? nullptr : m_pound_line_file.c_str());
431 }
432
433 uint32_t GetPoundLineLine() const { return m_pound_line_line; }
434
436
439 }
440
442
444
445 void SetRetriesWithFixIts(uint64_t number_of_retries) {
446 m_retries_with_fixits = number_of_retries;
447 }
448
449 uint64_t GetRetriesWithFixIts() const { return m_retries_with_fixits; }
450
452
454
455private:
458 std::string m_prefix;
459 bool m_coerce_to_id = false;
460 bool m_unwind_on_error = true;
462 bool m_keep_in_memory = false;
463 bool m_try_others = true;
464 bool m_stop_others = true;
465 bool m_debug = false;
466 bool m_trap_exceptions = true;
467 bool m_repl = false;
473 /// True if the executed code should be treated as utility code that is only
474 /// used by LLDB internally.
476
481 void *m_cancel_callback_baton = nullptr;
482 // If m_pound_line_file is not empty and m_pound_line_line is non-zero, use
483 // #line %u "%s" before the expression content to remap where the source
484 // originates
485 mutable std::string m_pound_line_file;
486 mutable uint32_t m_pound_line_line = 0;
487};
488
489// Target
490class Target : public std::enable_shared_from_this<Target>,
491 public TargetProperties,
492 public Broadcaster,
494 public ModuleList::Notifier {
495public:
496 friend class TargetList;
497 friend class Debugger;
498
499 /// Broadcaster event bits definitions.
500 enum {
507 };
508
509 // These two functions fill out the Broadcaster interface:
510
511 static llvm::StringRef GetStaticBroadcasterClass();
512
513 llvm::StringRef GetBroadcasterClass() const override {
515 }
516
517 // This event data class is for use by the TargetList to broadcast new target
518 // notifications.
519 class TargetEventData : public EventData {
520 public:
521 TargetEventData(const lldb::TargetSP &target_sp);
522
523 TargetEventData(const lldb::TargetSP &target_sp,
524 const ModuleList &module_list);
525
527
528 static llvm::StringRef GetFlavorString();
529
530 llvm::StringRef GetFlavor() const override {
532 }
533
534 void Dump(Stream *s) const override;
535
536 static const TargetEventData *GetEventDataFromEvent(const Event *event_ptr);
537
538 static lldb::TargetSP GetTargetFromEvent(const Event *event_ptr);
539
540 static ModuleList GetModuleListFromEvent(const Event *event_ptr);
541
542 const lldb::TargetSP &GetTarget() const { return m_target_sp; }
543
544 const ModuleList &GetModuleList() const { return m_module_list; }
545
546 private:
549
551 const TargetEventData &operator=(const TargetEventData &) = delete;
552 };
553
554 ~Target() override;
555
556 static void SettingsInitialize();
557
558 static void SettingsTerminate();
559
561
563
565
566 static void SetDefaultArchitecture(const ArchSpec &arch);
567
568 bool IsDummyTarget() const { return m_is_dummy_target; }
569
570 const std::string &GetLabel() const { return m_label; }
571
572 /// Set a label for a target.
573 ///
574 /// The label cannot be used by another target or be only integral.
575 ///
576 /// \return
577 /// The label for this target or an error if the label didn't match the
578 /// requirements.
579 llvm::Error SetLabel(llvm::StringRef label);
580
581 /// Find a binary on the system and return its Module,
582 /// or return an existing Module that is already in the Target.
583 ///
584 /// Given a ModuleSpec, find a binary satisifying that specification,
585 /// or identify a matching Module already present in the Target,
586 /// and return a shared pointer to it.
587 ///
588 /// \param[in] module_spec
589 /// The criteria that must be matched for the binary being loaded.
590 /// e.g. UUID, architecture, file path.
591 ///
592 /// \param[in] notify
593 /// If notify is true, and the Module is new to this Target,
594 /// Target::ModulesDidLoad will be called.
595 /// If notify is false, it is assumed that the caller is adding
596 /// multiple Modules and will call ModulesDidLoad with the
597 /// full list at the end.
598 /// ModulesDidLoad must be called when a Module/Modules have
599 /// been added to the target, one way or the other.
600 ///
601 /// \param[out] error_ptr
602 /// Optional argument, pointing to a Status object to fill in
603 /// with any results / messages while attempting to find/load
604 /// this binary. Many callers will be internal functions that
605 /// will handle / summarize the failures in a custom way and
606 /// don't use these messages.
607 ///
608 /// \return
609 /// An empty ModuleSP will be returned if no matching file
610 /// was found. If error_ptr was non-nullptr, an error message
611 /// will likely be provided.
612 lldb::ModuleSP GetOrCreateModule(const ModuleSpec &module_spec, bool notify,
613 Status *error_ptr = nullptr);
614
615 // Settings accessors
616
618
619 std::recursive_mutex &GetAPIMutex();
620
622
623 void CleanupProcess();
624
625 /// Dump a description of this object to a Stream.
626 ///
627 /// Dump a description of the contents of this object to the
628 /// supplied stream \a s. The dumped content will be only what has
629 /// been loaded or parsed up to this point at which this function
630 /// is called, so this is a good way to see what has been parsed
631 /// in a target.
632 ///
633 /// \param[in] s
634 /// The stream to which to dump the object description.
635 void Dump(Stream *s, lldb::DescriptionLevel description_level);
636
637 // If listener_sp is null, the listener of the owning Debugger object will be
638 // used.
640 llvm::StringRef plugin_name,
641 const FileSpec *crash_file,
642 bool can_connect);
643
644 const lldb::ProcessSP &GetProcessSP() const;
645
646 bool IsValid() { return m_valid; }
647
648 void Destroy();
649
650 Status Launch(ProcessLaunchInfo &launch_info,
651 Stream *stream); // Optional stream to receive first stop info
652
653 Status Attach(ProcessAttachInfo &attach_info,
654 Stream *stream); // Optional stream to receive first stop info
655
656 // This part handles the breakpoints.
657
658 BreakpointList &GetBreakpointList(bool internal = false);
659
660 const BreakpointList &GetBreakpointList(bool internal = false) const;
661
664 }
665
667
669
670 // Use this to create a file and line breakpoint to a given module or all
671 // module it is nullptr
672 lldb::BreakpointSP CreateBreakpoint(const FileSpecList *containingModules,
673 const FileSpec &file, uint32_t line_no,
674 uint32_t column, lldb::addr_t offset,
675 LazyBool check_inlines,
676 LazyBool skip_prologue, bool internal,
677 bool request_hardware,
678 LazyBool move_to_nearest_code);
679
680 // Use this to create breakpoint that matches regex against the source lines
681 // in files given in source_file_list: If function_names is non-empty, also
682 // filter by function after the matches are made.
684 const FileSpecList *containingModules,
685 const FileSpecList *source_file_list,
686 const std::unordered_set<std::string> &function_names,
687 RegularExpression source_regex, bool internal, bool request_hardware,
688 LazyBool move_to_nearest_code);
689
690 // Use this to create a breakpoint from a load address
691 lldb::BreakpointSP CreateBreakpoint(lldb::addr_t load_addr, bool internal,
692 bool request_hardware);
693
694 // Use this to create a breakpoint from a load address and a module file spec
696 bool internal,
697 const FileSpec &file_spec,
698 bool request_hardware);
699
700 // Use this to create Address breakpoints:
701 lldb::BreakpointSP CreateBreakpoint(const Address &addr, bool internal,
702 bool request_hardware);
703
704 // Use this to create a function breakpoint by regexp in
705 // containingModule/containingSourceFiles, or all modules if it is nullptr
706 // When "skip_prologue is set to eLazyBoolCalculate, we use the current
707 // target setting, else we use the values passed in
709 const FileSpecList *containingModules,
710 const FileSpecList *containingSourceFiles, RegularExpression func_regexp,
711 lldb::LanguageType requested_language, LazyBool skip_prologue,
712 bool internal, bool request_hardware);
713
714 // Use this to create a function breakpoint by name in containingModule, or
715 // all modules if it is nullptr When "skip_prologue is set to
716 // eLazyBoolCalculate, we use the current target setting, else we use the
717 // values passed in. func_name_type_mask is or'ed values from the
718 // FunctionNameType enum.
720 const FileSpecList *containingModules,
721 const FileSpecList *containingSourceFiles, const char *func_name,
722 lldb::FunctionNameType func_name_type_mask, lldb::LanguageType language,
723 lldb::addr_t offset, LazyBool skip_prologue, bool internal,
724 bool request_hardware);
725
727 CreateExceptionBreakpoint(enum lldb::LanguageType language, bool catch_bp,
728 bool throw_bp, bool internal,
729 Args *additional_args = nullptr,
730 Status *additional_args_error = nullptr);
731
733 const llvm::StringRef class_name, const FileSpecList *containingModules,
734 const FileSpecList *containingSourceFiles, bool internal,
735 bool request_hardware, StructuredData::ObjectSP extra_args_sp,
736 Status *creation_error = nullptr);
737
738 // This is the same as the func_name breakpoint except that you can specify a
739 // vector of names. This is cheaper than a regular expression breakpoint in
740 // the case where you just want to set a breakpoint on a set of names you
741 // already know. func_name_type_mask is or'ed values from the
742 // FunctionNameType enum.
744 const FileSpecList *containingModules,
745 const FileSpecList *containingSourceFiles, const char *func_names[],
746 size_t num_names, lldb::FunctionNameType func_name_type_mask,
747 lldb::LanguageType language, lldb::addr_t offset, LazyBool skip_prologue,
748 bool internal, bool request_hardware);
749
751 CreateBreakpoint(const FileSpecList *containingModules,
752 const FileSpecList *containingSourceFiles,
753 const std::vector<std::string> &func_names,
754 lldb::FunctionNameType func_name_type_mask,
755 lldb::LanguageType language, lldb::addr_t m_offset,
756 LazyBool skip_prologue, bool internal,
757 bool request_hardware);
758
759 // Use this to create a general breakpoint:
761 lldb::BreakpointResolverSP &resolver_sp,
762 bool internal, bool request_hardware,
763 bool resolve_indirect_symbols);
764
765 // Use this to create a watchpoint:
767 const CompilerType *type, uint32_t kind,
768 Status &error);
769
772 }
773
775
776 // Manages breakpoint names:
777 void AddNameToBreakpoint(BreakpointID &id, llvm::StringRef name,
778 Status &error);
779
780 void AddNameToBreakpoint(lldb::BreakpointSP &bp_sp, llvm::StringRef name,
781 Status &error);
782
784
785 BreakpointName *FindBreakpointName(ConstString name, bool can_create,
786 Status &error);
787
789
791 const BreakpointOptions &options,
792 const BreakpointName::Permissions &permissions);
794
795 void AddBreakpointName(std::unique_ptr<BreakpointName> bp_name);
796
797 void GetBreakpointNames(std::vector<std::string> &names);
798
799 // This call removes ALL breakpoints regardless of permission.
800 void RemoveAllBreakpoints(bool internal_also = false);
801
802 // This removes all the breakpoints, but obeys the ePermDelete on them.
804
805 void DisableAllBreakpoints(bool internal_also = false);
806
808
809 void EnableAllBreakpoints(bool internal_also = false);
810
812
814
816
818
819 /// Resets the hit count of all breakpoints.
821
822 // The flag 'end_to_end', default to true, signifies that the operation is
823 // performed end to end, for both the debugger and the debuggee.
824
825 bool RemoveAllWatchpoints(bool end_to_end = true);
826
827 bool DisableAllWatchpoints(bool end_to_end = true);
828
829 bool EnableAllWatchpoints(bool end_to_end = true);
830
832
834
835 bool IgnoreAllWatchpoints(uint32_t ignore_count);
836
838
840
842
843 bool IgnoreWatchpointByID(lldb::watch_id_t watch_id, uint32_t ignore_count);
844
846 const BreakpointIDList &bp_ids,
847 bool append);
848
850 BreakpointIDList &new_bps);
851
853 std::vector<std::string> &names,
854 BreakpointIDList &new_bps);
855
856 /// Get \a load_addr as a callable code load address for this target
857 ///
858 /// Take \a load_addr and potentially add any address bits that are
859 /// needed to make the address callable. For ARM this can set bit
860 /// zero (if it already isn't) if \a load_addr is a thumb function.
861 /// If \a addr_class is set to AddressClass::eInvalid, then the address
862 /// adjustment will always happen. If it is set to an address class
863 /// that doesn't have code in it, LLDB_INVALID_ADDRESS will be
864 /// returned.
866 lldb::addr_t load_addr,
867 AddressClass addr_class = AddressClass::eInvalid) const;
868
869 /// Get \a load_addr as an opcode for this target.
870 ///
871 /// Take \a load_addr and potentially strip any address bits that are
872 /// needed to make the address point to an opcode. For ARM this can
873 /// clear bit zero (if it already isn't) if \a load_addr is a
874 /// thumb function and load_addr is in code.
875 /// If \a addr_class is set to AddressClass::eInvalid, then the address
876 /// adjustment will always happen. If it is set to an address class
877 /// that doesn't have code in it, LLDB_INVALID_ADDRESS will be
878 /// returned.
881 AddressClass addr_class = AddressClass::eInvalid) const;
882
883 // Get load_addr as breakable load address for this target. Take a addr and
884 // check if for any reason there is a better address than this to put a
885 // breakpoint on. If there is then return that address. For MIPS, if
886 // instruction at addr is a delay slot instruction then this method will find
887 // the address of its previous instruction and return that address.
889
890 void ModulesDidLoad(ModuleList &module_list);
891
892 void ModulesDidUnload(ModuleList &module_list, bool delete_locations);
893
894 void SymbolsDidLoad(ModuleList &module_list);
895
896 void ClearModules(bool delete_locations);
897
898 /// Called as the last function in Process::DidExec().
899 ///
900 /// Process::DidExec() will clear a lot of state in the process,
901 /// then try to reload a dynamic loader plugin to discover what
902 /// binaries are currently available and then this function should
903 /// be called to allow the target to do any cleanup after everything
904 /// has been figured out. It can remove breakpoints that no longer
905 /// make sense as the exec might have changed the target
906 /// architecture, and unloaded some modules that might get deleted.
907 void DidExec();
908
909 /// Gets the module for the main executable.
910 ///
911 /// Each process has a notion of a main executable that is the file
912 /// that will be executed or attached to. Executable files can have
913 /// dependent modules that are discovered from the object files, or
914 /// discovered at runtime as things are dynamically loaded.
915 ///
916 /// \return
917 /// The shared pointer to the executable module which can
918 /// contains a nullptr Module object if no executable has been
919 /// set.
920 ///
921 /// \see DynamicLoader
922 /// \see ObjectFile::GetDependentModules (FileSpecList&)
923 /// \see Process::SetExecutableModule(lldb::ModuleSP&)
925
927
928 /// Set the main executable module.
929 ///
930 /// Each process has a notion of a main executable that is the file
931 /// that will be executed or attached to. Executable files can have
932 /// dependent modules that are discovered from the object files, or
933 /// discovered at runtime as things are dynamically loaded.
934 ///
935 /// Setting the executable causes any of the current dependent
936 /// image information to be cleared and replaced with the static
937 /// dependent image information found by calling
938 /// ObjectFile::GetDependentModules (FileSpecList&) on the main
939 /// executable and any modules on which it depends. Calling
940 /// Process::GetImages() will return the newly found images that
941 /// were obtained from all of the object files.
942 ///
943 /// \param[in] module_sp
944 /// A shared pointer reference to the module that will become
945 /// the main executable for this process.
946 ///
947 /// \param[in] load_dependent_files
948 /// If \b true then ask the object files to track down any
949 /// known dependent files.
950 ///
951 /// \see ObjectFile::GetDependentModules (FileSpecList&)
952 /// \see Process::GetImages()
954 lldb::ModuleSP &module_sp,
955 LoadDependentFiles load_dependent_files = eLoadDependentsDefault);
956
957 bool LoadScriptingResources(std::list<Status> &errors,
958 Stream &feedback_stream,
959 bool continue_on_error = true) {
961 this, errors, feedback_stream, continue_on_error);
962 }
963
964 /// Get accessor for the images for this process.
965 ///
966 /// Each process has a notion of a main executable that is the file
967 /// that will be executed or attached to. Executable files can have
968 /// dependent modules that are discovered from the object files, or
969 /// discovered at runtime as things are dynamically loaded. After
970 /// a main executable has been set, the images will contain a list
971 /// of all the files that the executable depends upon as far as the
972 /// object files know. These images will usually contain valid file
973 /// virtual addresses only. When the process is launched or attached
974 /// to, the DynamicLoader plug-in will discover where these images
975 /// were loaded in memory and will resolve the load virtual
976 /// addresses is each image, and also in images that are loaded by
977 /// code.
978 ///
979 /// \return
980 /// A list of Module objects in a module list.
981 const ModuleList &GetImages() const { return m_images; }
982
984
985 /// Return whether this FileSpec corresponds to a module that should be
986 /// considered for general searches.
987 ///
988 /// This API will be consulted by the SearchFilterForUnconstrainedSearches
989 /// and any module that returns \b true will not be searched. Note the
990 /// SearchFilterForUnconstrainedSearches is the search filter that
991 /// gets used in the CreateBreakpoint calls when no modules is provided.
992 ///
993 /// The target call at present just consults the Platform's call of the
994 /// same name.
995 ///
996 /// \param[in] module_spec
997 /// Path to the module.
998 ///
999 /// \return \b true if the module should be excluded, \b false otherwise.
1000 bool ModuleIsExcludedForUnconstrainedSearches(const FileSpec &module_spec);
1001
1002 /// Return whether this module should be considered for general searches.
1003 ///
1004 /// This API will be consulted by the SearchFilterForUnconstrainedSearches
1005 /// and any module that returns \b true will not be searched. Note the
1006 /// SearchFilterForUnconstrainedSearches is the search filter that
1007 /// gets used in the CreateBreakpoint calls when no modules is provided.
1008 ///
1009 /// The target call at present just consults the Platform's call of the
1010 /// same name.
1011 ///
1012 /// FIXME: When we get time we should add a way for the user to set modules
1013 /// that they
1014 /// don't want searched, in addition to or instead of the platform ones.
1015 ///
1016 /// \param[in] module_sp
1017 /// A shared pointer reference to the module that checked.
1018 ///
1019 /// \return \b true if the module should be excluded, \b false otherwise.
1020 bool
1022
1023 const ArchSpec &GetArchitecture() const { return m_arch.GetSpec(); }
1024
1025 /// Returns the name of the target's ABI plugin.
1026 llvm::StringRef GetABIName() const;
1027
1028 /// Set the architecture for this target.
1029 ///
1030 /// If the current target has no Images read in, then this just sets the
1031 /// architecture, which will be used to select the architecture of the
1032 /// ExecutableModule when that is set. If the current target has an
1033 /// ExecutableModule, then calling SetArchitecture with a different
1034 /// architecture from the currently selected one will reset the
1035 /// ExecutableModule to that slice of the file backing the ExecutableModule.
1036 /// If the file backing the ExecutableModule does not contain a fork of this
1037 /// architecture, then this code will return false, and the architecture
1038 /// won't be changed. If the input arch_spec is the same as the already set
1039 /// architecture, this is a no-op.
1040 ///
1041 /// \param[in] arch_spec
1042 /// The new architecture.
1043 ///
1044 /// \param[in] set_platform
1045 /// If \b true, then the platform will be adjusted if the currently
1046 /// selected platform is not compatible with the architecture being set.
1047 /// If \b false, then just the architecture will be set even if the
1048 /// currently selected platform isn't compatible (in case it might be
1049 /// manually set following this function call).
1050 ///
1051 /// \param[in] merged
1052 /// If true, arch_spec is merged with the current
1053 /// architecture. Otherwise it's replaced.
1054 ///
1055 /// \return
1056 /// \b true if the architecture was successfully set, \b false otherwise.
1057 bool SetArchitecture(const ArchSpec &arch_spec, bool set_platform = false,
1058 bool merge = true);
1059
1060 bool MergeArchitecture(const ArchSpec &arch_spec);
1061
1063
1065
1066 size_t ReadMemoryFromFileCache(const Address &addr, void *dst, size_t dst_len,
1067 Status &error);
1068
1069 // Reading memory through the target allows us to skip going to the process
1070 // for reading memory if possible and it allows us to try and read from any
1071 // constant sections in our object files on disk. If you always want live
1072 // program memory, read straight from the process. If you possibly want to
1073 // read from const sections in object files, read from the target. This
1074 // version of ReadMemory will try and read memory from the process if the
1075 // process is alive. The order is:
1076 // 1 - if (force_live_memory == false) and the address falls in a read-only
1077 // section, then read from the file cache
1078 // 2 - if there is a process, then read from memory
1079 // 3 - if there is no process, then read from the file cache
1080 //
1081 // The method is virtual for mocking in the unit tests.
1082 virtual size_t ReadMemory(const Address &addr, void *dst, size_t dst_len,
1083 Status &error, bool force_live_memory = false,
1084 lldb::addr_t *load_addr_ptr = nullptr);
1085
1086 size_t ReadCStringFromMemory(const Address &addr, std::string &out_str,
1087 Status &error, bool force_live_memory = false);
1088
1089 size_t ReadCStringFromMemory(const Address &addr, char *dst,
1090 size_t dst_max_len, Status &result_error,
1091 bool force_live_memory = false);
1092
1093 /// Read a NULL terminated string from memory
1094 ///
1095 /// This function will read a cache page at a time until a NULL string
1096 /// terminator is found. It will stop reading if an aligned sequence of NULL
1097 /// termination \a type_width bytes is not found before reading \a
1098 /// cstr_max_len bytes. The results are always guaranteed to be NULL
1099 /// terminated, and that no more than (max_bytes - type_width) bytes will be
1100 /// read.
1101 ///
1102 /// \param[in] addr
1103 /// The address to start the memory read.
1104 ///
1105 /// \param[in] dst
1106 /// A character buffer containing at least max_bytes.
1107 ///
1108 /// \param[in] max_bytes
1109 /// The maximum number of bytes to read.
1110 ///
1111 /// \param[in] error
1112 /// The error status of the read operation.
1113 ///
1114 /// \param[in] type_width
1115 /// The size of the null terminator (1 to 4 bytes per
1116 /// character). Defaults to 1.
1117 ///
1118 /// \return
1119 /// The error status or the number of bytes prior to the null terminator.
1120 size_t ReadStringFromMemory(const Address &addr, char *dst, size_t max_bytes,
1121 Status &error, size_t type_width,
1122 bool force_live_memory = true);
1123
1124 size_t ReadScalarIntegerFromMemory(const Address &addr, uint32_t byte_size,
1125 bool is_signed, Scalar &scalar,
1126 Status &error,
1127 bool force_live_memory = false);
1128
1129 uint64_t ReadUnsignedIntegerFromMemory(const Address &addr,
1130 size_t integer_byte_size,
1131 uint64_t fail_value, Status &error,
1132 bool force_live_memory = false);
1133
1134 bool ReadPointerFromMemory(const Address &addr, Status &error,
1135 Address &pointer_addr,
1136 bool force_live_memory = false);
1137
1140 }
1141
1142 static Target *GetTargetFromContexts(const ExecutionContext *exe_ctx_ptr,
1143 const SymbolContext *sc_ptr);
1144
1145 // lldb::ExecutionContextScope pure virtual functions
1147
1149
1151
1153
1154 void CalculateExecutionContext(ExecutionContext &exe_ctx) override;
1155
1157
1158 llvm::Expected<lldb::TypeSystemSP>
1160 bool create_on_demand = true);
1161
1162 std::vector<lldb::TypeSystemSP>
1163 GetScratchTypeSystems(bool create_on_demand = true);
1164
1167
1168 // Creates a UserExpression for the given language, the rest of the
1169 // parameters have the same meaning as for the UserExpression constructor.
1170 // Returns a new-ed object which the caller owns.
1171
1173 GetUserExpressionForLanguage(llvm::StringRef expr, llvm::StringRef prefix,
1174 SourceLanguage language,
1175 Expression::ResultType desired_type,
1176 const EvaluateExpressionOptions &options,
1177 ValueObject *ctx_obj, Status &error);
1178
1179 // Creates a FunctionCaller for the given language, the rest of the
1180 // parameters have the same meaning as for the FunctionCaller constructor.
1181 // Since a FunctionCaller can't be
1182 // IR Interpreted, it makes no sense to call this with an
1183 // ExecutionContextScope that lacks
1184 // a Process.
1185 // Returns a new-ed object which the caller owns.
1186
1188 const CompilerType &return_type,
1189 const Address &function_address,
1190 const ValueList &arg_value_list,
1191 const char *name, Status &error);
1192
1193 /// Creates and installs a UtilityFunction for the given language.
1194 llvm::Expected<std::unique_ptr<UtilityFunction>>
1195 CreateUtilityFunction(std::string expression, std::string name,
1196 lldb::LanguageType language, ExecutionContext &exe_ctx);
1197
1198 // Install any files through the platform that need be to installed prior to
1199 // launching or attaching.
1200 Status Install(ProcessLaunchInfo *launch_info);
1201
1202 bool ResolveFileAddress(lldb::addr_t load_addr, Address &so_addr);
1203
1204 bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr,
1205 uint32_t stop_id = SectionLoadHistory::eStopIDNow);
1206
1207 bool SetSectionLoadAddress(const lldb::SectionSP &section,
1208 lldb::addr_t load_addr,
1209 bool warn_multiple = false);
1210
1211 size_t UnloadModuleSections(const lldb::ModuleSP &module_sp);
1212
1213 size_t UnloadModuleSections(const ModuleList &module_list);
1214
1215 bool SetSectionUnloaded(const lldb::SectionSP &section_sp);
1216
1217 bool SetSectionUnloaded(const lldb::SectionSP &section_sp,
1218 lldb::addr_t load_addr);
1219
1221
1222 /// Set the \a Trace object containing processor trace information of this
1223 /// target.
1224 ///
1225 /// \param[in] trace_sp
1226 /// The trace object.
1227 void SetTrace(const lldb::TraceSP &trace_sp);
1228
1229 /// Get the \a Trace object containing processor trace information of this
1230 /// target.
1231 ///
1232 /// \return
1233 /// The trace object. It might be undefined.
1235
1236 /// Create a \a Trace object for the current target using the using the
1237 /// default supported tracing technology for this process.
1238 ///
1239 /// \return
1240 /// The new \a Trace or an \a llvm::Error if a \a Trace already exists or
1241 /// the trace couldn't be created.
1242 llvm::Expected<lldb::TraceSP> CreateTrace();
1243
1244 /// If a \a Trace object is present, this returns it, otherwise a new Trace is
1245 /// created with \a Trace::CreateTrace.
1246 llvm::Expected<lldb::TraceSP> GetTraceOrCreate();
1247
1248 // Since expressions results can persist beyond the lifetime of a process,
1249 // and the const expression results are available after a process is gone, we
1250 // provide a way for expressions to be evaluated from the Target itself. If
1251 // an expression is going to be run, then it should have a frame filled in in
1252 // the execution context.
1254 llvm::StringRef expression, ExecutionContextScope *exe_scope,
1255 lldb::ValueObjectSP &result_valobj_sp,
1257 std::string *fixed_expression = nullptr, ValueObject *ctx_obj = nullptr);
1258
1260
1262
1263 /// This method will return the address of the starting function for
1264 /// this binary, e.g. main() or its equivalent. This can be used as
1265 /// an address of a function that is not called once a binary has
1266 /// started running - e.g. as a return address for inferior function
1267 /// calls that are unambiguous completion of the function call, not
1268 /// called during the course of the inferior function code running.
1269 ///
1270 /// If no entry point can be found, an invalid address is returned.
1271 ///
1272 /// \param [out] err
1273 /// This object will be set to failure if no entry address could
1274 /// be found, and may contain a helpful error message.
1275 //
1276 /// \return
1277 /// Returns the entry address for this program, or an error
1278 /// if none can be found.
1279 llvm::Expected<lldb_private::Address> GetEntryPointAddress();
1280
1281 CompilerType GetRegisterType(const std::string &name,
1282 const lldb_private::RegisterFlags &flags,
1283 uint32_t byte_size);
1284
1285 // Target Stop Hooks
1286 class StopHook : public UserID {
1287 public:
1288 StopHook(const StopHook &rhs);
1289 virtual ~StopHook() = default;
1290
1291 enum class StopHookKind : uint32_t { CommandBased = 0, ScriptBased };
1292 enum class StopHookResult : uint32_t {
1293 KeepStopped = 0,
1296 };
1297
1299
1300 // Set the specifier. The stop hook will own the specifier, and is
1301 // responsible for deleting it when we're done.
1302 void SetSpecifier(SymbolContextSpecifier *specifier);
1303
1305
1306 bool ExecutionContextPasses(const ExecutionContext &exe_ctx);
1307
1308 // Called on stop, this gets passed the ExecutionContext for each "stop
1309 // with a reason" thread. It should add to the stream whatever text it
1310 // wants to show the user, and return False to indicate it wants the target
1311 // not to stop.
1313 lldb::StreamSP output) = 0;
1314
1315 // Set the Thread Specifier. The stop hook will own the thread specifier,
1316 // and is responsible for deleting it when we're done.
1317 void SetThreadSpecifier(ThreadSpec *specifier);
1318
1320
1321 bool IsActive() { return m_active; }
1322
1323 void SetIsActive(bool is_active) { m_active = is_active; }
1324
1325 void SetAutoContinue(bool auto_continue) {
1326 m_auto_continue = auto_continue;
1327 }
1328
1329 bool GetAutoContinue() const { return m_auto_continue; }
1330
1331 void GetDescription(Stream &s, lldb::DescriptionLevel level) const;
1333 lldb::DescriptionLevel level) const = 0;
1334
1335 protected:
1338 std::unique_ptr<ThreadSpec> m_thread_spec_up;
1339 bool m_active = true;
1340 bool m_auto_continue = false;
1341
1342 StopHook(lldb::TargetSP target_sp, lldb::user_id_t uid);
1343 };
1344
1346 public:
1347 ~StopHookCommandLine() override = default;
1348
1350 void SetActionFromString(const std::string &strings);
1351 void SetActionFromStrings(const std::vector<std::string> &strings);
1352
1354 lldb::StreamSP output_sp) override;
1356 lldb::DescriptionLevel level) const override;
1357
1358 private:
1360 // Use CreateStopHook to make a new empty stop hook. The GetCommandPointer
1361 // and fill it with commands, and SetSpecifier to set the specifier shared
1362 // pointer (can be null, that will match anything.)
1364 : StopHook(target_sp, uid) {}
1365 friend class Target;
1366 };
1367
1369 public:
1370 ~StopHookScripted() override = default;
1372 lldb::StreamSP output) override;
1373
1374 Status SetScriptCallback(std::string class_name,
1375 StructuredData::ObjectSP extra_args_sp);
1376
1378 lldb::DescriptionLevel level) const override;
1379
1380 private:
1381 std::string m_class_name;
1382 /// This holds the dictionary of keys & values that can be used to
1383 /// parametrize any given callback's behavior.
1385 /// This holds the python callback object.
1387
1388 /// Use CreateStopHook to make a new empty stop hook. The GetCommandPointer
1389 /// and fill it with commands, and SetSpecifier to set the specifier shared
1390 /// pointer (can be null, that will match anything.)
1392 : StopHook(target_sp, uid) {}
1393 friend class Target;
1394 };
1395
1396 typedef std::shared_ptr<StopHook> StopHookSP;
1397
1398 /// Add an empty stop hook to the Target's stop hook list, and returns a
1399 /// shared pointer to it in new_hook. Returns the id of the new hook.
1401
1402 /// If you tried to create a stop hook, and that failed, call this to
1403 /// remove the stop hook, as it will also reset the stop hook counter.
1405
1406 // Runs the stop hooks that have been registered for this target.
1407 // Returns true if the stop hooks cause the target to resume.
1408 bool RunStopHooks();
1409
1411
1412 bool SetSuppresStopHooks(bool suppress) {
1413 bool old_value = m_suppress_stop_hooks;
1414 m_suppress_stop_hooks = suppress;
1415 return old_value;
1416 }
1417
1419
1421
1422 void RemoveAllStopHooks();
1423
1425
1426 bool SetStopHookActiveStateByID(lldb::user_id_t uid, bool active_state);
1427
1428 void SetAllStopHooksActiveState(bool active_state);
1429
1430 size_t GetNumStopHooks() const { return m_stop_hooks.size(); }
1431
1433 if (index >= GetNumStopHooks())
1434 return StopHookSP();
1435 StopHookCollection::iterator pos = m_stop_hooks.begin();
1436
1437 while (index > 0) {
1438 pos++;
1439 index--;
1440 }
1441 return (*pos).second;
1442 }
1443
1445
1446 void SetPlatform(const lldb::PlatformSP &platform_sp) {
1447 m_platform_sp = platform_sp;
1448 }
1449
1451
1452 // Methods.
1454 GetSearchFilterForModule(const FileSpec *containingModule);
1455
1457 GetSearchFilterForModuleList(const FileSpecList *containingModuleList);
1458
1460 GetSearchFilterForModuleAndCUList(const FileSpecList *containingModules,
1461 const FileSpecList *containingSourceFiles);
1462
1464 const char *repl_options, bool can_create);
1465
1466 void SetREPL(lldb::LanguageType language, lldb::REPLSP repl_sp);
1467
1470 }
1471
1473
1474 /// Add a signal for the target. This will get copied over to the process
1475 /// if the signal exists on that target. Only the values with Yes and No are
1476 /// set, Calculate values will be ignored.
1477protected:
1483 : pass(pass), notify(notify), stop(stop) {}
1485 };
1486 using DummySignalElement = llvm::StringMapEntry<DummySignalValues>;
1487 static bool UpdateSignalFromDummy(lldb::UnixSignalsSP signals_sp,
1488 const DummySignalElement &element);
1489 static bool ResetSignalFromDummy(lldb::UnixSignalsSP signals_sp,
1490 const DummySignalElement &element);
1491
1492public:
1493 /// Add a signal to the Target's list of stored signals/actions. These
1494 /// values will get copied into any processes launched from
1495 /// this target.
1496 void AddDummySignal(llvm::StringRef name, LazyBool pass, LazyBool print,
1497 LazyBool stop);
1498 /// Updates the signals in signals_sp using the stored dummy signals.
1499 /// If warning_stream_sp is not null, if any stored signals are not found in
1500 /// the current process, a warning will be emitted here.
1502 lldb::StreamSP warning_stream_sp);
1503 /// Clear the dummy signals in signal_names from the target, or all signals
1504 /// if signal_names is empty. Also remove the behaviors they set from the
1505 /// process's signals if it exists.
1506 void ClearDummySignals(Args &signal_names);
1507 /// Print all the signals set in this target.
1508 void PrintDummySignals(Stream &strm, Args &signals);
1509
1510protected:
1511 /// Implementing of ModuleList::Notifier.
1512
1513 void NotifyModuleAdded(const ModuleList &module_list,
1514 const lldb::ModuleSP &module_sp) override;
1515
1516 void NotifyModuleRemoved(const ModuleList &module_list,
1517 const lldb::ModuleSP &module_sp) override;
1518
1519 void NotifyModuleUpdated(const ModuleList &module_list,
1520 const lldb::ModuleSP &old_module_sp,
1521 const lldb::ModuleSP &new_module_sp) override;
1522
1523 void NotifyWillClearList(const ModuleList &module_list) override;
1524
1525 void NotifyModulesRemoved(lldb_private::ModuleList &module_list) override;
1526
1527 class Arch {
1528 public:
1529 explicit Arch(const ArchSpec &spec);
1530 const Arch &operator=(const ArchSpec &spec);
1531
1532 const ArchSpec &GetSpec() const { return m_spec; }
1533 Architecture *GetPlugin() const { return m_plugin_up.get(); }
1534
1535 private:
1537 std::unique_ptr<Architecture> m_plugin_up;
1538 };
1539
1540 // Member variables.
1542 lldb::PlatformSP m_platform_sp; ///< The platform for this target.
1543 std::recursive_mutex m_mutex; ///< An API mutex that is used by the lldb::SB*
1544 /// classes make the SB interface thread safe
1545 /// When the private state thread calls SB API's - usually because it is
1546 /// running OS plugin or Python ThreadPlan code - it should not block on the
1547 /// API mutex that is held by the code that kicked off the sequence of events
1548 /// that led us to run the code. We hand out this mutex instead when we
1549 /// detect that code is running on the private state thread.
1550 std::recursive_mutex m_private_mutex;
1552 std::string m_label;
1553 ModuleList m_images; ///< The list of images for this process (shared
1554 /// libraries and anything dynamically loaded).
1559 std::map<ConstString, std::unique_ptr<BreakpointName>>;
1561
1565 // We want to tightly control the process destruction process so we can
1566 // correctly tear down everything that we need to, so the only class that
1567 // knows about the process lifespan is this target class.
1572
1573 typedef std::map<lldb::LanguageType, lldb::REPLSP> REPLMap;
1575
1577
1578 typedef std::map<lldb::user_id_t, StopHookSP> StopHookCollection;
1581 uint32_t m_latest_stop_hook_id; /// This records the last natural stop at
1582 /// which we ran a stop-hook.
1584 bool m_suppress_stop_hooks; /// Used to not run stop hooks for expressions
1587 /// An optional \a lldb_private::Trace object containing processor trace
1588 /// information of this target.
1590 /// Stores the frame recognizers of this target.
1592 /// These are used to set the signal state when you don't have a process and
1593 /// more usefully in the Dummy target where you can't know exactly what
1594 /// signals you will have.
1595 llvm::StringMap<DummySignalValues> m_dummy_signals;
1596
1597 static void ImageSearchPathsChanged(const PathMappingList &path_list,
1598 void *baton);
1599
1600 // Utilities for `statistics` command.
1601private:
1602 // Target metrics storage.
1604
1605public:
1606 /// Get metrics associated with this target in JSON format.
1607 ///
1608 /// Target metrics help measure timings and information that is contained in
1609 /// a target. These are designed to help measure performance of a debug
1610 /// session as well as represent the current state of the target, like
1611 /// information on the currently modules, currently set breakpoints and more.
1612 ///
1613 /// \return
1614 /// Returns a JSON value that contains all target metrics.
1615 llvm::json::Value
1617
1619
1620protected:
1621 /// Construct with optional file and arch.
1622 ///
1623 /// This member is private. Clients must use
1624 /// TargetList::CreateTarget(const FileSpec*, const ArchSpec*)
1625 /// so all targets can be tracked from the central target list.
1626 ///
1627 /// \see TargetList::CreateTarget(const FileSpec*, const ArchSpec*)
1628 Target(Debugger &debugger, const ArchSpec &target_arch,
1629 const lldb::PlatformSP &platform_sp, bool is_dummy_target);
1630
1631 // Helper function.
1632 bool ProcessIsValid();
1633
1634 // Copy breakpoints, stop hooks and so forth from the dummy target:
1635 void PrimeFromDummyTarget(Target &target);
1636
1637 void AddBreakpoint(lldb::BreakpointSP breakpoint_sp, bool internal);
1638
1640
1641 /// Return a recommended size for memory reads at \a addr, optimizing for
1642 /// cache usage.
1644
1645 Target(const Target &) = delete;
1646 const Target &operator=(const Target &) = delete;
1647};
1648
1649} // namespace lldb_private
1650
1651#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:31
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...
An event broadcasting class.
Definition: Broadcaster.h:146
Generic representation of a type in a programming language.
Definition: CompilerType.h:36
A uniqued constant string class.
Definition: ConstString.h:40
A class to manage flag bits.
Definition: Debugger.h:80
const char * GetPrefix() const
Definition: Target.h:328
void SetOneThreadTimeout(const Timeout< std::micro > &timeout)
Definition: Target.h:370
uint64_t GetRetriesWithFixIts() const
Definition: Target.h:449
void SetUnwindOnError(bool unwind=false)
Definition: Target.h:343
SourceLanguage GetLanguage() const
Definition: Target.h:313
const char * GetPoundLineFilePath() const
Definition: Target.h:429
lldb::DynamicValueType m_use_dynamic
Definition: Target.h:477
void SetExecutionPolicy(ExecutionPolicy policy=eExecutionPolicyAlways)
Definition: Target.h:309
Timeout< std::micro > m_one_thread_timeout
Definition: Target.h:479
bool InvokeCancelCallback(lldb::ExpressionEvaluationPhase phase) const
Definition: Target.h:411
lldb::DynamicValueType GetUseDynamic() const
Definition: Target.h:355
void SetKeepInMemory(bool keep=true)
Definition: Target.h:353
void SetCoerceToId(bool coerce=true)
Definition: Target.h:339
void SetLanguage(lldb::LanguageType language_type)
Definition: Target.h:315
ExecutionPolicy GetExecutionPolicy() const
Definition: Target.h:307
Timeout< std::micro > m_timeout
Definition: Target.h:478
void SetPrefix(const char *prefix)
Definition: Target.h:332
void SetTryAllThreads(bool try_others=true)
Definition: Target.h:376
void SetPoundLine(const char *path, uint32_t line) const
Definition: Target.h:419
void SetRetriesWithFixIts(uint64_t number_of_retries)
Definition: Target.h:445
void SetTimeout(const Timeout< std::micro > &timeout)
Definition: Target.h:364
static constexpr ExecutionPolicy default_execution_policy
Definition: Target.h:302
void SetStopOthers(bool stop_others=true)
Definition: Target.h:380
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:475
void SetCancelCallback(lldb::ExpressionCancelCallback callback, void *baton)
Definition: Target.h:406
const Timeout< std::micro > & GetTimeout() const
Definition: Target.h:362
void SetIgnoreBreakpoints(bool ignore=false)
Definition: Target.h:347
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:322
void SetUseDynamic(lldb::DynamicValueType dynamic=lldb::eDynamicCanRunTarget)
Definition: Target.h:358
lldb::ExpressionCancelCallback m_cancel_callback
Definition: Target.h:480
static constexpr std::chrono::milliseconds default_timeout
Definition: Target.h:297
const Timeout< std::micro > & GetOneThreadTimeout() const
Definition: Target.h:366
"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.
Definition: FileSpecList.h:85
A file utility class.
Definition: FileSpec.h:56
Encapsulates a function that can be called.
A collection class for Module objects.
Definition: ModuleList.h:103
bool LoadScriptingResourcesInTarget(Target *target, std::list< Status > &errors, Stream &feedback_stream, bool continue_on_error=true)
A class that describes an executable image and its associated object and symbol files.
Definition: Module.h:88
SectionLoadList & GetCurrentSectionLoadList()
Class that provides a registry of known stack frame recognizers.
An error handling class.
Definition: Status.h:44
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
std::shared_ptr< Generic > GenericSP
std::shared_ptr< Object > ObjectSP
Defines a symbol context baton that can be handed other debug core functions.
Definition: SymbolContext.h:34
uint32_t GetMaximumSizeOfStringSummary() const
Definition: Target.cpp:4600
FileSpecList GetDebugFileSearchPaths()
Definition: Target.cpp:4481
bool GetDisplayRecognizedArguments() const
Definition: Target.cpp:4758
ImportStdModule GetImportStdModule() const
Definition: Target.cpp:4497
bool GetMoveToNearestCode() const
Definition: Target.cpp:4251
void AppendExecutableSearchPaths(const FileSpec &)
Definition: Target.cpp:4468
bool GetEnableSyntheticValue() const
Definition: Target.cpp:4567
void SetStandardInputPath(const char *path)=delete
ProcessLaunchInfo m_launch_info
Definition: Target.h:282
uint64_t GetExprAllocAlign() const
Definition: Target.cpp:4679
MemoryModuleLoadLevel GetMemoryModuleLoadLevel() const
Definition: Target.cpp:4730
llvm::StringRef GetArg0() const
Definition: Target.cpp:4348
uint32_t GetMaximumMemReadSize() const
Definition: Target.cpp:4606
void SetRunArguments(const Args &args)
Definition: Target.cpp:4365
FileSpec GetStandardErrorPath() const
Definition: Target.cpp:4632
bool GetEnableNotifyAboutFixIts() const
Definition: Target.cpp:4523
bool SetPreferDynamicValue(lldb::DynamicValueType d)
Definition: Target.cpp:4264
void SetDisplayRecognizedArguments(bool b)
Definition: Target.cpp:4764
std::optional< bool > GetExperimentalPropertyValue(size_t prop_idx, ExecutionContext *exe_ctx=nullptr) const
Definition: Target.cpp:4224
const ProcessLaunchInfo & GetProcessLaunchInfo() const
Definition: Target.cpp:4769
Environment ComputeEnvironment() const
Definition: Target.cpp:4371
void SetStandardOutputPath(const char *path)=delete
bool GetUserSpecifiedTrapHandlerNames(Args &args) const
Definition: Target.cpp:4737
uint64_t GetExprErrorLimit() const
Definition: Target.cpp:4661
bool GetEnableAutoImportClangModules() const
Definition: Target.cpp:4491
bool GetDebugUtilityExpression() const
Definition: Target.cpp:4875
DynamicClassInfoHelper GetDynamicClassInfoHelper() const
Definition: Target.cpp:4504
FileSpec GetStandardOutputPath() const
Definition: Target.cpp:4622
void SetDisplayRuntimeSupportValues(bool b)
Definition: Target.cpp:4753
uint32_t GetMaximumNumberOfChildrenToDisplay() const
Definition: Target.cpp:4585
void SetRequireHardwareBreakpoints(bool b)
Definition: Target.cpp:4807
bool GetAutoInstallMainExecutable() const
Definition: Target.cpp:4812
uint64_t GetNumberOfRetriesWithFixits() const
Definition: Target.cpp:4517
uint64_t GetExprAllocSize() const
Definition: Target.cpp:4673
llvm::StringRef GetExpressionPrefixContents()
Definition: Target.cpp:4647
const char * GetDisassemblyFlavor() const
Definition: Target.cpp:4328
FileSpec GetStandardInputPath() const
Definition: Target.cpp:4612
lldb::DynamicValueType GetPreferDynamicValue() const
Definition: Target.cpp:4257
InlineStrategy GetInlineStrategy() const
Definition: Target.cpp:4341
Environment GetTargetEnvironment() const
Definition: Target.cpp:4431
bool GetDisplayRuntimeSupportValues() const
Definition: Target.cpp:4747
void SetUserSpecifiedTrapHandlerNames(const Args &args)
Definition: Target.cpp:4742
bool GetUseHexImmediates() const
Definition: Target.cpp:4691
uint32_t GetMaxZeroPaddingInFloatFormat() const
Definition: Target.cpp:4579
uint64_t GetExprAllocAddress() const
Definition: Target.cpp:4667
LoadCWDlldbinitFile GetLoadCWDlldbinitFile() const
Definition: Target.cpp:4716
Environment GetInheritedEnvironment() const
Definition: Target.cpp:4403
void SetArg0(llvm::StringRef arg)
Definition: Target.cpp:4354
bool GetInjectLocalVariables(ExecutionContext *exe_ctx) const
Definition: Target.cpp:4235
void SetStandardErrorPath(const char *path)=delete
bool ShowHexVariableValuesWithLeadingZeroes() const
Definition: Target.cpp:4573
SourceLanguage GetLanguage() const
Definition: Target.cpp:4642
Environment GetEnvironment() const
Definition: Target.cpp:4399
void SetProcessLaunchInfo(const ProcessLaunchInfo &launch_info)
Definition: Target.cpp:4773
FileSpec GetSaveJITObjectsDir() const
Definition: Target.cpp:4529
void SetEnvironment(Environment env)
Definition: Target.cpp:4442
LoadScriptFromSymFile GetLoadScriptFromSymbolFile() const
Definition: Target.cpp:4709
void SetStandardErrorPath(llvm::StringRef path)
Definition: Target.cpp:4637
bool GetRunArguments(Args &args) const
Definition: Target.cpp:4360
bool GetBreakpointsConsultPlatformAvoidList()
Definition: Target.cpp:4685
FileSpecList GetExecutableSearchPaths()
Definition: Target.cpp:4476
ArchSpec GetDefaultArchitecture() const
Definition: Target.cpp:4241
Disassembler::HexImmediateStyle GetHexImmediateStyle() const
Definition: Target.cpp:4723
std::unique_ptr< TargetExperimentalProperties > m_experimental_properties_up
Definition: Target.h:283
FileSpecList GetClangModuleSearchPaths()
Definition: Target.cpp:4486
void SetStandardOutputPath(llvm::StringRef path)
Definition: Target.cpp:4627
bool GetRequireHardwareBreakpoints() const
Definition: Target.cpp:4801
PathMappingList & GetSourcePathMap() const
Definition: Target.cpp:4454
bool GetAutoSourceMapRelative() const
Definition: Target.cpp:4462
void SetDefaultArchitecture(const ArchSpec &arch)
Definition: Target.cpp:4246
void SetStandardInputPath(llvm::StringRef path)
Definition: Target.cpp:4617
bool GetDisplayExpressionsInCrashlogs() const
Definition: Target.cpp:4703
bool GetEnableAutoApplyFixIts() const
Definition: Target.cpp:4511
void SetDebugUtilityExpression(bool debug)
Definition: Target.cpp:4881
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:4592
A class that represents statistics for a since lldb_private::Target.
Definition: Statistics.h:178
std::unique_ptr< Architecture > m_plugin_up
Definition: Target.h:1537
const ArchSpec & GetSpec() const
Definition: Target.h:1532
const Arch & operator=(const ArchSpec &spec)
Definition: Target.cpp:84
Architecture * GetPlugin() const
Definition: Target.h:1533
void SetActionFromString(const std::string &strings)
Definition: Target.cpp:3788
StopHookCommandLine(lldb::TargetSP target_sp, lldb::user_id_t uid)
Definition: Target.h:1363
void SetActionFromStrings(const std::vector< std::string > &strings)
Definition: Target.cpp:3792
StopHookResult HandleStop(ExecutionContext &exc_ctx, lldb::StreamSP output_sp) override
Definition: Target.cpp:3799
void GetSubclassDescription(Stream &s, lldb::DescriptionLevel level) const override
Definition: Target.cpp:3769
StructuredData::GenericSP m_implementation_sp
This holds the python callback object.
Definition: Target.h:1386
Status SetScriptCallback(std::string class_name, StructuredData::ObjectSP extra_args_sp)
Definition: Target.cpp:3833
StopHookResult HandleStop(ExecutionContext &exc_ctx, lldb::StreamSP output) override
Definition: Target.cpp:3854
StopHookScripted(lldb::TargetSP target_sp, lldb::user_id_t uid)
Use CreateStopHook to make a new empty stop hook.
Definition: Target.h:1391
void GetSubclassDescription(Stream &s, lldb::DescriptionLevel level) const override
Definition: Target.cpp:3871
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:1384
SymbolContextSpecifier * GetSpecifier()
Definition: Target.h:1304
void SetSpecifier(SymbolContextSpecifier *specifier)
Definition: Target.cpp:3703
virtual StopHookResult HandleStop(ExecutionContext &exe_ctx, lldb::StreamSP output)=0
std::unique_ptr< ThreadSpec > m_thread_spec_up
Definition: Target.h:1338
void SetIsActive(bool is_active)
Definition: Target.h:1323
void SetThreadSpecifier(ThreadSpec *specifier)
Definition: Target.cpp:3707
ThreadSpec * GetThreadSpecifier()
Definition: Target.h:1319
lldb::TargetSP m_target_sp
Definition: Target.h:1336
bool GetAutoContinue() const
Definition: Target.h:1329
bool ExecutionContextPasses(const ExecutionContext &exe_ctx)
Definition: Target.cpp:3711
lldb::TargetSP & GetTarget()
Definition: Target.h:1298
lldb::SymbolContextSpecifierSP m_specifier_sp
Definition: Target.h:1337
virtual void GetSubclassDescription(Stream &s, lldb::DescriptionLevel level) const =0
void GetDescription(Stream &s, lldb::DescriptionLevel level) const
Definition: Target.cpp:3727
void SetAutoContinue(bool auto_continue)
Definition: Target.h:1325
const ModuleList & GetModuleList() const
Definition: Target.h:544
void Dump(Stream *s) const override
Definition: Target.cpp:4901
static llvm::StringRef GetFlavorString()
Definition: Target.cpp:4897
static ModuleList GetModuleListFromEvent(const Event *event_ptr)
Definition: Target.cpp:4930
static const TargetEventData * GetEventDataFromEvent(const Event *event_ptr)
Definition: Target.cpp:4911
llvm::StringRef GetFlavor() const override
Definition: Target.h:530
const lldb::TargetSP & GetTarget() const
Definition: Target.h:542
TargetEventData(const TargetEventData &)=delete
const TargetEventData & operator=(const TargetEventData &)=delete
static lldb::TargetSP GetTargetFromEvent(const Event *event_ptr)
Definition: Target.cpp:4921
void ModulesDidLoad(ModuleList &module_list)
Definition: Target.cpp:1690
lldb::ThreadSP CalculateThread() override
Definition: Target.cpp:2392
REPLMap m_repl_map
Definition: Target.h:1574
StopHookCollection m_stop_hooks
Definition: Target.h:1579
Module * GetExecutableModulePointer()
Definition: Target.cpp:1436
void Dump(Stream *s, lldb::DescriptionLevel description_level)
Dump a description of this object to a Stream.
Definition: Target.cpp:158
bool m_suppress_stop_hooks
Definition: Target.h:1584
void DisableAllBreakpoints(bool internal_also=false)
Definition: Target.cpp:970
lldb::WatchpointSP CreateWatchpoint(lldb::addr_t addr, size_t size, const CompilerType *type, uint32_t kind, Status &error)
Definition: Target.cpp:855
void ApplyNameToBreakpoints(BreakpointName &bp_name)
Definition: Target.cpp:809
StopHookSP CreateStopHook(StopHook::StopHookKind kind)
Add an empty stop hook to the Target's stop hook list, and returns a shared pointer to it in new_hook...
Definition: Target.cpp:2822
lldb::TraceSP GetTrace()
Get the Trace object containing processor trace information of this target.
Definition: Target.cpp:3368
PathMappingList & GetImageSearchPathList()
Definition: Target.cpp:2401
void FinalizeFileActions(ProcessLaunchInfo &info)
Definition: Target.cpp:3487
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:2796
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:2804
ModuleList & GetImages()
Definition: Target.h:983
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:663
static Target * GetTargetFromContexts(const ExecutionContext *exe_ctx_ptr, const SymbolContext *sc_ptr)
Definition: Target.cpp:2636
lldb::addr_t GetBreakableLoadAddress(lldb::addr_t addr)
Definition: Target.cpp:2811
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:3635
bool SetSuppresStopHooks(bool suppress)
Definition: Target.h:1412
static void ImageSearchPathsChanged(const PathMappingList &path_list, void *baton)
Definition: Target.cpp:2405
llvm::Expected< lldb_private::Address > GetEntryPointAddress()
This method will return the address of the starting function for this binary, e.g.
Definition: Target.cpp:2762
bool IgnoreWatchpointByID(lldb::watch_id_t watch_id, uint32_t ignore_count)
Definition: Target.cpp:1406
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:629
lldb::BreakpointSP GetBreakpointByID(lldb::break_id_t break_id)
Definition: Target.cpp:328
std::shared_ptr< StopHook > StopHookSP
Definition: Target.h:1396
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:513
void SymbolsDidLoad(ModuleList &module_list)
Definition: Target.cpp:1708
bool ClearAllWatchpointHistoricValues()
Definition: Target.cpp:1320
void SetTrace(const lldb::TraceSP &trace_sp)
Set the Trace object containing processor trace information of this target.
Definition: Target.cpp:3366
BreakpointList & GetBreakpointList(bool internal=false)
Definition: Target.cpp:314
CompilerType GetRegisterType(const std::string &name, const lldb_private::RegisterFlags &flags, uint32_t byte_size)
Definition: Target.cpp:2440
BreakpointNameList m_breakpoint_names
Definition: Target.h:1560
llvm::StringRef GetABIName() const
Returns the name of the target's ABI plugin.
Definition: Target.cpp:303
SourceManager & GetSourceManager()
Definition: Target.cpp:2816
lldb::SearchFilterSP GetSearchFilterForModuleList(const FileSpecList *containingModuleList)
Definition: Target.cpp:592
StopHookSP GetStopHookByID(lldb::user_id_t uid)
Definition: Target.cpp:2851
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:1595
lldb::ProcessSP m_process_sp
Definition: Target.h:1568
lldb::SearchFilterSP m_search_filter_sp
Definition: Target.h:1569
PersistentExpressionState * GetPersistentExpressionStateForLanguage(lldb::LanguageType language)
Definition: Target.cpp:2484
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:3623
bool m_is_dummy_target
Used to not run stop hooks for expressions.
Definition: Target.h:1585
static bool UpdateSignalFromDummy(lldb::UnixSignalsSP signals_sp, const DummySignalElement &element)
Definition: Target.cpp:3581
PathMappingList m_image_search_paths
Definition: Target.h:1570
bool ModuleIsExcludedForUnconstrainedSearches(const FileSpec &module_spec)
Return whether this FileSpec corresponds to a module that should be considered for general searches.
Definition: Target.cpp:1764
lldb::StackFrameSP CalculateStackFrame() override
Definition: Target.cpp:2394
SectionLoadList & GetSectionLoadList()
Definition: Target.h:1138
lldb::addr_t GetPersistentSymbol(ConstString name)
Definition: Target.cpp:2742
void PrimeFromDummyTarget(Target &target)
Definition: Target.cpp:136
std::map< ConstString, std::unique_ptr< BreakpointName > > BreakpointNameList
Definition: Target.h:1559
static void SettingsTerminate()
Definition: Target.cpp:2595
bool EnableWatchpointByID(lldb::watch_id_t watch_id)
Definition: Target.cpp:1371
bool ResolveFileAddress(lldb::addr_t load_addr, Address &so_addr)
Definition: Target.cpp:3109
Debugger & GetDebugger()
Definition: Target.h:1064
bool ClearAllWatchpointHitCounts()
Definition: Target.cpp:1306
size_t ReadMemoryFromFileCache(const Address &addr, void *dst, size_t dst_len, Status &error)
Definition: Target.cpp:1796
void ClearAllLoadedSections()
Definition: Target.cpp:3185
size_t GetNumStopHooks() const
Definition: Target.h:1430
std::vector< lldb::TypeSystemSP > GetScratchTypeSystems(bool create_on_demand=true)
Definition: Target.cpp:2449
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:2088
void AddNameToBreakpoint(BreakpointID &id, llvm::StringRef name, Status &error)
Definition: Target.cpp:731
bool LoadScriptingResources(std::list< Status > &errors, Stream &feedback_stream, bool continue_on_error=true)
Definition: Target.h:957
void DeleteCurrentProcess()
Definition: Target.cpp:193
BreakpointList m_internal_breakpoint_list
Definition: Target.h:1557
void DisableAllowedBreakpoints()
Definition: Target.cpp:980
bool SetSectionUnloaded(const lldb::SectionSP &section_sp)
Definition: Target.cpp:3163
lldb::TargetSP CalculateTarget() override
Definition: Target.cpp:2388
const lldb::ProcessSP & GetProcessSP() const
Definition: Target.cpp:221
void ClearModules(bool delete_locations)
Definition: Target.cpp:1458
bool RemoveBreakpointByID(lldb::break_id_t break_id)
Definition: Target.cpp:1004
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:2158
static bool ResetSignalFromDummy(lldb::UnixSignalsSP signals_sp, const DummySignalElement &element)
Definition: Target.cpp:3608
Architecture * GetArchitecturePlugin() const
Definition: Target.h:1062
llvm::json::Value ReportStatistics(const lldb_private::StatisticsOptions &options)
Get metrics associated with this target in JSON format.
Definition: Target.cpp:4947
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:2537
TargetStats & GetStatistics()
Definition: Target.h:1618
void EnableAllBreakpoints(bool internal_also=false)
Definition: Target.cpp:987
Status Launch(ProcessLaunchInfo &launch_info, Stream *stream)
Definition: Target.cpp:3198
bool DisableBreakpointByID(lldb::break_id_t break_id)
Definition: Target.cpp:1024
lldb::BreakpointSP CreateBreakpointAtUserEntry(Status &error)
Definition: Target.cpp:340
BreakpointName * FindBreakpointName(ConstString name, bool can_create, Status &error)
Definition: Target.cpp:762
std::map< lldb::user_id_t, StopHookSP > StopHookCollection
Definition: Target.h:1578
llvm::Expected< lldb::TraceSP > CreateTrace()
Create a Trace object for the current target using the using the default supported tracing technology...
Definition: Target.cpp:3370
lldb::TraceSP m_trace_sp
An optional lldb_private::Trace object containing processor trace information of this target.
Definition: Target.h:1589
bool RemoveAllWatchpoints(bool end_to_end=true)
Definition: Target.cpp:1224
bool ReadPointerFromMemory(const Address &addr, Status &error, Address &pointer_addr, bool force_live_memory=false)
Definition: Target.cpp:2128
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:2837
WatchpointList m_watchpoint_list
Definition: Target.h:1563
BreakpointList m_breakpoint_list
Definition: Target.h:1556
lldb::SourceManagerUP m_source_manager_up
Definition: Target.h:1576
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)
Definition: Target.cpp:1828
bool RemoveWatchpointByID(lldb::watch_id_t watch_id)
Definition: Target.cpp:1390
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:2039
void DeleteBreakpointName(ConstString name)
Definition: Target.cpp:785
void NotifyWillClearList(const ModuleList &module_list) override
Definition: Target.cpp:1652
bool SetArchitecture(const ArchSpec &arch_spec, bool set_platform=false, bool merge=true)
Set the architecture for this target.
Definition: Target.cpp:1538
void NotifyModuleAdded(const ModuleList &module_list, const lldb::ModuleSP &module_sp) override
Implementing of ModuleList::Notifier.
Definition: Target.cpp:1654
llvm::Expected< lldb::TypeSystemSP > GetScratchTypeSystemForLanguage(lldb::LanguageType language, bool create_on_demand=true)
Definition: Target.cpp:2414
void ConfigureBreakpointName(BreakpointName &bp_name, const BreakpointOptions &options, const BreakpointName::Permissions &permissions)
Definition: Target.cpp:801
lldb::SearchFilterSP GetSearchFilterForModuleAndCUList(const FileSpecList *containingModules, const FileSpecList *containingSourceFiles)
Definition: Target.cpp:609
lldb::ModuleSP GetExecutableModule()
Gets the module for the main executable.
Definition: Target.cpp:1422
bool SetStopHookActiveStateByID(lldb::user_id_t uid, bool active_state)
Definition: Target.cpp:2861
const lldb::ProcessSP & CreateProcess(lldb::ListenerSP listener_sp, llvm::StringRef plugin_name, const FileSpec *crash_file, bool can_connect)
Definition: Target.cpp:209
void SetAllStopHooksActiveState(bool active_state)
Definition: Target.cpp:2872
lldb::ExpressionVariableSP GetPersistentVariable(ConstString name)
Definition: Target.cpp:2723
void NotifyModulesRemoved(lldb_private::ModuleList &module_list) override
Definition: Target.cpp:1686
size_t ReadCStringFromMemory(const Address &addr, std::string &out_str, Status &error, bool force_live_memory=false)
Definition: Target.cpp:1949
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:1543
void ModulesDidUnload(ModuleList &module_list, bool delete_locations)
Definition: Target.cpp:1724
void CalculateExecutionContext(ExecutionContext &exe_ctx) override
Reconstruct the object's execution context into sc.
Definition: Target.cpp:2396
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:3395
void NotifyModuleUpdated(const ModuleList &module_list, const lldb::ModuleSP &old_module_sp, const lldb::ModuleSP &new_module_sp) override
Definition: Target.cpp:1674
Target(const Target &)=delete
Status SerializeBreakpointsToFile(const FileSpec &file, const BreakpointIDList &bp_ids, bool append)
Definition: Target.cpp:1065
void DidExec()
Called as the last function in Process::DidExec().
Definition: Target.cpp:1465
void SaveScriptedLaunchInfo(lldb_private::ProcessInfo &process_info)
Definition: Target.cpp:3187
bool GetSuppressStopHooks()
Definition: Target.h:1418
std::string m_label
Definition: Target.h:1552
lldb::user_id_t m_stop_hook_next_id
Definition: Target.h:1580
void RemoveAllStopHooks()
Definition: Target.cpp:2849
static FileSpecList GetDefaultExecutableSearchPaths()
Definition: Target.cpp:2597
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:646
lldb::SearchFilterSP GetSearchFilterForModule(const FileSpec *containingModule)
Definition: Target.cpp:574
llvm::StringMapEntry< DummySignalValues > DummySignalElement
Definition: Target.h:1486
std::recursive_mutex & GetAPIMutex()
Definition: Target.cpp:4938
static llvm::StringRef GetStaticBroadcasterClass()
Definition: Target.cpp:90
static FileSpecList GetDefaultDebugFileSearchPaths()
Definition: Target.cpp:2601
void EnableAllowedBreakpoints()
Definition: Target.cpp:997
llvm::Error SetLabel(llvm::StringRef label)
Set a label for a target.
Definition: Target.cpp:2616
uint32_t m_latest_stop_hook_id
Definition: Target.h:1581
@ eBroadcastBitModulesLoaded
Definition: Target.h:502
@ eBroadcastBitSymbolsChanged
Definition: Target.h:506
@ eBroadcastBitSymbolsLoaded
Definition: Target.h:505
@ eBroadcastBitModulesUnloaded
Definition: Target.h:503
@ eBroadcastBitWatchpointChanged
Definition: Target.h:504
@ eBroadcastBitBreakpointChanged
Definition: Target.h:501
StackFrameRecognizerManager & GetFrameRecognizerManager()
Definition: Target.h:1468
void RemoveAllowedBreakpoints()
Definition: Target.cpp:949
StopHookSP GetStopHookAtIndex(size_t index)
Definition: Target.h:1432
bool DisableAllWatchpoints(bool end_to_end=true)
Definition: Target.cpp:1253
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:2026
lldb::PlatformSP m_platform_sp
The platform for this target.
Definition: Target.h:1542
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:2567
static TargetProperties & GetGlobalProperties()
Definition: Target.cpp:3048
Status Install(ProcessLaunchInfo *launch_info)
Definition: Target.cpp:3056
lldb::PlatformSP GetPlatform()
Definition: Target.h:1444
void NotifyModuleRemoved(const ModuleList &module_list, const lldb::ModuleSP &module_sp) override
Definition: Target.cpp:1664
lldb::BreakpointSP CreateAddressInModuleBreakpoint(lldb::addr_t file_addr, bool internal, const FileSpec &file_spec, bool request_hardware)
Definition: Target.cpp:483
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:395
bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr, uint32_t stop_id=SectionLoadHistory::eStopIDNow)
Definition: Target.cpp:3104
void RemoveAllBreakpoints(bool internal_also=false)
Definition: Target.cpp:958
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:378
static ArchSpec GetDefaultArchitecture()
Definition: Target.cpp:2605
void ResetBreakpointHitCounts()
Resets the hit count of all breakpoints.
Definition: Target.cpp:1061
const ModuleList & GetImages() const
Get accessor for the images for this process.
Definition: Target.h:981
const ArchSpec & GetArchitecture() const
Definition: Target.h:1023
WatchpointList & GetWatchpointList()
Definition: Target.h:774
unsigned m_next_persistent_variable_index
Definition: Target.h:1586
bool EnableBreakpointByID(lldb::break_id_t break_id)
Definition: Target.cpp:1042
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, LazyBool skip_prologue, bool internal, bool request_hardware)
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:2117
TargetStats m_stats
Definition: Target.h:1603
bool IgnoreAllWatchpoints(uint32_t ignore_count)
Definition: Target.cpp:1335
void AddBreakpoint(lldb::BreakpointSP breakpoint_sp, bool internal)
Definition: Target.cpp:708
TypeSystemMap m_scratch_type_system_map
Definition: Target.h:1571
void AddBreakpointName(std::unique_ptr< BreakpointName > bp_name)
Definition: Target.cpp:757
SectionLoadHistory m_section_load_history
Definition: Target.h:1555
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:823
bool IsDummyTarget() const
Definition: Target.h:568
size_t UnloadModuleSections(const lldb::ModuleSP &module_sp)
Definition: Target.cpp:3144
const std::string & GetLabel() const
Definition: Target.h:570
bool m_valid
This records the last natural stop at which we ran a stop-hook.
Definition: Target.h:1583
bool DisableWatchpointByID(lldb::watch_id_t watch_id)
Definition: Target.cpp:1352
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:3566
lldb::WatchpointSP m_last_created_watchpoint
Definition: Target.h:1564
Status CreateBreakpointsFromFile(const FileSpec &file, BreakpointIDList &new_bps)
Definition: Target.cpp:1157
Debugger & m_debugger
Definition: Target.h:1541
void SetREPL(lldb::LanguageType language, lldb::REPLSP repl_sp)
Definition: Target.cpp:273
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:1471
lldb::StackFrameRecognizerManagerUP m_frame_recognizer_manager_up
Stores the frame recognizers of this target.
Definition: Target.h:1591
lldb::REPLSP GetREPL(Status &err, lldb::LanguageType language, const char *repl_options, bool can_create)
Definition: Target.cpp:223
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:2504
ModuleList m_images
The list of images for this process (shared libraries and anything dynamically loaded).
Definition: Target.h:1553
lldb::ProcessSP CalculateProcess() override
Definition: Target.cpp:2390
void PrintDummySignals(Stream &strm, Args &signals)
Print all the signals set in this target.
Definition: Target.cpp:3660
void SetPlatform(const lldb::PlatformSP &platform_sp)
Definition: Target.h:1446
bool SetSectionLoadAddress(const lldb::SectionSP &section, lldb::addr_t load_addr, bool warn_multiple=false)
Definition: Target.cpp:3114
Status Attach(ProcessAttachInfo &attach_info, Stream *stream)
Definition: Target.cpp:3401
std::map< lldb::LanguageType, lldb::REPLSP > REPLMap
Definition: Target.h:1573
static void SetDefaultArchitecture(const ArchSpec &arch)
Definition: Target.cpp:2609
lldb::BreakpointSP m_last_created_breakpoint
Definition: Target.h:1562
lldb::WatchpointSP GetLastCreatedWatchpoint()
Definition: Target.h:770
void RemoveNameFromBreakpoint(lldb::BreakpointSP &bp_sp, ConstString name)
Definition: Target.cpp:796
bool RemoveStopHookByID(lldb::user_id_t uid)
Definition: Target.cpp:2844
lldb::BreakpointSP GetLastCreatedBreakpoint()
Definition: Target.h:662
static void SettingsInitialize()
Definition: Target.cpp:2593
~Target() override
Definition: Target.cpp:130
bool EnableAllWatchpoints(bool end_to_end=true)
Definition: Target.cpp:1280
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:1550
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:2650
bool MergeArchitecture(const ArchSpec &arch_spec)
Definition: Target.cpp:1627
Encapsulates a one-time expression for use in lldb.
This class is used by Watchpoint to manage a list of watchpoints,.
A class that represents a running process on the host machine.
LoadScriptFromSymFile
Definition: Target.h:50
@ eLoadScriptFromSymFileTrue
Definition: Target.h:51
@ eLoadScriptFromSymFileFalse
Definition: Target.h:52
@ eLoadScriptFromSymFileWarn
Definition: Target.h:53
ExecutionPolicy
Expression execution policies.
DynamicClassInfoHelper
Definition: Target.h:68
@ eDynamicClassInfoHelperCopyRealizedClassList
Definition: Target.h:71
@ eDynamicClassInfoHelperGetRealizedClassList
Definition: Target.h:72
@ eDynamicClassInfoHelperAuto
Definition: Target.h:69
@ eDynamicClassInfoHelperRealizedClassesStruct
Definition: Target.h:70
OptionEnumValues GetDynamicValueTypes()
Definition: Target.cpp:3931
ImportStdModule
Definition: Target.h:62
@ eImportStdModuleFalse
Definition: Target.h:63
@ eImportStdModuleFallback
Definition: Target.h:64
@ eImportStdModuleTrue
Definition: Target.h:65
LoadCWDlldbinitFile
Definition: Target.h:56
@ eLoadCWDlldbinitTrue
Definition: Target.h:57
@ eLoadCWDlldbinitFalse
Definition: Target.h:58
@ eLoadCWDlldbinitWarn
Definition: Target.h:59
llvm::ArrayRef< OptionEnumValueElement > OptionEnumValues
InlineStrategy
Definition: Target.h:44
@ eInlineBreakpointsNever
Definition: Target.h:45
@ eInlineBreakpointsAlways
Definition: Target.h:47
@ eInlineBreakpointsHeaders
Definition: Target.h:46
ExpressionEvaluationPhase
Expression Evaluation Stages.
std::shared_ptr< lldb_private::Trace > TraceSP
Definition: lldb-forward.h:452
std::shared_ptr< lldb_private::StackFrame > StackFrameSP
Definition: lldb-forward.h:418
std::shared_ptr< lldb_private::SearchFilter > SearchFilterSP
Definition: lldb-forward.h:416
std::shared_ptr< lldb_private::BreakpointResolver > BreakpointResolverSP
Definition: lldb-forward.h:324
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
std::unique_ptr< lldb_private::StackFrameRecognizerManager > StackFrameRecognizerManagerUP
Definition: lldb-forward.h:424
std::shared_ptr< lldb_private::Thread > ThreadSP
Definition: lldb-forward.h:444
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
Definition: lldb-forward.h:478
std::shared_ptr< lldb_private::ExpressionVariable > ExpressionVariableSP
Definition: lldb-forward.h:347
std::shared_ptr< lldb_private::UnixSignals > UnixSignalsSP
Definition: lldb-forward.h:474
std::shared_ptr< lldb_private::Platform > PlatformSP
Definition: lldb-forward.h:384
LanguageType
Programming language type.
bool(* ExpressionCancelCallback)(ExpressionEvaluationPhase phase, void *baton)
Definition: lldb-types.h:75
std::shared_ptr< lldb_private::Stream > StreamSP
Definition: lldb-forward.h:426
std::shared_ptr< lldb_private::Breakpoint > BreakpointSP
Definition: lldb-forward.h:317
ExpressionResults
The results of expression evaluation.
int32_t break_id_t
Definition: lldb-types.h:86
std::unique_ptr< lldb_private::SourceManager > SourceManagerUP
Definition: lldb-forward.h:417
std::shared_ptr< lldb_private::Process > ProcessSP
Definition: lldb-forward.h:385
std::shared_ptr< lldb_private::SymbolContextSpecifier > SymbolContextSpecifierSP
Definition: lldb-forward.h:437
std::shared_ptr< lldb_private::Watchpoint > WatchpointSP
Definition: lldb-forward.h:483
std::shared_ptr< lldb_private::Listener > ListenerSP
Definition: lldb-forward.h:364
int32_t watch_id_t
Definition: lldb-types.h:87
uint64_t user_id_t
Definition: lldb-types.h:82
std::shared_ptr< lldb_private::Section > SectionSP
Definition: lldb-forward.h:412
uint64_t addr_t
Definition: lldb-types.h:80
std::shared_ptr< lldb_private::Target > TargetSP
Definition: lldb-forward.h:442
@ eDynamicCanRunTarget
@ eNoDynamicValues
std::shared_ptr< lldb_private::Module > ModuleSP
Definition: lldb-forward.h:369
std::shared_ptr< lldb_private::REPL > REPLSP
Definition: lldb-forward.h:397
A type-erased pair of llvm::dwarf::SourceLanguageName and version.
Add a signal for the target.
Definition: Target.h:1478
DummySignalValues(LazyBool pass, LazyBool notify, LazyBool stop)
Definition: Target.h:1482
A mix in class that contains a generic user ID.
Definition: UserID.h:31