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) { m_language = language; }
316
317 bool DoesCoerceToId() const { return m_coerce_to_id; }
318
319 const char *GetPrefix() const {
320 return (m_prefix.empty() ? nullptr : m_prefix.c_str());
321 }
322
323 void SetPrefix(const char *prefix) {
324 if (prefix && prefix[0])
325 m_prefix = prefix;
326 else
327 m_prefix.clear();
328 }
329
330 void SetCoerceToId(bool coerce = true) { m_coerce_to_id = coerce; }
331
332 bool DoesUnwindOnError() const { return m_unwind_on_error; }
333
334 void SetUnwindOnError(bool unwind = false) { m_unwind_on_error = unwind; }
335
337
338 void SetIgnoreBreakpoints(bool ignore = false) {
339 m_ignore_breakpoints = ignore;
340 }
341
342 bool DoesKeepInMemory() const { return m_keep_in_memory; }
343
344 void SetKeepInMemory(bool keep = true) { m_keep_in_memory = keep; }
345
347
348 void
350 m_use_dynamic = dynamic;
351 }
352
353 const Timeout<std::micro> &GetTimeout() const { return m_timeout; }
354
355 void SetTimeout(const Timeout<std::micro> &timeout) { m_timeout = timeout; }
356
359 }
360
362 m_one_thread_timeout = timeout;
363 }
364
365 bool GetTryAllThreads() const { return m_try_others; }
366
367 void SetTryAllThreads(bool try_others = true) { m_try_others = try_others; }
368
369 bool GetStopOthers() const { return m_stop_others; }
370
371 void SetStopOthers(bool stop_others = true) { m_stop_others = stop_others; }
372
373 bool GetDebug() const { return m_debug; }
374
375 void SetDebug(bool b) {
376 m_debug = b;
377 if (m_debug)
379 }
380
382
384
385 bool GetColorizeErrors() const { return m_ansi_color_errors; }
386
388
389 bool GetTrapExceptions() const { return m_trap_exceptions; }
390
392
393 bool GetREPLEnabled() const { return m_repl; }
394
395 void SetREPLEnabled(bool b) { m_repl = b; }
396
399 m_cancel_callback = callback;
400 }
401
403 return ((m_cancel_callback != nullptr)
405 : false);
406 }
407
408 // Allows the expression contents to be remapped to point to the specified
409 // file and line using #line directives.
410 void SetPoundLine(const char *path, uint32_t line) const {
411 if (path && path[0]) {
412 m_pound_line_file = path;
413 m_pound_line_line = line;
414 } else {
415 m_pound_line_file.clear();
417 }
418 }
419
420 const char *GetPoundLineFilePath() const {
421 return (m_pound_line_file.empty() ? nullptr : m_pound_line_file.c_str());
422 }
423
424 uint32_t GetPoundLineLine() const { return m_pound_line_line; }
425
427
430 }
431
433
435
436 void SetRetriesWithFixIts(uint64_t number_of_retries) {
437 m_retries_with_fixits = number_of_retries;
438 }
439
440 uint64_t GetRetriesWithFixIts() const { return m_retries_with_fixits; }
441
443
445
446private:
449 std::string m_prefix;
450 bool m_coerce_to_id = false;
451 bool m_unwind_on_error = true;
453 bool m_keep_in_memory = false;
454 bool m_try_others = true;
455 bool m_stop_others = true;
456 bool m_debug = false;
457 bool m_trap_exceptions = true;
458 bool m_repl = false;
464 /// True if the executed code should be treated as utility code that is only
465 /// used by LLDB internally.
467
472 void *m_cancel_callback_baton = nullptr;
473 // If m_pound_line_file is not empty and m_pound_line_line is non-zero, use
474 // #line %u "%s" before the expression content to remap where the source
475 // originates
476 mutable std::string m_pound_line_file;
477 mutable uint32_t m_pound_line_line = 0;
478};
479
480// Target
481class Target : public std::enable_shared_from_this<Target>,
482 public TargetProperties,
483 public Broadcaster,
485 public ModuleList::Notifier {
486public:
487 friend class TargetList;
488 friend class Debugger;
489
490 /// Broadcaster event bits definitions.
491 enum {
498 };
499
500 // These two functions fill out the Broadcaster interface:
501
503
506 }
507
508 // This event data class is for use by the TargetList to broadcast new target
509 // notifications.
510 class TargetEventData : public EventData {
511 public:
512 TargetEventData(const lldb::TargetSP &target_sp);
513
514 TargetEventData(const lldb::TargetSP &target_sp,
515 const ModuleList &module_list);
516
518
519 static llvm::StringRef GetFlavorString();
520
521 llvm::StringRef GetFlavor() const override {
523 }
524
525 void Dump(Stream *s) const override;
526
527 static const TargetEventData *GetEventDataFromEvent(const Event *event_ptr);
528
529 static lldb::TargetSP GetTargetFromEvent(const Event *event_ptr);
530
531 static ModuleList GetModuleListFromEvent(const Event *event_ptr);
532
533 const lldb::TargetSP &GetTarget() const { return m_target_sp; }
534
535 const ModuleList &GetModuleList() const { return m_module_list; }
536
537 private:
540
542 const TargetEventData &operator=(const TargetEventData &) = delete;
543 };
544
545 ~Target() override;
546
547 static void SettingsInitialize();
548
549 static void SettingsTerminate();
550
552
554
556
557 static void SetDefaultArchitecture(const ArchSpec &arch);
558
559 bool IsDummyTarget() const { return m_is_dummy_target; }
560
561 const std::string &GetLabel() const { return m_label; }
562
563 /// Set a label for a target.
564 ///
565 /// The label cannot be used by another target or be only integral.
566 ///
567 /// \return
568 /// The label for this target or an error if the label didn't match the
569 /// requirements.
570 llvm::Error SetLabel(llvm::StringRef label);
571
572 /// Find a binary on the system and return its Module,
573 /// or return an existing Module that is already in the Target.
574 ///
575 /// Given a ModuleSpec, find a binary satisifying that specification,
576 /// or identify a matching Module already present in the Target,
577 /// and return a shared pointer to it.
578 ///
579 /// \param[in] module_spec
580 /// The criteria that must be matched for the binary being loaded.
581 /// e.g. UUID, architecture, file path.
582 ///
583 /// \param[in] notify
584 /// If notify is true, and the Module is new to this Target,
585 /// Target::ModulesDidLoad will be called.
586 /// If notify is false, it is assumed that the caller is adding
587 /// multiple Modules and will call ModulesDidLoad with the
588 /// full list at the end.
589 /// ModulesDidLoad must be called when a Module/Modules have
590 /// been added to the target, one way or the other.
591 ///
592 /// \param[out] error_ptr
593 /// Optional argument, pointing to a Status object to fill in
594 /// with any results / messages while attempting to find/load
595 /// this binary. Many callers will be internal functions that
596 /// will handle / summarize the failures in a custom way and
597 /// don't use these messages.
598 ///
599 /// \return
600 /// An empty ModuleSP will be returned if no matching file
601 /// was found. If error_ptr was non-nullptr, an error message
602 /// will likely be provided.
603 lldb::ModuleSP GetOrCreateModule(const ModuleSpec &module_spec, bool notify,
604 Status *error_ptr = nullptr);
605
606 // Settings accessors
607
609
610 std::recursive_mutex &GetAPIMutex();
611
613
614 void CleanupProcess();
615
616 /// Dump a description of this object to a Stream.
617 ///
618 /// Dump a description of the contents of this object to the
619 /// supplied stream \a s. The dumped content will be only what has
620 /// been loaded or parsed up to this point at which this function
621 /// is called, so this is a good way to see what has been parsed
622 /// in a target.
623 ///
624 /// \param[in] s
625 /// The stream to which to dump the object description.
626 void Dump(Stream *s, lldb::DescriptionLevel description_level);
627
628 // If listener_sp is null, the listener of the owning Debugger object will be
629 // used.
631 llvm::StringRef plugin_name,
632 const FileSpec *crash_file,
633 bool can_connect);
634
635 const lldb::ProcessSP &GetProcessSP() const;
636
637 bool IsValid() { return m_valid; }
638
639 void Destroy();
640
641 Status Launch(ProcessLaunchInfo &launch_info,
642 Stream *stream); // Optional stream to receive first stop info
643
644 Status Attach(ProcessAttachInfo &attach_info,
645 Stream *stream); // Optional stream to receive first stop info
646
647 // This part handles the breakpoints.
648
649 BreakpointList &GetBreakpointList(bool internal = false);
650
651 const BreakpointList &GetBreakpointList(bool internal = false) const;
652
655 }
656
658
660
661 // Use this to create a file and line breakpoint to a given module or all
662 // module it is nullptr
663 lldb::BreakpointSP CreateBreakpoint(const FileSpecList *containingModules,
664 const FileSpec &file, uint32_t line_no,
665 uint32_t column, lldb::addr_t offset,
666 LazyBool check_inlines,
667 LazyBool skip_prologue, bool internal,
668 bool request_hardware,
669 LazyBool move_to_nearest_code);
670
671 // Use this to create breakpoint that matches regex against the source lines
672 // in files given in source_file_list: If function_names is non-empty, also
673 // filter by function after the matches are made.
675 const FileSpecList *containingModules,
676 const FileSpecList *source_file_list,
677 const std::unordered_set<std::string> &function_names,
678 RegularExpression source_regex, bool internal, bool request_hardware,
679 LazyBool move_to_nearest_code);
680
681 // Use this to create a breakpoint from a load address
682 lldb::BreakpointSP CreateBreakpoint(lldb::addr_t load_addr, bool internal,
683 bool request_hardware);
684
685 // Use this to create a breakpoint from a load address and a module file spec
687 bool internal,
688 const FileSpec &file_spec,
689 bool request_hardware);
690
691 // Use this to create Address breakpoints:
692 lldb::BreakpointSP CreateBreakpoint(const Address &addr, bool internal,
693 bool request_hardware);
694
695 // Use this to create a function breakpoint by regexp in
696 // containingModule/containingSourceFiles, or all modules if it is nullptr
697 // When "skip_prologue is set to eLazyBoolCalculate, we use the current
698 // target setting, else we use the values passed in
700 const FileSpecList *containingModules,
701 const FileSpecList *containingSourceFiles, RegularExpression func_regexp,
702 lldb::LanguageType requested_language, LazyBool skip_prologue,
703 bool internal, bool request_hardware);
704
705 // Use this to create a function breakpoint by name in containingModule, or
706 // all modules if it is nullptr When "skip_prologue is set to
707 // eLazyBoolCalculate, we use the current target setting, else we use the
708 // values passed in. func_name_type_mask is or'ed values from the
709 // FunctionNameType enum.
711 const FileSpecList *containingModules,
712 const FileSpecList *containingSourceFiles, const char *func_name,
713 lldb::FunctionNameType func_name_type_mask, lldb::LanguageType language,
714 lldb::addr_t offset, LazyBool skip_prologue, bool internal,
715 bool request_hardware);
716
718 CreateExceptionBreakpoint(enum lldb::LanguageType language, bool catch_bp,
719 bool throw_bp, bool internal,
720 Args *additional_args = nullptr,
721 Status *additional_args_error = nullptr);
722
724 const llvm::StringRef class_name, const FileSpecList *containingModules,
725 const FileSpecList *containingSourceFiles, bool internal,
726 bool request_hardware, StructuredData::ObjectSP extra_args_sp,
727 Status *creation_error = nullptr);
728
729 // This is the same as the func_name breakpoint except that you can specify a
730 // vector of names. This is cheaper than a regular expression breakpoint in
731 // the case where you just want to set a breakpoint on a set of names you
732 // already know. func_name_type_mask is or'ed values from the
733 // FunctionNameType enum.
735 const FileSpecList *containingModules,
736 const FileSpecList *containingSourceFiles, const char *func_names[],
737 size_t num_names, lldb::FunctionNameType func_name_type_mask,
738 lldb::LanguageType language, lldb::addr_t offset, LazyBool skip_prologue,
739 bool internal, bool request_hardware);
740
742 CreateBreakpoint(const FileSpecList *containingModules,
743 const FileSpecList *containingSourceFiles,
744 const std::vector<std::string> &func_names,
745 lldb::FunctionNameType func_name_type_mask,
746 lldb::LanguageType language, lldb::addr_t m_offset,
747 LazyBool skip_prologue, bool internal,
748 bool request_hardware);
749
750 // Use this to create a general breakpoint:
752 lldb::BreakpointResolverSP &resolver_sp,
753 bool internal, bool request_hardware,
754 bool resolve_indirect_symbols);
755
756 // Use this to create a watchpoint:
758 const CompilerType *type, uint32_t kind,
759 Status &error);
760
763 }
764
766
767 // Manages breakpoint names:
768 void AddNameToBreakpoint(BreakpointID &id, llvm::StringRef name,
769 Status &error);
770
771 void AddNameToBreakpoint(lldb::BreakpointSP &bp_sp, llvm::StringRef name,
772 Status &error);
773
775
776 BreakpointName *FindBreakpointName(ConstString name, bool can_create,
777 Status &error);
778
780
782 const BreakpointOptions &options,
783 const BreakpointName::Permissions &permissions);
785
786 void AddBreakpointName(std::unique_ptr<BreakpointName> bp_name);
787
788 void GetBreakpointNames(std::vector<std::string> &names);
789
790 // This call removes ALL breakpoints regardless of permission.
791 void RemoveAllBreakpoints(bool internal_also = false);
792
793 // This removes all the breakpoints, but obeys the ePermDelete on them.
795
796 void DisableAllBreakpoints(bool internal_also = false);
797
799
800 void EnableAllBreakpoints(bool internal_also = false);
801
803
805
807
809
810 /// Resets the hit count of all breakpoints.
812
813 // The flag 'end_to_end', default to true, signifies that the operation is
814 // performed end to end, for both the debugger and the debuggee.
815
816 bool RemoveAllWatchpoints(bool end_to_end = true);
817
818 bool DisableAllWatchpoints(bool end_to_end = true);
819
820 bool EnableAllWatchpoints(bool end_to_end = true);
821
823
825
826 bool IgnoreAllWatchpoints(uint32_t ignore_count);
827
829
831
833
834 bool IgnoreWatchpointByID(lldb::watch_id_t watch_id, uint32_t ignore_count);
835
837 const BreakpointIDList &bp_ids,
838 bool append);
839
841 BreakpointIDList &new_bps);
842
844 std::vector<std::string> &names,
845 BreakpointIDList &new_bps);
846
847 /// Get \a load_addr as a callable code load address for this target
848 ///
849 /// Take \a load_addr and potentially add any address bits that are
850 /// needed to make the address callable. For ARM this can set bit
851 /// zero (if it already isn't) if \a load_addr is a thumb function.
852 /// If \a addr_class is set to AddressClass::eInvalid, then the address
853 /// adjustment will always happen. If it is set to an address class
854 /// that doesn't have code in it, LLDB_INVALID_ADDRESS will be
855 /// returned.
857 lldb::addr_t load_addr,
858 AddressClass addr_class = AddressClass::eInvalid) const;
859
860 /// Get \a load_addr as an opcode for this target.
861 ///
862 /// Take \a load_addr and potentially strip any address bits that are
863 /// needed to make the address point to an opcode. For ARM this can
864 /// clear bit zero (if it already isn't) if \a load_addr is a
865 /// thumb function and load_addr is in code.
866 /// If \a addr_class is set to AddressClass::eInvalid, then the address
867 /// adjustment will always happen. If it is set to an address class
868 /// that doesn't have code in it, LLDB_INVALID_ADDRESS will be
869 /// returned.
872 AddressClass addr_class = AddressClass::eInvalid) const;
873
874 // Get load_addr as breakable load address for this target. Take a addr and
875 // check if for any reason there is a better address than this to put a
876 // breakpoint on. If there is then return that address. For MIPS, if
877 // instruction at addr is a delay slot instruction then this method will find
878 // the address of its previous instruction and return that address.
880
881 void ModulesDidLoad(ModuleList &module_list);
882
883 void ModulesDidUnload(ModuleList &module_list, bool delete_locations);
884
885 void SymbolsDidLoad(ModuleList &module_list);
886
887 void ClearModules(bool delete_locations);
888
889 /// Called as the last function in Process::DidExec().
890 ///
891 /// Process::DidExec() will clear a lot of state in the process,
892 /// then try to reload a dynamic loader plugin to discover what
893 /// binaries are currently available and then this function should
894 /// be called to allow the target to do any cleanup after everything
895 /// has been figured out. It can remove breakpoints that no longer
896 /// make sense as the exec might have changed the target
897 /// architecture, and unloaded some modules that might get deleted.
898 void DidExec();
899
900 /// Gets the module for the main executable.
901 ///
902 /// Each process has a notion of a main executable that is the file
903 /// that will be executed or attached to. Executable files can have
904 /// dependent modules that are discovered from the object files, or
905 /// discovered at runtime as things are dynamically loaded.
906 ///
907 /// \return
908 /// The shared pointer to the executable module which can
909 /// contains a nullptr Module object if no executable has been
910 /// set.
911 ///
912 /// \see DynamicLoader
913 /// \see ObjectFile::GetDependentModules (FileSpecList&)
914 /// \see Process::SetExecutableModule(lldb::ModuleSP&)
916
918
919 /// Set the main executable module.
920 ///
921 /// Each process has a notion of a main executable that is the file
922 /// that will be executed or attached to. Executable files can have
923 /// dependent modules that are discovered from the object files, or
924 /// discovered at runtime as things are dynamically loaded.
925 ///
926 /// Setting the executable causes any of the current dependent
927 /// image information to be cleared and replaced with the static
928 /// dependent image information found by calling
929 /// ObjectFile::GetDependentModules (FileSpecList&) on the main
930 /// executable and any modules on which it depends. Calling
931 /// Process::GetImages() will return the newly found images that
932 /// were obtained from all of the object files.
933 ///
934 /// \param[in] module_sp
935 /// A shared pointer reference to the module that will become
936 /// the main executable for this process.
937 ///
938 /// \param[in] load_dependent_files
939 /// If \b true then ask the object files to track down any
940 /// known dependent files.
941 ///
942 /// \see ObjectFile::GetDependentModules (FileSpecList&)
943 /// \see Process::GetImages()
945 lldb::ModuleSP &module_sp,
946 LoadDependentFiles load_dependent_files = eLoadDependentsDefault);
947
948 bool LoadScriptingResources(std::list<Status> &errors,
949 Stream &feedback_stream,
950 bool continue_on_error = true) {
952 this, errors, feedback_stream, continue_on_error);
953 }
954
955 /// Get accessor for the images for this process.
956 ///
957 /// Each process has a notion of a main executable that is the file
958 /// that will be executed or attached to. Executable files can have
959 /// dependent modules that are discovered from the object files, or
960 /// discovered at runtime as things are dynamically loaded. After
961 /// a main executable has been set, the images will contain a list
962 /// of all the files that the executable depends upon as far as the
963 /// object files know. These images will usually contain valid file
964 /// virtual addresses only. When the process is launched or attached
965 /// to, the DynamicLoader plug-in will discover where these images
966 /// were loaded in memory and will resolve the load virtual
967 /// addresses is each image, and also in images that are loaded by
968 /// code.
969 ///
970 /// \return
971 /// A list of Module objects in a module list.
972 const ModuleList &GetImages() const { return m_images; }
973
975
976 /// Return whether this FileSpec corresponds to a module that should be
977 /// considered for general searches.
978 ///
979 /// This API will be consulted by the SearchFilterForUnconstrainedSearches
980 /// and any module that returns \b true will not be searched. Note the
981 /// SearchFilterForUnconstrainedSearches is the search filter that
982 /// gets used in the CreateBreakpoint calls when no modules is provided.
983 ///
984 /// The target call at present just consults the Platform's call of the
985 /// same name.
986 ///
987 /// \param[in] module_spec
988 /// Path to the module.
989 ///
990 /// \return \b true if the module should be excluded, \b false otherwise.
991 bool ModuleIsExcludedForUnconstrainedSearches(const FileSpec &module_spec);
992
993 /// Return whether this module should be considered for general searches.
994 ///
995 /// This API will be consulted by the SearchFilterForUnconstrainedSearches
996 /// and any module that returns \b true will not be searched. Note the
997 /// SearchFilterForUnconstrainedSearches is the search filter that
998 /// gets used in the CreateBreakpoint calls when no modules is provided.
999 ///
1000 /// The target call at present just consults the Platform's call of the
1001 /// same name.
1002 ///
1003 /// FIXME: When we get time we should add a way for the user to set modules
1004 /// that they
1005 /// don't want searched, in addition to or instead of the platform ones.
1006 ///
1007 /// \param[in] module_sp
1008 /// A shared pointer reference to the module that checked.
1009 ///
1010 /// \return \b true if the module should be excluded, \b false otherwise.
1011 bool
1013
1014 const ArchSpec &GetArchitecture() const { return m_arch.GetSpec(); }
1015
1016 /// Returns the name of the target's ABI plugin.
1017 llvm::StringRef GetABIName() const;
1018
1019 /// Set the architecture for this target.
1020 ///
1021 /// If the current target has no Images read in, then this just sets the
1022 /// architecture, which will be used to select the architecture of the
1023 /// ExecutableModule when that is set. If the current target has an
1024 /// ExecutableModule, then calling SetArchitecture with a different
1025 /// architecture from the currently selected one will reset the
1026 /// ExecutableModule to that slice of the file backing the ExecutableModule.
1027 /// If the file backing the ExecutableModule does not contain a fork of this
1028 /// architecture, then this code will return false, and the architecture
1029 /// won't be changed. If the input arch_spec is the same as the already set
1030 /// architecture, this is a no-op.
1031 ///
1032 /// \param[in] arch_spec
1033 /// The new architecture.
1034 ///
1035 /// \param[in] set_platform
1036 /// If \b true, then the platform will be adjusted if the currently
1037 /// selected platform is not compatible with the architecture being set.
1038 /// If \b false, then just the architecture will be set even if the
1039 /// currently selected platform isn't compatible (in case it might be
1040 /// manually set following this function call).
1041 ///
1042 /// \param[in] merged
1043 /// If true, arch_spec is merged with the current
1044 /// architecture. Otherwise it's replaced.
1045 ///
1046 /// \return
1047 /// \b true if the architecture was successfully set, \b false otherwise.
1048 bool SetArchitecture(const ArchSpec &arch_spec, bool set_platform = false,
1049 bool merge = true);
1050
1051 bool MergeArchitecture(const ArchSpec &arch_spec);
1052
1054
1056
1057 size_t ReadMemoryFromFileCache(const Address &addr, void *dst, size_t dst_len,
1058 Status &error);
1059
1060 // Reading memory through the target allows us to skip going to the process
1061 // for reading memory if possible and it allows us to try and read from any
1062 // constant sections in our object files on disk. If you always want live
1063 // program memory, read straight from the process. If you possibly want to
1064 // read from const sections in object files, read from the target. This
1065 // version of ReadMemory will try and read memory from the process if the
1066 // process is alive. The order is:
1067 // 1 - if (force_live_memory == false) and the address falls in a read-only
1068 // section, then read from the file cache
1069 // 2 - if there is a process, then read from memory
1070 // 3 - if there is no process, then read from the file cache
1071 size_t ReadMemory(const Address &addr, void *dst, size_t dst_len,
1072 Status &error, bool force_live_memory = false,
1073 lldb::addr_t *load_addr_ptr = nullptr);
1074
1075 size_t ReadCStringFromMemory(const Address &addr, std::string &out_str,
1076 Status &error, bool force_live_memory = false);
1077
1078 size_t ReadCStringFromMemory(const Address &addr, char *dst,
1079 size_t dst_max_len, Status &result_error,
1080 bool force_live_memory = false);
1081
1082 /// Read a NULL terminated string from memory
1083 ///
1084 /// This function will read a cache page at a time until a NULL string
1085 /// terminator is found. It will stop reading if an aligned sequence of NULL
1086 /// termination \a type_width bytes is not found before reading \a
1087 /// cstr_max_len bytes. The results are always guaranteed to be NULL
1088 /// terminated, and that no more than (max_bytes - type_width) bytes will be
1089 /// read.
1090 ///
1091 /// \param[in] addr
1092 /// The address to start the memory read.
1093 ///
1094 /// \param[in] dst
1095 /// A character buffer containing at least max_bytes.
1096 ///
1097 /// \param[in] max_bytes
1098 /// The maximum number of bytes to read.
1099 ///
1100 /// \param[in] error
1101 /// The error status of the read operation.
1102 ///
1103 /// \param[in] type_width
1104 /// The size of the null terminator (1 to 4 bytes per
1105 /// character). Defaults to 1.
1106 ///
1107 /// \return
1108 /// The error status or the number of bytes prior to the null terminator.
1109 size_t ReadStringFromMemory(const Address &addr, char *dst, size_t max_bytes,
1110 Status &error, size_t type_width,
1111 bool force_live_memory = true);
1112
1113 size_t ReadScalarIntegerFromMemory(const Address &addr, uint32_t byte_size,
1114 bool is_signed, Scalar &scalar,
1115 Status &error,
1116 bool force_live_memory = false);
1117
1118 uint64_t ReadUnsignedIntegerFromMemory(const Address &addr,
1119 size_t integer_byte_size,
1120 uint64_t fail_value, Status &error,
1121 bool force_live_memory = false);
1122
1123 bool ReadPointerFromMemory(const Address &addr, Status &error,
1124 Address &pointer_addr,
1125 bool force_live_memory = false);
1126
1129 }
1130
1131 static Target *GetTargetFromContexts(const ExecutionContext *exe_ctx_ptr,
1132 const SymbolContext *sc_ptr);
1133
1134 // lldb::ExecutionContextScope pure virtual functions
1136
1138
1140
1142
1143 void CalculateExecutionContext(ExecutionContext &exe_ctx) override;
1144
1146
1147 llvm::Expected<lldb::TypeSystemSP>
1149 bool create_on_demand = true);
1150
1151 std::vector<lldb::TypeSystemSP>
1152 GetScratchTypeSystems(bool create_on_demand = true);
1153
1156
1157 // Creates a UserExpression for the given language, the rest of the
1158 // parameters have the same meaning as for the UserExpression constructor.
1159 // Returns a new-ed object which the caller owns.
1160
1162 GetUserExpressionForLanguage(llvm::StringRef expr, llvm::StringRef prefix,
1163 lldb::LanguageType language,
1164 Expression::ResultType desired_type,
1165 const EvaluateExpressionOptions &options,
1166 ValueObject *ctx_obj, Status &error);
1167
1168 // Creates a FunctionCaller for the given language, the rest of the
1169 // parameters have the same meaning as for the FunctionCaller constructor.
1170 // Since a FunctionCaller can't be
1171 // IR Interpreted, it makes no sense to call this with an
1172 // ExecutionContextScope that lacks
1173 // a Process.
1174 // Returns a new-ed object which the caller owns.
1175
1177 const CompilerType &return_type,
1178 const Address &function_address,
1179 const ValueList &arg_value_list,
1180 const char *name, Status &error);
1181
1182 /// Creates and installs a UtilityFunction for the given language.
1183 llvm::Expected<std::unique_ptr<UtilityFunction>>
1184 CreateUtilityFunction(std::string expression, std::string name,
1185 lldb::LanguageType language, ExecutionContext &exe_ctx);
1186
1187 // Install any files through the platform that need be to installed prior to
1188 // launching or attaching.
1189 Status Install(ProcessLaunchInfo *launch_info);
1190
1191 bool ResolveFileAddress(lldb::addr_t load_addr, Address &so_addr);
1192
1193 bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr,
1194 uint32_t stop_id = SectionLoadHistory::eStopIDNow);
1195
1196 bool SetSectionLoadAddress(const lldb::SectionSP &section,
1197 lldb::addr_t load_addr,
1198 bool warn_multiple = false);
1199
1200 size_t UnloadModuleSections(const lldb::ModuleSP &module_sp);
1201
1202 size_t UnloadModuleSections(const ModuleList &module_list);
1203
1204 bool SetSectionUnloaded(const lldb::SectionSP &section_sp);
1205
1206 bool SetSectionUnloaded(const lldb::SectionSP &section_sp,
1207 lldb::addr_t load_addr);
1208
1210
1211 /// Set the \a Trace object containing processor trace information of this
1212 /// target.
1213 ///
1214 /// \param[in] trace_sp
1215 /// The trace object.
1216 void SetTrace(const lldb::TraceSP &trace_sp);
1217
1218 /// Get the \a Trace object containing processor trace information of this
1219 /// target.
1220 ///
1221 /// \return
1222 /// The trace object. It might be undefined.
1224
1225 /// Create a \a Trace object for the current target using the using the
1226 /// default supported tracing technology for this process.
1227 ///
1228 /// \return
1229 /// The new \a Trace or an \a llvm::Error if a \a Trace already exists or
1230 /// the trace couldn't be created.
1231 llvm::Expected<lldb::TraceSP> CreateTrace();
1232
1233 /// If a \a Trace object is present, this returns it, otherwise a new Trace is
1234 /// created with \a Trace::CreateTrace.
1235 llvm::Expected<lldb::TraceSP> GetTraceOrCreate();
1236
1237 // Since expressions results can persist beyond the lifetime of a process,
1238 // and the const expression results are available after a process is gone, we
1239 // provide a way for expressions to be evaluated from the Target itself. If
1240 // an expression is going to be run, then it should have a frame filled in in
1241 // the execution context.
1243 llvm::StringRef expression, ExecutionContextScope *exe_scope,
1244 lldb::ValueObjectSP &result_valobj_sp,
1246 std::string *fixed_expression = nullptr, ValueObject *ctx_obj = nullptr);
1247
1249
1251
1252 /// This method will return the address of the starting function for
1253 /// this binary, e.g. main() or its equivalent. This can be used as
1254 /// an address of a function that is not called once a binary has
1255 /// started running - e.g. as a return address for inferior function
1256 /// calls that are unambiguous completion of the function call, not
1257 /// called during the course of the inferior function code running.
1258 ///
1259 /// If no entry point can be found, an invalid address is returned.
1260 ///
1261 /// \param [out] err
1262 /// This object will be set to failure if no entry address could
1263 /// be found, and may contain a helpful error message.
1264 //
1265 /// \return
1266 /// Returns the entry address for this program, or an error
1267 /// if none can be found.
1268 llvm::Expected<lldb_private::Address> GetEntryPointAddress();
1269
1270 CompilerType GetRegisterType(const std::string &name,
1271 const lldb_private::RegisterFlags &flags,
1272 uint32_t byte_size);
1273
1274 // Target Stop Hooks
1275 class StopHook : public UserID {
1276 public:
1277 StopHook(const StopHook &rhs);
1278 virtual ~StopHook() = default;
1279
1280 enum class StopHookKind : uint32_t { CommandBased = 0, ScriptBased };
1281 enum class StopHookResult : uint32_t {
1282 KeepStopped = 0,
1285 };
1286
1288
1289 // Set the specifier. The stop hook will own the specifier, and is
1290 // responsible for deleting it when we're done.
1291 void SetSpecifier(SymbolContextSpecifier *specifier);
1292
1294
1295 bool ExecutionContextPasses(const ExecutionContext &exe_ctx);
1296
1297 // Called on stop, this gets passed the ExecutionContext for each "stop
1298 // with a reason" thread. It should add to the stream whatever text it
1299 // wants to show the user, and return False to indicate it wants the target
1300 // not to stop.
1302 lldb::StreamSP output) = 0;
1303
1304 // Set the Thread Specifier. The stop hook will own the thread specifier,
1305 // and is responsible for deleting it when we're done.
1306 void SetThreadSpecifier(ThreadSpec *specifier);
1307
1309
1310 bool IsActive() { return m_active; }
1311
1312 void SetIsActive(bool is_active) { m_active = is_active; }
1313
1314 void SetAutoContinue(bool auto_continue) {
1315 m_auto_continue = auto_continue;
1316 }
1317
1318 bool GetAutoContinue() const { return m_auto_continue; }
1319
1320 void GetDescription(Stream &s, lldb::DescriptionLevel level) const;
1322 lldb::DescriptionLevel level) const = 0;
1323
1324 protected:
1327 std::unique_ptr<ThreadSpec> m_thread_spec_up;
1328 bool m_active = true;
1329 bool m_auto_continue = false;
1330
1331 StopHook(lldb::TargetSP target_sp, lldb::user_id_t uid);
1332 };
1333
1335 public:
1336 ~StopHookCommandLine() override = default;
1337
1339 void SetActionFromString(const std::string &strings);
1340 void SetActionFromStrings(const std::vector<std::string> &strings);
1341
1343 lldb::StreamSP output_sp) override;
1345 lldb::DescriptionLevel level) const override;
1346
1347 private:
1349 // Use CreateStopHook to make a new empty stop hook. The GetCommandPointer
1350 // and fill it with commands, and SetSpecifier to set the specifier shared
1351 // pointer (can be null, that will match anything.)
1353 : StopHook(target_sp, uid) {}
1354 friend class Target;
1355 };
1356
1358 public:
1359 ~StopHookScripted() override = default;
1361 lldb::StreamSP output) override;
1362
1363 Status SetScriptCallback(std::string class_name,
1364 StructuredData::ObjectSP extra_args_sp);
1365
1367 lldb::DescriptionLevel level) const override;
1368
1369 private:
1370 std::string m_class_name;
1371 /// This holds the dictionary of keys & values that can be used to
1372 /// parametrize any given callback's behavior.
1374 /// This holds the python callback object.
1376
1377 /// Use CreateStopHook to make a new empty stop hook. The GetCommandPointer
1378 /// and fill it with commands, and SetSpecifier to set the specifier shared
1379 /// pointer (can be null, that will match anything.)
1381 : StopHook(target_sp, uid) {}
1382 friend class Target;
1383 };
1384
1385 typedef std::shared_ptr<StopHook> StopHookSP;
1386
1387 /// Add an empty stop hook to the Target's stop hook list, and returns a
1388 /// shared pointer to it in new_hook. Returns the id of the new hook.
1390
1391 /// If you tried to create a stop hook, and that failed, call this to
1392 /// remove the stop hook, as it will also reset the stop hook counter.
1394
1395 // Runs the stop hooks that have been registered for this target.
1396 // Returns true if the stop hooks cause the target to resume.
1397 bool RunStopHooks();
1398
1400
1401 bool SetSuppresStopHooks(bool suppress) {
1402 bool old_value = m_suppress_stop_hooks;
1403 m_suppress_stop_hooks = suppress;
1404 return old_value;
1405 }
1406
1408
1410
1411 void RemoveAllStopHooks();
1412
1414
1415 bool SetStopHookActiveStateByID(lldb::user_id_t uid, bool active_state);
1416
1417 void SetAllStopHooksActiveState(bool active_state);
1418
1419 size_t GetNumStopHooks() const { return m_stop_hooks.size(); }
1420
1422 if (index >= GetNumStopHooks())
1423 return StopHookSP();
1424 StopHookCollection::iterator pos = m_stop_hooks.begin();
1425
1426 while (index > 0) {
1427 pos++;
1428 index--;
1429 }
1430 return (*pos).second;
1431 }
1432
1434
1435 void SetPlatform(const lldb::PlatformSP &platform_sp) {
1436 m_platform_sp = platform_sp;
1437 }
1438
1440
1441 // Methods.
1443 GetSearchFilterForModule(const FileSpec *containingModule);
1444
1446 GetSearchFilterForModuleList(const FileSpecList *containingModuleList);
1447
1449 GetSearchFilterForModuleAndCUList(const FileSpecList *containingModules,
1450 const FileSpecList *containingSourceFiles);
1451
1453 const char *repl_options, bool can_create);
1454
1455 void SetREPL(lldb::LanguageType language, lldb::REPLSP repl_sp);
1456
1459 }
1460
1462
1463 /// Add a signal for the target. This will get copied over to the process
1464 /// if the signal exists on that target. Only the values with Yes and No are
1465 /// set, Calculate values will be ignored.
1466protected:
1472 : pass(pass), notify(notify), stop(stop) {}
1474 };
1475 using DummySignalElement = llvm::StringMapEntry<DummySignalValues>;
1476 static bool UpdateSignalFromDummy(lldb::UnixSignalsSP signals_sp,
1477 const DummySignalElement &element);
1478 static bool ResetSignalFromDummy(lldb::UnixSignalsSP signals_sp,
1479 const DummySignalElement &element);
1480
1481public:
1482 /// Add a signal to the Target's list of stored signals/actions. These
1483 /// values will get copied into any processes launched from
1484 /// this target.
1485 void AddDummySignal(llvm::StringRef name, LazyBool pass, LazyBool print,
1486 LazyBool stop);
1487 /// Updates the signals in signals_sp using the stored dummy signals.
1488 /// If warning_stream_sp is not null, if any stored signals are not found in
1489 /// the current process, a warning will be emitted here.
1491 lldb::StreamSP warning_stream_sp);
1492 /// Clear the dummy signals in signal_names from the target, or all signals
1493 /// if signal_names is empty. Also remove the behaviors they set from the
1494 /// process's signals if it exists.
1495 void ClearDummySignals(Args &signal_names);
1496 /// Print all the signals set in this target.
1497 void PrintDummySignals(Stream &strm, Args &signals);
1498
1499protected:
1500 /// Implementing of ModuleList::Notifier.
1501
1502 void NotifyModuleAdded(const ModuleList &module_list,
1503 const lldb::ModuleSP &module_sp) override;
1504
1505 void NotifyModuleRemoved(const ModuleList &module_list,
1506 const lldb::ModuleSP &module_sp) override;
1507
1508 void NotifyModuleUpdated(const ModuleList &module_list,
1509 const lldb::ModuleSP &old_module_sp,
1510 const lldb::ModuleSP &new_module_sp) override;
1511
1512 void NotifyWillClearList(const ModuleList &module_list) override;
1513
1514 void NotifyModulesRemoved(lldb_private::ModuleList &module_list) override;
1515
1516 class Arch {
1517 public:
1518 explicit Arch(const ArchSpec &spec);
1519 const Arch &operator=(const ArchSpec &spec);
1520
1521 const ArchSpec &GetSpec() const { return m_spec; }
1522 Architecture *GetPlugin() const { return m_plugin_up.get(); }
1523
1524 private:
1526 std::unique_ptr<Architecture> m_plugin_up;
1527 };
1528
1529 // Member variables.
1531 lldb::PlatformSP m_platform_sp; ///< The platform for this target.
1532 std::recursive_mutex m_mutex; ///< An API mutex that is used by the lldb::SB*
1533 /// classes make the SB interface thread safe
1534 /// When the private state thread calls SB API's - usually because it is
1535 /// running OS plugin or Python ThreadPlan code - it should not block on the
1536 /// API mutex that is held by the code that kicked off the sequence of events
1537 /// that led us to run the code. We hand out this mutex instead when we
1538 /// detect that code is running on the private state thread.
1539 std::recursive_mutex m_private_mutex;
1541 std::string m_label;
1542 ModuleList m_images; ///< The list of images for this process (shared
1543 /// libraries and anything dynamically loaded).
1548 std::map<ConstString, std::unique_ptr<BreakpointName>>;
1550
1554 // We want to tightly control the process destruction process so we can
1555 // correctly tear down everything that we need to, so the only class that
1556 // knows about the process lifespan is this target class.
1561
1562 typedef std::map<lldb::LanguageType, lldb::REPLSP> REPLMap;
1564
1566
1567 typedef std::map<lldb::user_id_t, StopHookSP> StopHookCollection;
1570 uint32_t m_latest_stop_hook_id; /// This records the last natural stop at
1571 /// which we ran a stop-hook.
1573 bool m_suppress_stop_hooks; /// Used to not run stop hooks for expressions
1576 /// An optional \a lldb_private::Trace object containing processor trace
1577 /// information of this target.
1579 /// Stores the frame recognizers of this target.
1581 /// These are used to set the signal state when you don't have a process and
1582 /// more usefully in the Dummy target where you can't know exactly what
1583 /// signals you will have.
1584 llvm::StringMap<DummySignalValues> m_dummy_signals;
1585
1586 static void ImageSearchPathsChanged(const PathMappingList &path_list,
1587 void *baton);
1588
1589 // Utilities for `statistics` command.
1590private:
1591 // Target metrics storage.
1593
1594public:
1595 /// Get metrics associated with this target in JSON format.
1596 ///
1597 /// Target metrics help measure timings and information that is contained in
1598 /// a target. These are designed to help measure performance of a debug
1599 /// session as well as represent the current state of the target, like
1600 /// information on the currently modules, currently set breakpoints and more.
1601 ///
1602 /// \return
1603 /// Returns a JSON value that contains all target metrics.
1604 llvm::json::Value
1606
1608
1609private:
1610 /// Construct with optional file and arch.
1611 ///
1612 /// This member is private. Clients must use
1613 /// TargetList::CreateTarget(const FileSpec*, const ArchSpec*)
1614 /// so all targets can be tracked from the central target list.
1615 ///
1616 /// \see TargetList::CreateTarget(const FileSpec*, const ArchSpec*)
1617 Target(Debugger &debugger, const ArchSpec &target_arch,
1618 const lldb::PlatformSP &platform_sp, bool is_dummy_target);
1619
1620 // Helper function.
1621 bool ProcessIsValid();
1622
1623 // Copy breakpoints, stop hooks and so forth from the dummy target:
1624 void PrimeFromDummyTarget(Target &target);
1625
1626 void AddBreakpoint(lldb::BreakpointSP breakpoint_sp, bool internal);
1627
1629
1630 /// Return a recommended size for memory reads at \a addr, optimizing for
1631 /// cache usage.
1633
1634 Target(const Target &) = delete;
1635 const Target &operator=(const Target &) = delete;
1636};
1637
1638} // namespace lldb_private
1639
1640#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:145
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:79
void SetLanguage(lldb::LanguageType language)
Definition: Target.h:315
const char * GetPrefix() const
Definition: Target.h:319
void SetOneThreadTimeout(const Timeout< std::micro > &timeout)
Definition: Target.h:361
uint64_t GetRetriesWithFixIts() const
Definition: Target.h:440
void SetUnwindOnError(bool unwind=false)
Definition: Target.h:334
const char * GetPoundLineFilePath() const
Definition: Target.h:420
lldb::DynamicValueType m_use_dynamic
Definition: Target.h:468
void SetExecutionPolicy(ExecutionPolicy policy=eExecutionPolicyAlways)
Definition: Target.h:309
Timeout< std::micro > m_one_thread_timeout
Definition: Target.h:470
bool InvokeCancelCallback(lldb::ExpressionEvaluationPhase phase) const
Definition: Target.h:402
lldb::DynamicValueType GetUseDynamic() const
Definition: Target.h:346
void SetKeepInMemory(bool keep=true)
Definition: Target.h:344
void SetCoerceToId(bool coerce=true)
Definition: Target.h:330
ExecutionPolicy GetExecutionPolicy() const
Definition: Target.h:307
Timeout< std::micro > m_timeout
Definition: Target.h:469
void SetPrefix(const char *prefix)
Definition: Target.h:323
void SetTryAllThreads(bool try_others=true)
Definition: Target.h:367
lldb::LanguageType GetLanguage() const
Definition: Target.h:313
void SetPoundLine(const char *path, uint32_t line) const
Definition: Target.h:410
void SetRetriesWithFixIts(uint64_t number_of_retries)
Definition: Target.h:436
void SetTimeout(const Timeout< std::micro > &timeout)
Definition: Target.h:355
static constexpr ExecutionPolicy default_execution_policy
Definition: Target.h:302
void SetStopOthers(bool stop_others=true)
Definition: Target.h:371
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:466
void SetCancelCallback(lldb::ExpressionCancelCallback callback, void *baton)
Definition: Target.h:397
const Timeout< std::micro > & GetTimeout() const
Definition: Target.h:353
void SetIgnoreBreakpoints(bool ignore=false)
Definition: Target.h:338
void SetUseDynamic(lldb::DynamicValueType dynamic=lldb::eDynamicCanRunTarget)
Definition: Target.h:349
lldb::ExpressionCancelCallback m_cancel_callback
Definition: Target.h:471
static constexpr std::chrono::milliseconds default_timeout
Definition: Target.h:297
const Timeout< std::micro > & GetOneThreadTimeout() const
Definition: Target.h:357
"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:4607
FileSpecList GetDebugFileSearchPaths()
Definition: Target.cpp:4488
bool GetDisplayRecognizedArguments() const
Definition: Target.cpp:4765
ImportStdModule GetImportStdModule() const
Definition: Target.cpp:4504
bool GetMoveToNearestCode() const
Definition: Target.cpp:4258
void AppendExecutableSearchPaths(const FileSpec &)
Definition: Target.cpp:4475
bool GetEnableSyntheticValue() const
Definition: Target.cpp:4574
void SetStandardInputPath(const char *path)=delete
ProcessLaunchInfo m_launch_info
Definition: Target.h:282
uint64_t GetExprAllocAlign() const
Definition: Target.cpp:4686
MemoryModuleLoadLevel GetMemoryModuleLoadLevel() const
Definition: Target.cpp:4737
llvm::StringRef GetArg0() const
Definition: Target.cpp:4355
uint32_t GetMaximumMemReadSize() const
Definition: Target.cpp:4613
void SetRunArguments(const Args &args)
Definition: Target.cpp:4372
FileSpec GetStandardErrorPath() const
Definition: Target.cpp:4639
bool GetEnableNotifyAboutFixIts() const
Definition: Target.cpp:4530
bool SetPreferDynamicValue(lldb::DynamicValueType d)
Definition: Target.cpp:4271
void SetDisplayRecognizedArguments(bool b)
Definition: Target.cpp:4771
std::optional< bool > GetExperimentalPropertyValue(size_t prop_idx, ExecutionContext *exe_ctx=nullptr) const
Definition: Target.cpp:4231
const ProcessLaunchInfo & GetProcessLaunchInfo() const
Definition: Target.cpp:4776
Environment ComputeEnvironment() const
Definition: Target.cpp:4378
void SetStandardOutputPath(const char *path)=delete
bool GetUserSpecifiedTrapHandlerNames(Args &args) const
Definition: Target.cpp:4744
uint64_t GetExprErrorLimit() const
Definition: Target.cpp:4668
bool GetEnableAutoImportClangModules() const
Definition: Target.cpp:4498
bool GetDebugUtilityExpression() const
Definition: Target.cpp:4882
DynamicClassInfoHelper GetDynamicClassInfoHelper() const
Definition: Target.cpp:4511
FileSpec GetStandardOutputPath() const
Definition: Target.cpp:4629
void SetDisplayRuntimeSupportValues(bool b)
Definition: Target.cpp:4760
uint32_t GetMaximumNumberOfChildrenToDisplay() const
Definition: Target.cpp:4592
void SetRequireHardwareBreakpoints(bool b)
Definition: Target.cpp:4814
bool GetAutoInstallMainExecutable() const
Definition: Target.cpp:4819
uint64_t GetNumberOfRetriesWithFixits() const
Definition: Target.cpp:4524
uint64_t GetExprAllocSize() const
Definition: Target.cpp:4680
llvm::StringRef GetExpressionPrefixContents()
Definition: Target.cpp:4654
const char * GetDisassemblyFlavor() const
Definition: Target.cpp:4335
FileSpec GetStandardInputPath() const
Definition: Target.cpp:4619
lldb::DynamicValueType GetPreferDynamicValue() const
Definition: Target.cpp:4264
InlineStrategy GetInlineStrategy() const
Definition: Target.cpp:4348
Environment GetTargetEnvironment() const
Definition: Target.cpp:4438
bool GetDisplayRuntimeSupportValues() const
Definition: Target.cpp:4754
void SetUserSpecifiedTrapHandlerNames(const Args &args)
Definition: Target.cpp:4749
bool GetUseHexImmediates() const
Definition: Target.cpp:4698
uint32_t GetMaxZeroPaddingInFloatFormat() const
Definition: Target.cpp:4586
uint64_t GetExprAllocAddress() const
Definition: Target.cpp:4674
LoadCWDlldbinitFile GetLoadCWDlldbinitFile() const
Definition: Target.cpp:4723
Environment GetInheritedEnvironment() const
Definition: Target.cpp:4410
void SetArg0(llvm::StringRef arg)
Definition: Target.cpp:4361
bool GetInjectLocalVariables(ExecutionContext *exe_ctx) const
Definition: Target.cpp:4242
void SetStandardErrorPath(const char *path)=delete
bool ShowHexVariableValuesWithLeadingZeroes() const
Definition: Target.cpp:4580
Environment GetEnvironment() const
Definition: Target.cpp:4406
void SetProcessLaunchInfo(const ProcessLaunchInfo &launch_info)
Definition: Target.cpp:4780
FileSpec GetSaveJITObjectsDir() const
Definition: Target.cpp:4536
void SetEnvironment(Environment env)
Definition: Target.cpp:4449
LoadScriptFromSymFile GetLoadScriptFromSymbolFile() const
Definition: Target.cpp:4716
void SetStandardErrorPath(llvm::StringRef path)
Definition: Target.cpp:4644
bool GetRunArguments(Args &args) const
Definition: Target.cpp:4367
bool GetBreakpointsConsultPlatformAvoidList()
Definition: Target.cpp:4692
FileSpecList GetExecutableSearchPaths()
Definition: Target.cpp:4483
ArchSpec GetDefaultArchitecture() const
Definition: Target.cpp:4248
Disassembler::HexImmediateStyle GetHexImmediateStyle() const
Definition: Target.cpp:4730
std::unique_ptr< TargetExperimentalProperties > m_experimental_properties_up
Definition: Target.h:283
FileSpecList GetClangModuleSearchPaths()
Definition: Target.cpp:4493
void SetStandardOutputPath(llvm::StringRef path)
Definition: Target.cpp:4634
bool GetRequireHardwareBreakpoints() const
Definition: Target.cpp:4808
PathMappingList & GetSourcePathMap() const
Definition: Target.cpp:4461
bool GetAutoSourceMapRelative() const
Definition: Target.cpp:4469
void SetDefaultArchitecture(const ArchSpec &arch)
Definition: Target.cpp:4253
void SetStandardInputPath(llvm::StringRef path)
Definition: Target.cpp:4624
lldb::LanguageType GetLanguage() const
Definition: Target.cpp:4649
bool GetDisplayExpressionsInCrashlogs() const
Definition: Target.cpp:4710
bool GetEnableAutoApplyFixIts() const
Definition: Target.cpp:4518
void SetDebugUtilityExpression(bool debug)
Definition: Target.cpp:4888
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:4599
A class that represents statistics for a since lldb_private::Target.
Definition: Statistics.h:139
std::unique_ptr< Architecture > m_plugin_up
Definition: Target.h:1526
const ArchSpec & GetSpec() const
Definition: Target.h:1521
const Arch & operator=(const ArchSpec &spec)
Definition: Target.cpp:84
Architecture * GetPlugin() const
Definition: Target.h:1522
void SetActionFromString(const std::string &strings)
Definition: Target.cpp:3795
StopHookCommandLine(lldb::TargetSP target_sp, lldb::user_id_t uid)
Definition: Target.h:1352
void SetActionFromStrings(const std::vector< std::string > &strings)
Definition: Target.cpp:3799
StopHookResult HandleStop(ExecutionContext &exc_ctx, lldb::StreamSP output_sp) override
Definition: Target.cpp:3806
void GetSubclassDescription(Stream &s, lldb::DescriptionLevel level) const override
Definition: Target.cpp:3776
StructuredData::GenericSP m_implementation_sp
This holds the python callback object.
Definition: Target.h:1375
Status SetScriptCallback(std::string class_name, StructuredData::ObjectSP extra_args_sp)
Definition: Target.cpp:3840
StopHookResult HandleStop(ExecutionContext &exc_ctx, lldb::StreamSP output) override
Definition: Target.cpp:3861
StopHookScripted(lldb::TargetSP target_sp, lldb::user_id_t uid)
Use CreateStopHook to make a new empty stop hook.
Definition: Target.h:1380
void GetSubclassDescription(Stream &s, lldb::DescriptionLevel level) const override
Definition: Target.cpp:3878
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:1373
SymbolContextSpecifier * GetSpecifier()
Definition: Target.h:1293
void SetSpecifier(SymbolContextSpecifier *specifier)
Definition: Target.cpp:3710
virtual StopHookResult HandleStop(ExecutionContext &exe_ctx, lldb::StreamSP output)=0
std::unique_ptr< ThreadSpec > m_thread_spec_up
Definition: Target.h:1327
void SetIsActive(bool is_active)
Definition: Target.h:1312
void SetThreadSpecifier(ThreadSpec *specifier)
Definition: Target.cpp:3714
ThreadSpec * GetThreadSpecifier()
Definition: Target.h:1308
lldb::TargetSP m_target_sp
Definition: Target.h:1325
bool GetAutoContinue() const
Definition: Target.h:1318
bool ExecutionContextPasses(const ExecutionContext &exe_ctx)
Definition: Target.cpp:3718
lldb::TargetSP & GetTarget()
Definition: Target.h:1287
lldb::SymbolContextSpecifierSP m_specifier_sp
Definition: Target.h:1326
virtual void GetSubclassDescription(Stream &s, lldb::DescriptionLevel level) const =0
void GetDescription(Stream &s, lldb::DescriptionLevel level) const
Definition: Target.cpp:3734
void SetAutoContinue(bool auto_continue)
Definition: Target.h:1314
const ModuleList & GetModuleList() const
Definition: Target.h:535
void Dump(Stream *s) const override
Definition: Target.cpp:4908
static llvm::StringRef GetFlavorString()
Definition: Target.cpp:4904
static ModuleList GetModuleListFromEvent(const Event *event_ptr)
Definition: Target.cpp:4937
static const TargetEventData * GetEventDataFromEvent(const Event *event_ptr)
Definition: Target.cpp:4918
llvm::StringRef GetFlavor() const override
Definition: Target.h:521
const lldb::TargetSP & GetTarget() const
Definition: Target.h:533
TargetEventData(const TargetEventData &)=delete
const TargetEventData & operator=(const TargetEventData &)=delete
static lldb::TargetSP GetTargetFromEvent(const Event *event_ptr)
Definition: Target.cpp:4928
void ModulesDidLoad(ModuleList &module_list)
Definition: Target.cpp:1690
lldb::ThreadSP CalculateThread() override
Definition: Target.cpp:2392
REPLMap m_repl_map
Definition: Target.h:1563
StopHookCollection m_stop_hooks
Definition: Target.h:1568
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:1573
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:2829
lldb::TraceSP GetTrace()
Get the Trace object containing processor trace information of this target.
Definition: Target.cpp:3375
PathMappingList & GetImageSearchPathList()
Definition: Target.cpp:2401
void FinalizeFileActions(ProcessLaunchInfo &info)
Definition: Target.cpp:3494
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:2803
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:2811
ModuleList & GetImages()
Definition: Target.h:974
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:2641
lldb::addr_t GetBreakableLoadAddress(lldb::addr_t addr)
Definition: Target.cpp:2818
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:3642
bool SetSuppresStopHooks(bool suppress)
Definition: Target.h:1401
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:2767
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:1385
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:3373
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:2442
BreakpointNameList m_breakpoint_names
Definition: Target.h:1549
llvm::StringRef GetABIName() const
Returns the name of the target's ABI plugin.
Definition: Target.cpp:303
SourceManager & GetSourceManager()
Definition: Target.cpp:2823
lldb::SearchFilterSP GetSearchFilterForModuleList(const FileSpecList *containingModuleList)
Definition: Target.cpp:592
StopHookSP GetStopHookByID(lldb::user_id_t uid)
Definition: Target.cpp:2858
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:1584
lldb::ProcessSP m_process_sp
Definition: Target.h:1557
lldb::SearchFilterSP m_search_filter_sp
Definition: Target.h:1558
PersistentExpressionState * GetPersistentExpressionStateForLanguage(lldb::LanguageType language)
Definition: Target.cpp:2486
UserExpression * GetUserExpressionForLanguage(llvm::StringRef expr, llvm::StringRef prefix, lldb::LanguageType language, Expression::ResultType desired_type, const EvaluateExpressionOptions &options, ValueObject *ctx_obj, Status &error)
Definition: Target.cpp:2506
static ConstString & GetStaticBroadcasterClass()
Definition: Target.cpp:90
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:3630
bool m_is_dummy_target
Used to not run stop hooks for expressions.
Definition: Target.h:1574
static bool UpdateSignalFromDummy(lldb::UnixSignalsSP signals_sp, const DummySignalElement &element)
Definition: Target.cpp:3588
PathMappingList m_image_search_paths
Definition: Target.h:1559
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:1127
lldb::addr_t GetPersistentSymbol(ConstString name)
Definition: Target.cpp:2747
void PrimeFromDummyTarget(Target &target)
Definition: Target.cpp:136
std::map< ConstString, std::unique_ptr< BreakpointName > > BreakpointNameList
Definition: Target.h:1548
static void SettingsTerminate()
Definition: Target.cpp:2599
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:3116
Debugger & GetDebugger()
Definition: Target.h:1055
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:3192
size_t GetNumStopHooks() const
Definition: Target.h:1419
std::vector< lldb::TypeSystemSP > GetScratchTypeSystems(bool create_on_demand=true)
Definition: Target.cpp:2451
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:948
void DeleteCurrentProcess()
Definition: Target.cpp:193
BreakpointList m_internal_breakpoint_list
Definition: Target.h:1546
void DisableAllowedBreakpoints()
Definition: Target.cpp:980
bool SetSectionUnloaded(const lldb::SectionSP &section_sp)
Definition: Target.cpp:3170
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:3615
Architecture * GetArchitecturePlugin() const
Definition: Target.h:1053
llvm::json::Value ReportStatistics(const lldb_private::StatisticsOptions &options)
Get metrics associated with this target in JSON format.
Definition: Target.cpp:4954
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:2538
TargetStats & GetStatistics()
Definition: Target.h:1607
void EnableAllBreakpoints(bool internal_also=false)
Definition: Target.cpp:987
Status Launch(ProcessLaunchInfo &launch_info, Stream *stream)
Definition: Target.cpp:3205
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:1567
llvm::Expected< lldb::TraceSP > CreateTrace()
Create a Trace object for the current target using the using the default supported tracing technology...
Definition: Target.cpp:3377
lldb::TraceSP m_trace_sp
An optional lldb_private::Trace object containing processor trace information of this target.
Definition: Target.h:1578
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:2844
WatchpointList m_watchpoint_list
Definition: Target.h:1552
@ eBroadcastBitModulesLoaded
Definition: Target.h:493
@ eBroadcastBitSymbolsChanged
Definition: Target.h:497
@ eBroadcastBitSymbolsLoaded
Definition: Target.h:496
@ eBroadcastBitModulesUnloaded
Definition: Target.h:494
@ eBroadcastBitWatchpointChanged
Definition: Target.h:495
@ eBroadcastBitBreakpointChanged
Definition: Target.h:492
BreakpointList m_breakpoint_list
Definition: Target.h:1545
lldb::SourceManagerUP m_source_manager_up
Definition: Target.h:1565
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:2868
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:2879
lldb::ExpressionVariableSP GetPersistentVariable(ConstString name)
Definition: Target.cpp:2728
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:1532
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:3402
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
ConstString & GetBroadcasterClass() const override
This needs to be filled in if you are going to register the broadcaster with the broadcaster manager ...
Definition: Target.h:504
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:3194
bool GetSuppressStopHooks()
Definition: Target.h:1407
std::string m_label
Definition: Target.h:1541
lldb::user_id_t m_stop_hook_next_id
Definition: Target.h:1569
void RemoveAllStopHooks()
Definition: Target.cpp:2856
static FileSpecList GetDefaultExecutableSearchPaths()
Definition: Target.cpp:2601
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:1475
std::recursive_mutex & GetAPIMutex()
Definition: Target.cpp:4945
static FileSpecList GetDefaultDebugFileSearchPaths()
Definition: Target.cpp:2605
void EnableAllowedBreakpoints()
Definition: Target.cpp:997
llvm::Error SetLabel(llvm::StringRef label)
Set a label for a target.
Definition: Target.cpp:2620
uint32_t m_latest_stop_hook_id
Definition: Target.h:1570
StackFrameRecognizerManager & GetFrameRecognizerManager()
Definition: Target.h:1457
void RemoveAllowedBreakpoints()
Definition: Target.cpp:949
StopHookSP GetStopHookAtIndex(size_t index)
Definition: Target.h:1421
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:1531
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:2568
static TargetProperties & GetGlobalProperties()
Definition: Target.cpp:3055
Status Install(ProcessLaunchInfo *launch_info)
Definition: Target.cpp:3063
lldb::PlatformSP GetPlatform()
Definition: Target.h:1433
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:3111
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:2609
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:972
const ArchSpec & GetArchitecture() const
Definition: Target.h:1014
WatchpointList & GetWatchpointList()
Definition: Target.h:765
unsigned m_next_persistent_variable_index
Definition: Target.h:1575
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:1592
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:1560
void AddBreakpointName(std::unique_ptr< BreakpointName > bp_name)
Definition: Target.cpp:757
SectionLoadHistory m_section_load_history
Definition: Target.h:1544
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:559
size_t UnloadModuleSections(const lldb::ModuleSP &module_sp)
Definition: Target.cpp:3151
const std::string & GetLabel() const
Definition: Target.h:561
bool m_valid
This records the last natural stop at which we ran a stop-hook.
Definition: Target.h:1572
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:3573
lldb::WatchpointSP m_last_created_watchpoint
Definition: Target.h:1553
Status CreateBreakpointsFromFile(const FileSpec &file, BreakpointIDList &new_bps)
Definition: Target.cpp:1157
Debugger & m_debugger
Definition: Target.h:1530
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:1580
lldb::REPLSP GetREPL(Status &err, lldb::LanguageType language, const char *repl_options, bool can_create)
Definition: Target.cpp:223
ModuleList m_images
The list of images for this process (shared libraries and anything dynamically loaded).
Definition: Target.h:1542
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:3667
void SetPlatform(const lldb::PlatformSP &platform_sp)
Definition: Target.h:1435
bool SetSectionLoadAddress(const lldb::SectionSP &section, lldb::addr_t load_addr, bool warn_multiple=false)
Definition: Target.cpp:3121
Status Attach(ProcessAttachInfo &attach_info, Stream *stream)
Definition: Target.cpp:3408
std::map< lldb::LanguageType, lldb::REPLSP > REPLMap
Definition: Target.h:1562
static void SetDefaultArchitecture(const ArchSpec &arch)
Definition: Target.cpp:2613
lldb::BreakpointSP m_last_created_breakpoint
Definition: Target.h:1551
lldb::WatchpointSP GetLastCreatedWatchpoint()
Definition: Target.h:761
void RemoveNameFromBreakpoint(lldb::BreakpointSP &bp_sp, ConstString name)
Definition: Target.cpp:796
bool RemoveStopHookByID(lldb::user_id_t uid)
Definition: Target.cpp:2851
lldb::BreakpointSP GetLastCreatedBreakpoint()
Definition: Target.h:653
static void SettingsInitialize()
Definition: Target.cpp:2597
~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:1539
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:2655
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.
Definition: SBAttachInfo.h:14
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:3938
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:446
std::shared_ptr< lldb_private::StackFrame > StackFrameSP
Definition: lldb-forward.h:412
std::shared_ptr< lldb_private::SearchFilter > SearchFilterSP
Definition: lldb-forward.h:410
std::shared_ptr< lldb_private::BreakpointResolver > BreakpointResolverSP
Definition: lldb-forward.h:320
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
std::unique_ptr< lldb_private::StackFrameRecognizerManager > StackFrameRecognizerManagerUP
Definition: lldb-forward.h:418
std::shared_ptr< lldb_private::Thread > ThreadSP
Definition: lldb-forward.h:438
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
Definition: lldb-forward.h:472
std::shared_ptr< lldb_private::ExpressionVariable > ExpressionVariableSP
Definition: lldb-forward.h:343
std::shared_ptr< lldb_private::UnixSignals > UnixSignalsSP
Definition: lldb-forward.h:468
std::shared_ptr< lldb_private::Platform > PlatformSP
Definition: lldb-forward.h:380
LanguageType
Programming language type.
@ eLanguageTypeUnknown
Unknown or invalid language value.
bool(* ExpressionCancelCallback)(ExpressionEvaluationPhase phase, void *baton)
Definition: lldb-types.h:74
std::shared_ptr< lldb_private::Stream > StreamSP
Definition: lldb-forward.h:420
std::shared_ptr< lldb_private::Breakpoint > BreakpointSP
Definition: lldb-forward.h:313
ExpressionResults
The results of expression evaluation.
int32_t break_id_t
Definition: lldb-types.h:84
std::unique_ptr< lldb_private::SourceManager > SourceManagerUP
Definition: lldb-forward.h:411
std::shared_ptr< lldb_private::Process > ProcessSP
Definition: lldb-forward.h:381
std::shared_ptr< lldb_private::SymbolContextSpecifier > SymbolContextSpecifierSP
Definition: lldb-forward.h:431
std::shared_ptr< lldb_private::Watchpoint > WatchpointSP
Definition: lldb-forward.h:477
std::shared_ptr< lldb_private::Listener > ListenerSP
Definition: lldb-forward.h:360
int32_t watch_id_t
Definition: lldb-types.h:85
uint64_t user_id_t
Definition: lldb-types.h:80
std::shared_ptr< lldb_private::Section > SectionSP
Definition: lldb-forward.h:406
uint64_t addr_t
Definition: lldb-types.h:79
std::shared_ptr< lldb_private::Target > TargetSP
Definition: lldb-forward.h:436
@ eDynamicCanRunTarget
@ eNoDynamicValues
std::shared_ptr< lldb_private::Module > ModuleSP
Definition: lldb-forward.h:365
std::shared_ptr< lldb_private::REPL > REPLSP
Definition: lldb-forward.h:393
Add a signal for the target.
Definition: Target.h:1467
DummySignalValues(LazyBool pass, LazyBool notify, LazyBool stop)
Definition: Target.h:1471
A mix in class that contains a generic user ID.
Definition: UserID.h:31