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