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
42OptionEnumValues GetDynamicValueTypes();
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
173
174 /// Get the max depth value, augmented with a bool to indicate whether the
175 /// depth is the default.
176 ///
177 /// When the user has customized the max depth, the bool will be false.
178 ///
179 /// \returns the max depth, and true if the max depth is the system default,
180 /// otherwise false.
181 std::pair<uint32_t, bool> GetMaximumDepthOfChildrenToDisplay() const;
182
184
186
190
191 void SetStandardInputPath(llvm::StringRef path);
192 void SetStandardOutputPath(llvm::StringRef path);
193 void SetStandardErrorPath(llvm::StringRef path);
194
195 void SetStandardInputPath(const char *path) = delete;
196 void SetStandardOutputPath(const char *path) = delete;
197 void SetStandardErrorPath(const char *path) = delete;
198
200
202
203 llvm::StringRef GetExpressionPrefixContents();
204
205 uint64_t GetExprErrorLimit() const;
206
207 uint64_t GetExprAllocAddress() const;
208
209 uint64_t GetExprAllocSize() const;
210
211 uint64_t GetExprAllocAlign() const;
212
213 bool GetUseHexImmediates() const;
214
215 bool GetUseFastStepping() const;
216
218
220
222
224
226
227 bool GetUserSpecifiedTrapHandlerNames(Args &args) const;
228
229 void SetUserSpecifiedTrapHandlerNames(const Args &args);
230
232
234
236
238
240
241 void SetProcessLaunchInfo(const ProcessLaunchInfo &launch_info);
242
243 bool GetInjectLocalVariables(ExecutionContext *exe_ctx) const;
244
245 void SetInjectLocalVariables(ExecutionContext *exe_ctx, bool b);
246
248
250
251 bool GetAutoInstallMainExecutable() const;
252
254
255 void SetDebugUtilityExpression(bool debug);
256
257 bool GetDebugUtilityExpression() const;
258
259private:
260 // Callbacks for m_launch_info.
271
272 // Settings checker for target.jit-save-objects-dir:
273 void CheckJITObjectsDir();
274
276
277 // Member variables.
279 std::unique_ptr<TargetExperimentalProperties> m_experimental_properties_up;
281};
282
284public:
285// MSVC has a bug here that reports C4268: 'const' static/global data
286// initialized with compiler generated default constructor fills the object
287// with zeros. Confirmed that MSVC is *not* zero-initializing, it's just a
288// bogus warning.
289#if defined(_MSC_VER)
290#pragma warning(push)
291#pragma warning(disable : 4268)
292#endif
293 static constexpr std::chrono::milliseconds default_timeout{500};
294#if defined(_MSC_VER)
295#pragma warning(pop)
296#endif
297
300
302
304
306 m_execution_policy = policy;
307 }
308
310
311 void SetLanguage(lldb::LanguageType language) { m_language = language; }
312
313 bool DoesCoerceToId() const { return m_coerce_to_id; }
314
315 const char *GetPrefix() const {
316 return (m_prefix.empty() ? nullptr : m_prefix.c_str());
317 }
318
319 void SetPrefix(const char *prefix) {
320 if (prefix && prefix[0])
321 m_prefix = prefix;
322 else
323 m_prefix.clear();
324 }
325
326 void SetCoerceToId(bool coerce = true) { m_coerce_to_id = coerce; }
327
328 bool DoesUnwindOnError() const { return m_unwind_on_error; }
329
330 void SetUnwindOnError(bool unwind = false) { m_unwind_on_error = unwind; }
331
333
334 void SetIgnoreBreakpoints(bool ignore = false) {
335 m_ignore_breakpoints = ignore;
336 }
337
338 bool DoesKeepInMemory() const { return m_keep_in_memory; }
339
340 void SetKeepInMemory(bool keep = true) { m_keep_in_memory = keep; }
341
343
344 void
346 m_use_dynamic = dynamic;
347 }
348
349 const Timeout<std::micro> &GetTimeout() const { return m_timeout; }
350
351 void SetTimeout(const Timeout<std::micro> &timeout) { m_timeout = timeout; }
352
355 }
356
358 m_one_thread_timeout = timeout;
359 }
360
361 bool GetTryAllThreads() const { return m_try_others; }
362
363 void SetTryAllThreads(bool try_others = true) { m_try_others = try_others; }
364
365 bool GetStopOthers() const { return m_stop_others; }
366
367 void SetStopOthers(bool stop_others = true) { m_stop_others = stop_others; }
368
369 bool GetDebug() const { return m_debug; }
370
371 void SetDebug(bool b) {
372 m_debug = b;
373 if (m_debug)
375 }
376
378
380
381 bool GetColorizeErrors() const { return m_ansi_color_errors; }
382
384
385 bool GetTrapExceptions() const { return m_trap_exceptions; }
386
388
389 bool GetREPLEnabled() const { return m_repl; }
390
391 void SetREPLEnabled(bool b) { m_repl = b; }
392
395 m_cancel_callback = callback;
396 }
397
399 return ((m_cancel_callback != nullptr)
401 : false);
402 }
403
404 // Allows the expression contents to be remapped to point to the specified
405 // file and line using #line directives.
406 void SetPoundLine(const char *path, uint32_t line) const {
407 if (path && path[0]) {
408 m_pound_line_file = path;
409 m_pound_line_line = line;
410 } else {
411 m_pound_line_file.clear();
413 }
414 }
415
416 const char *GetPoundLineFilePath() const {
417 return (m_pound_line_file.empty() ? nullptr : m_pound_line_file.c_str());
418 }
419
421
423
426 }
427
429
431
432 void SetRetriesWithFixIts(uint64_t number_of_retries) {
433 m_retries_with_fixits = number_of_retries;
434 }
435
436 uint64_t GetRetriesWithFixIts() const { return m_retries_with_fixits; }
437
439
441
442private:
445 std::string m_prefix;
446 bool m_coerce_to_id = false;
447 bool m_unwind_on_error = true;
449 bool m_keep_in_memory = false;
450 bool m_try_others = true;
451 bool m_stop_others = true;
452 bool m_debug = false;
453 bool m_trap_exceptions = true;
454 bool m_repl = false;
460 /// True if the executed code should be treated as utility code that is only
461 /// used by LLDB internally.
463
468 void *m_cancel_callback_baton = nullptr;
469 // If m_pound_line_file is not empty and m_pound_line_line is non-zero, use
470 // #line %u "%s" before the expression content to remap where the source
471 // originates
472 mutable std::string m_pound_line_file;
474};
475
476// Target
477class Target : public std::enable_shared_from_this<Target>,
478 public TargetProperties,
479 public Broadcaster,
481 public ModuleList::Notifier {
482public:
483 friend class TargetList;
484 friend class Debugger;
485
486 /// Broadcaster event bits definitions.
487 enum {
494 };
495
496 // These two functions fill out the Broadcaster interface:
497
499
502 }
503
504 // This event data class is for use by the TargetList to broadcast new target
505 // notifications.
506 class TargetEventData : public EventData {
507 public:
508 TargetEventData(const lldb::TargetSP &target_sp);
509
510 TargetEventData(const lldb::TargetSP &target_sp,
511 const ModuleList &module_list);
512
514
515 static llvm::StringRef GetFlavorString();
516
517 llvm::StringRef GetFlavor() const override {
519 }
520
521 void Dump(Stream *s) const override;
522
523 static const TargetEventData *GetEventDataFromEvent(const Event *event_ptr);
524
525 static lldb::TargetSP GetTargetFromEvent(const Event *event_ptr);
526
527 static ModuleList GetModuleListFromEvent(const Event *event_ptr);
528
529 const lldb::TargetSP &GetTarget() const { return m_target_sp; }
530
531 const ModuleList &GetModuleList() const { return m_module_list; }
532
533 private:
534 lldb::TargetSP m_target_sp;
536
538 const TargetEventData &operator=(const TargetEventData &) = delete;
539 };
540
541 ~Target() override;
542
543 static void SettingsInitialize();
544
545 static void SettingsTerminate();
546
548
550
552
553 static void SetDefaultArchitecture(const ArchSpec &arch);
554
555 bool IsDummyTarget() const { return m_is_dummy_target; }
556
557 /// Find a binary on the system and return its Module,
558 /// or return an existing Module that is already in the Target.
559 ///
560 /// Given a ModuleSpec, find a binary satisifying that specification,
561 /// or identify a matching Module already present in the Target,
562 /// and return a shared pointer to it.
563 ///
564 /// \param[in] module_spec
565 /// The criteria that must be matched for the binary being loaded.
566 /// e.g. UUID, architecture, file path.
567 ///
568 /// \param[in] notify
569 /// If notify is true, and the Module is new to this Target,
570 /// Target::ModulesDidLoad will be called.
571 /// If notify is false, it is assumed that the caller is adding
572 /// multiple Modules and will call ModulesDidLoad with the
573 /// full list at the end.
574 /// ModulesDidLoad must be called when a Module/Modules have
575 /// been added to the target, one way or the other.
576 ///
577 /// \param[out] error_ptr
578 /// Optional argument, pointing to a Status object to fill in
579 /// with any results / messages while attempting to find/load
580 /// this binary. Many callers will be internal functions that
581 /// will handle / summarize the failures in a custom way and
582 /// don't use these messages.
583 ///
584 /// \return
585 /// An empty ModuleSP will be returned if no matching file
586 /// was found. If error_ptr was non-nullptr, an error message
587 /// will likely be provided.
588 lldb::ModuleSP GetOrCreateModule(const ModuleSpec &module_spec, bool notify,
589 Status *error_ptr = nullptr);
590
591 // Settings accessors
592
594
595 std::recursive_mutex &GetAPIMutex();
596
598
599 void CleanupProcess();
600
601 /// Dump a description of this object to a Stream.
602 ///
603 /// Dump a description of the contents of this object to the
604 /// supplied stream \a s. The dumped content will be only what has
605 /// been loaded or parsed up to this point at which this function
606 /// is called, so this is a good way to see what has been parsed
607 /// in a target.
608 ///
609 /// \param[in] s
610 /// The stream to which to dump the object description.
611 void Dump(Stream *s, lldb::DescriptionLevel description_level);
612
613 // If listener_sp is null, the listener of the owning Debugger object will be
614 // used.
615 const lldb::ProcessSP &CreateProcess(lldb::ListenerSP listener_sp,
616 llvm::StringRef plugin_name,
617 const FileSpec *crash_file,
618 bool can_connect);
619
620 const lldb::ProcessSP &GetProcessSP() const;
621
622 bool IsValid() { return m_valid; }
623
624 void Destroy();
625
626 Status Launch(ProcessLaunchInfo &launch_info,
627 Stream *stream); // Optional stream to receive first stop info
628
629 Status Attach(ProcessAttachInfo &attach_info,
630 Stream *stream); // Optional stream to receive first stop info
631
632 // This part handles the breakpoints.
633
634 BreakpointList &GetBreakpointList(bool internal = false);
635
636 const BreakpointList &GetBreakpointList(bool internal = false) const;
637
638 lldb::BreakpointSP GetLastCreatedBreakpoint() {
640 }
641
642 lldb::BreakpointSP GetBreakpointByID(lldb::break_id_t break_id);
643
644 // Use this to create a file and line breakpoint to a given module or all
645 // module it is nullptr
646 lldb::BreakpointSP CreateBreakpoint(const FileSpecList *containingModules,
647 const FileSpec &file, uint32_t line_no,
648 uint32_t column, lldb::addr_t offset,
649 LazyBool check_inlines,
650 LazyBool skip_prologue, bool internal,
651 bool request_hardware,
652 LazyBool move_to_nearest_code);
653
654 // Use this to create breakpoint that matches regex against the source lines
655 // in files given in source_file_list: If function_names is non-empty, also
656 // filter by function after the matches are made.
657 lldb::BreakpointSP CreateSourceRegexBreakpoint(
658 const FileSpecList *containingModules,
659 const FileSpecList *source_file_list,
660 const std::unordered_set<std::string> &function_names,
661 RegularExpression source_regex, bool internal, bool request_hardware,
662 LazyBool move_to_nearest_code);
663
664 // Use this to create a breakpoint from a load address
665 lldb::BreakpointSP CreateBreakpoint(lldb::addr_t load_addr, bool internal,
666 bool request_hardware);
667
668 // Use this to create a breakpoint from a load address and a module file spec
669 lldb::BreakpointSP CreateAddressInModuleBreakpoint(lldb::addr_t file_addr,
670 bool internal,
671 const FileSpec *file_spec,
672 bool request_hardware);
673
674 // Use this to create Address breakpoints:
675 lldb::BreakpointSP CreateBreakpoint(const Address &addr, bool internal,
676 bool request_hardware);
677
678 // Use this to create a function breakpoint by regexp in
679 // containingModule/containingSourceFiles, or all modules if it is nullptr
680 // When "skip_prologue is set to eLazyBoolCalculate, we use the current
681 // target setting, else we use the values passed in
682 lldb::BreakpointSP CreateFuncRegexBreakpoint(
683 const FileSpecList *containingModules,
684 const FileSpecList *containingSourceFiles, RegularExpression func_regexp,
685 lldb::LanguageType requested_language, LazyBool skip_prologue,
686 bool internal, bool request_hardware);
687
688 // Use this to create a function breakpoint by name in containingModule, or
689 // all modules if it is nullptr When "skip_prologue is set to
690 // eLazyBoolCalculate, we use the current target setting, else we use the
691 // values passed in. func_name_type_mask is or'ed values from the
692 // FunctionNameType enum.
693 lldb::BreakpointSP CreateBreakpoint(
694 const FileSpecList *containingModules,
695 const FileSpecList *containingSourceFiles, const char *func_name,
696 lldb::FunctionNameType func_name_type_mask, lldb::LanguageType language,
697 lldb::addr_t offset, LazyBool skip_prologue, bool internal,
698 bool request_hardware);
699
700 lldb::BreakpointSP
701 CreateExceptionBreakpoint(enum lldb::LanguageType language, bool catch_bp,
702 bool throw_bp, bool internal,
703 Args *additional_args = nullptr,
704 Status *additional_args_error = nullptr);
705
706 lldb::BreakpointSP CreateScriptedBreakpoint(
707 const llvm::StringRef class_name, const FileSpecList *containingModules,
708 const FileSpecList *containingSourceFiles, bool internal,
709 bool request_hardware, StructuredData::ObjectSP extra_args_sp,
710 Status *creation_error = nullptr);
711
712 // This is the same as the func_name breakpoint except that you can specify a
713 // vector of names. This is cheaper than a regular expression breakpoint in
714 // the case where you just want to set a breakpoint on a set of names you
715 // already know. func_name_type_mask is or'ed values from the
716 // FunctionNameType enum.
717 lldb::BreakpointSP CreateBreakpoint(
718 const FileSpecList *containingModules,
719 const FileSpecList *containingSourceFiles, const char *func_names[],
720 size_t num_names, lldb::FunctionNameType func_name_type_mask,
721 lldb::LanguageType language, lldb::addr_t offset, LazyBool skip_prologue,
722 bool internal, bool request_hardware);
723
724 lldb::BreakpointSP
725 CreateBreakpoint(const FileSpecList *containingModules,
726 const FileSpecList *containingSourceFiles,
727 const std::vector<std::string> &func_names,
728 lldb::FunctionNameType func_name_type_mask,
729 lldb::LanguageType language, lldb::addr_t m_offset,
730 LazyBool skip_prologue, bool internal,
731 bool request_hardware);
732
733 // Use this to create a general breakpoint:
734 lldb::BreakpointSP CreateBreakpoint(lldb::SearchFilterSP &filter_sp,
735 lldb::BreakpointResolverSP &resolver_sp,
736 bool internal, bool request_hardware,
737 bool resolve_indirect_symbols);
738
739 // Use this to create a watchpoint:
740 lldb::WatchpointSP CreateWatchpoint(lldb::addr_t addr, size_t size,
741 const CompilerType *type, uint32_t kind,
742 Status &error);
743
744 lldb::WatchpointSP GetLastCreatedWatchpoint() {
746 }
747
749
750 // Manages breakpoint names:
751 void AddNameToBreakpoint(BreakpointID &id, const char *name, Status &error);
752
753 void AddNameToBreakpoint(lldb::BreakpointSP &bp_sp, const char *name,
754 Status &error);
755
756 void RemoveNameFromBreakpoint(lldb::BreakpointSP &bp_sp, ConstString name);
757
758 BreakpointName *FindBreakpointName(ConstString name, bool can_create,
759 Status &error);
760
762
764 const BreakpointOptions &options,
765 const BreakpointName::Permissions &permissions);
767
768 void AddBreakpointName(std::unique_ptr<BreakpointName> bp_name);
769
770 void GetBreakpointNames(std::vector<std::string> &names);
771
772 // This call removes ALL breakpoints regardless of permission.
773 void RemoveAllBreakpoints(bool internal_also = false);
774
775 // This removes all the breakpoints, but obeys the ePermDelete on them.
777
778 void DisableAllBreakpoints(bool internal_also = false);
779
781
782 void EnableAllBreakpoints(bool internal_also = false);
783
785
787
789
791
792 /// Resets the hit count of all breakpoints.
794
795 // The flag 'end_to_end', default to true, signifies that the operation is
796 // performed end to end, for both the debugger and the debuggee.
797
798 bool RemoveAllWatchpoints(bool end_to_end = true);
799
800 bool DisableAllWatchpoints(bool end_to_end = true);
801
802 bool EnableAllWatchpoints(bool end_to_end = true);
803
805
807
808 bool IgnoreAllWatchpoints(uint32_t ignore_count);
809
811
813
815
816 bool IgnoreWatchpointByID(lldb::watch_id_t watch_id, uint32_t ignore_count);
817
819 const BreakpointIDList &bp_ids,
820 bool append);
821
823 BreakpointIDList &new_bps);
824
826 std::vector<std::string> &names,
827 BreakpointIDList &new_bps);
828
829 /// Get \a load_addr as a callable code load address for this target
830 ///
831 /// Take \a load_addr and potentially add any address bits that are
832 /// needed to make the address callable. For ARM this can set bit
833 /// zero (if it already isn't) if \a load_addr is a thumb function.
834 /// If \a addr_class is set to AddressClass::eInvalid, then the address
835 /// adjustment will always happen. If it is set to an address class
836 /// that doesn't have code in it, LLDB_INVALID_ADDRESS will be
837 /// returned.
839 lldb::addr_t load_addr,
840 AddressClass addr_class = AddressClass::eInvalid) const;
841
842 /// Get \a load_addr as an opcode for this target.
843 ///
844 /// Take \a load_addr and potentially strip any address bits that are
845 /// needed to make the address point to an opcode. For ARM this can
846 /// clear bit zero (if it already isn't) if \a load_addr is a
847 /// thumb function and load_addr is in code.
848 /// If \a addr_class is set to AddressClass::eInvalid, then the address
849 /// adjustment will always happen. If it is set to an address class
850 /// that doesn't have code in it, LLDB_INVALID_ADDRESS will be
851 /// returned.
854 AddressClass addr_class = AddressClass::eInvalid) const;
855
856 // Get load_addr as breakable load address for this target. Take a addr and
857 // check if for any reason there is a better address than this to put a
858 // breakpoint on. If there is then return that address. For MIPS, if
859 // instruction at addr is a delay slot instruction then this method will find
860 // the address of its previous instruction and return that address.
862
863 void ModulesDidLoad(ModuleList &module_list);
864
865 void ModulesDidUnload(ModuleList &module_list, bool delete_locations);
866
867 void SymbolsDidLoad(ModuleList &module_list);
868
869 void ClearModules(bool delete_locations);
870
871 /// Called as the last function in Process::DidExec().
872 ///
873 /// Process::DidExec() will clear a lot of state in the process,
874 /// then try to reload a dynamic loader plugin to discover what
875 /// binaries are currently available and then this function should
876 /// be called to allow the target to do any cleanup after everything
877 /// has been figured out. It can remove breakpoints that no longer
878 /// make sense as the exec might have changed the target
879 /// architecture, and unloaded some modules that might get deleted.
880 void DidExec();
881
882 /// Gets the module for the main executable.
883 ///
884 /// Each process has a notion of a main executable that is the file
885 /// that will be executed or attached to. Executable files can have
886 /// dependent modules that are discovered from the object files, or
887 /// discovered at runtime as things are dynamically loaded.
888 ///
889 /// \return
890 /// The shared pointer to the executable module which can
891 /// contains a nullptr Module object if no executable has been
892 /// set.
893 ///
894 /// \see DynamicLoader
895 /// \see ObjectFile::GetDependentModules (FileSpecList&)
896 /// \see Process::SetExecutableModule(lldb::ModuleSP&)
897 lldb::ModuleSP GetExecutableModule();
898
900
901 /// Set the main executable module.
902 ///
903 /// Each process has a notion of a main executable that is the file
904 /// that will be executed or attached to. Executable files can have
905 /// dependent modules that are discovered from the object files, or
906 /// discovered at runtime as things are dynamically loaded.
907 ///
908 /// Setting the executable causes any of the current dependent
909 /// image information to be cleared and replaced with the static
910 /// dependent image information found by calling
911 /// ObjectFile::GetDependentModules (FileSpecList&) on the main
912 /// executable and any modules on which it depends. Calling
913 /// Process::GetImages() will return the newly found images that
914 /// were obtained from all of the object files.
915 ///
916 /// \param[in] module_sp
917 /// A shared pointer reference to the module that will become
918 /// the main executable for this process.
919 ///
920 /// \param[in] load_dependent_files
921 /// If \b true then ask the object files to track down any
922 /// known dependent files.
923 ///
924 /// \see ObjectFile::GetDependentModules (FileSpecList&)
925 /// \see Process::GetImages()
927 lldb::ModuleSP &module_sp,
928 LoadDependentFiles load_dependent_files = eLoadDependentsDefault);
929
930 bool LoadScriptingResources(std::list<Status> &errors,
931 Stream *feedback_stream = nullptr,
932 bool continue_on_error = true) {
934 this, errors, feedback_stream, continue_on_error);
935 }
936
937 /// Get accessor for the images for this process.
938 ///
939 /// Each process has a notion of a main executable that is the file
940 /// that will be executed or attached to. Executable files can have
941 /// dependent modules that are discovered from the object files, or
942 /// discovered at runtime as things are dynamically loaded. After
943 /// a main executable has been set, the images will contain a list
944 /// of all the files that the executable depends upon as far as the
945 /// object files know. These images will usually contain valid file
946 /// virtual addresses only. When the process is launched or attached
947 /// to, the DynamicLoader plug-in will discover where these images
948 /// were loaded in memory and will resolve the load virtual
949 /// addresses is each image, and also in images that are loaded by
950 /// code.
951 ///
952 /// \return
953 /// A list of Module objects in a module list.
954 const ModuleList &GetImages() const { return m_images; }
955
957
958 /// Return whether this FileSpec corresponds to a module that should be
959 /// considered for general searches.
960 ///
961 /// This API will be consulted by the SearchFilterForUnconstrainedSearches
962 /// and any module that returns \b true will not be searched. Note the
963 /// SearchFilterForUnconstrainedSearches is the search filter that
964 /// gets used in the CreateBreakpoint calls when no modules is provided.
965 ///
966 /// The target call at present just consults the Platform's call of the
967 /// same name.
968 ///
969 /// \param[in] module_spec
970 /// Path to the module.
971 ///
972 /// \return \b true if the module should be excluded, \b false otherwise.
973 bool ModuleIsExcludedForUnconstrainedSearches(const FileSpec &module_spec);
974
975 /// Return whether this module should be considered for general searches.
976 ///
977 /// This API will be consulted by the SearchFilterForUnconstrainedSearches
978 /// and any module that returns \b true will not be searched. Note the
979 /// SearchFilterForUnconstrainedSearches is the search filter that
980 /// gets used in the CreateBreakpoint calls when no modules is provided.
981 ///
982 /// The target call at present just consults the Platform's call of the
983 /// same name.
984 ///
985 /// FIXME: When we get time we should add a way for the user to set modules
986 /// that they
987 /// don't want searched, in addition to or instead of the platform ones.
988 ///
989 /// \param[in] module_sp
990 /// A shared pointer reference to the module that checked.
991 ///
992 /// \return \b true if the module should be excluded, \b false otherwise.
993 bool
994 ModuleIsExcludedForUnconstrainedSearches(const lldb::ModuleSP &module_sp);
995
996 const ArchSpec &GetArchitecture() const { return m_arch.GetSpec(); }
997
998 /// Returns the name of the target's ABI plugin.
999 llvm::StringRef GetABIName() const;
1000
1001 /// Set the architecture for this target.
1002 ///
1003 /// If the current target has no Images read in, then this just sets the
1004 /// architecture, which will be used to select the architecture of the
1005 /// ExecutableModule when that is set. If the current target has an
1006 /// ExecutableModule, then calling SetArchitecture with a different
1007 /// architecture from the currently selected one will reset the
1008 /// ExecutableModule to that slice of the file backing the ExecutableModule.
1009 /// If the file backing the ExecutableModule does not contain a fork of this
1010 /// architecture, then this code will return false, and the architecture
1011 /// won't be changed. If the input arch_spec is the same as the already set
1012 /// architecture, this is a no-op.
1013 ///
1014 /// \param[in] arch_spec
1015 /// The new architecture.
1016 ///
1017 /// \param[in] set_platform
1018 /// If \b true, then the platform will be adjusted if the currently
1019 /// selected platform is not compatible with the architecture being set.
1020 /// If \b false, then just the architecture will be set even if the
1021 /// currently selected platform isn't compatible (in case it might be
1022 /// manually set following this function call).
1023 ///
1024 /// \param[in] merged
1025 /// If true, arch_spec is merged with the current
1026 /// architecture. Otherwise it's replaced.
1027 ///
1028 /// \return
1029 /// \b true if the architecture was successfully set, \b false otherwise.
1030 bool SetArchitecture(const ArchSpec &arch_spec, bool set_platform = false,
1031 bool merge = true);
1032
1033 bool MergeArchitecture(const ArchSpec &arch_spec);
1034
1036
1038
1039 size_t ReadMemoryFromFileCache(const Address &addr, void *dst, size_t dst_len,
1040 Status &error);
1041
1042 // Reading memory through the target allows us to skip going to the process
1043 // for reading memory if possible and it allows us to try and read from any
1044 // constant sections in our object files on disk. If you always want live
1045 // program memory, read straight from the process. If you possibly want to
1046 // read from const sections in object files, read from the target. This
1047 // version of ReadMemory will try and read memory from the process if the
1048 // process is alive. The order is:
1049 // 1 - if (force_live_memory == false) and the address falls in a read-only
1050 // section, then read from the file cache
1051 // 2 - if there is a process, then read from memory
1052 // 3 - if there is no process, then read from the file cache
1053 size_t ReadMemory(const Address &addr, void *dst, size_t dst_len,
1054 Status &error, bool force_live_memory = false,
1055 lldb::addr_t *load_addr_ptr = nullptr);
1056
1057 size_t ReadCStringFromMemory(const Address &addr, std::string &out_str,
1058 Status &error, bool force_live_memory = false);
1059
1060 size_t ReadCStringFromMemory(const Address &addr, char *dst,
1061 size_t dst_max_len, Status &result_error,
1062 bool force_live_memory = false);
1063
1064 /// Read a NULL terminated string from memory
1065 ///
1066 /// This function will read a cache page at a time until a NULL string
1067 /// terminator is found. It will stop reading if an aligned sequence of NULL
1068 /// termination \a type_width bytes is not found before reading \a
1069 /// cstr_max_len bytes. The results are always guaranteed to be NULL
1070 /// terminated, and that no more than (max_bytes - type_width) bytes will be
1071 /// read.
1072 ///
1073 /// \param[in] addr
1074 /// The address to start the memory read.
1075 ///
1076 /// \param[in] dst
1077 /// A character buffer containing at least max_bytes.
1078 ///
1079 /// \param[in] max_bytes
1080 /// The maximum number of bytes to read.
1081 ///
1082 /// \param[in] error
1083 /// The error status of the read operation.
1084 ///
1085 /// \param[in] type_width
1086 /// The size of the null terminator (1 to 4 bytes per
1087 /// character). Defaults to 1.
1088 ///
1089 /// \return
1090 /// The error status or the number of bytes prior to the null terminator.
1091 size_t ReadStringFromMemory(const Address &addr, char *dst, size_t max_bytes,
1092 Status &error, size_t type_width,
1093 bool force_live_memory = true);
1094
1095 size_t ReadScalarIntegerFromMemory(const Address &addr, uint32_t byte_size,
1096 bool is_signed, Scalar &scalar,
1097 Status &error,
1098 bool force_live_memory = false);
1099
1100 uint64_t ReadUnsignedIntegerFromMemory(const Address &addr,
1101 size_t integer_byte_size,
1102 uint64_t fail_value, Status &error,
1103 bool force_live_memory = false);
1104
1105 bool ReadPointerFromMemory(const Address &addr, Status &error,
1106 Address &pointer_addr,
1107 bool force_live_memory = false);
1108
1111 }
1112
1113 static Target *GetTargetFromContexts(const ExecutionContext *exe_ctx_ptr,
1114 const SymbolContext *sc_ptr);
1115
1116 // lldb::ExecutionContextScope pure virtual functions
1117 lldb::TargetSP CalculateTarget() override;
1118
1119 lldb::ProcessSP CalculateProcess() override;
1120
1121 lldb::ThreadSP CalculateThread() override;
1122
1123 lldb::StackFrameSP CalculateStackFrame() override;
1124
1125 void CalculateExecutionContext(ExecutionContext &exe_ctx) override;
1126
1128
1129 llvm::Expected<lldb::TypeSystemSP>
1131 bool create_on_demand = true);
1132
1133 std::vector<lldb::TypeSystemSP>
1134 GetScratchTypeSystems(bool create_on_demand = true);
1135
1138
1139 // Creates a UserExpression for the given language, the rest of the
1140 // parameters have the same meaning as for the UserExpression constructor.
1141 // Returns a new-ed object which the caller owns.
1142
1144 GetUserExpressionForLanguage(llvm::StringRef expr, llvm::StringRef prefix,
1145 lldb::LanguageType language,
1146 Expression::ResultType desired_type,
1147 const EvaluateExpressionOptions &options,
1148 ValueObject *ctx_obj, Status &error);
1149
1150 // Creates a FunctionCaller for the given language, the rest of the
1151 // parameters have the same meaning as for the FunctionCaller constructor.
1152 // Since a FunctionCaller can't be
1153 // IR Interpreted, it makes no sense to call this with an
1154 // ExecutionContextScope that lacks
1155 // a Process.
1156 // Returns a new-ed object which the caller owns.
1157
1159 const CompilerType &return_type,
1160 const Address &function_address,
1161 const ValueList &arg_value_list,
1162 const char *name, Status &error);
1163
1164 /// Creates and installs a UtilityFunction for the given language.
1165 llvm::Expected<std::unique_ptr<UtilityFunction>>
1166 CreateUtilityFunction(std::string expression, std::string name,
1167 lldb::LanguageType language, ExecutionContext &exe_ctx);
1168
1169 // Install any files through the platform that need be to installed prior to
1170 // launching or attaching.
1171 Status Install(ProcessLaunchInfo *launch_info);
1172
1173 bool ResolveFileAddress(lldb::addr_t load_addr, Address &so_addr);
1174
1175 bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr,
1177
1178 bool SetSectionLoadAddress(const lldb::SectionSP &section,
1179 lldb::addr_t load_addr,
1180 bool warn_multiple = false);
1181
1182 size_t UnloadModuleSections(const lldb::ModuleSP &module_sp);
1183
1184 size_t UnloadModuleSections(const ModuleList &module_list);
1185
1186 bool SetSectionUnloaded(const lldb::SectionSP &section_sp);
1187
1188 bool SetSectionUnloaded(const lldb::SectionSP &section_sp,
1189 lldb::addr_t load_addr);
1190
1192
1193 /// Set the \a Trace object containing processor trace information of this
1194 /// target.
1195 ///
1196 /// \param[in] trace_sp
1197 /// The trace object.
1198 void SetTrace(const lldb::TraceSP &trace_sp);
1199
1200 /// Get the \a Trace object containing processor trace information of this
1201 /// target.
1202 ///
1203 /// \return
1204 /// The trace object. It might be undefined.
1205 lldb::TraceSP GetTrace();
1206
1207 /// Create a \a Trace object for the current target using the using the
1208 /// default supported tracing technology for this process.
1209 ///
1210 /// \return
1211 /// The new \a Trace or an \a llvm::Error if a \a Trace already exists or
1212 /// the trace couldn't be created.
1213 llvm::Expected<lldb::TraceSP> CreateTrace();
1214
1215 /// If a \a Trace object is present, this returns it, otherwise a new Trace is
1216 /// created with \a Trace::CreateTrace.
1217 llvm::Expected<lldb::TraceSP> GetTraceOrCreate();
1218
1219 // Since expressions results can persist beyond the lifetime of a process,
1220 // and the const expression results are available after a process is gone, we
1221 // provide a way for expressions to be evaluated from the Target itself. If
1222 // an expression is going to be run, then it should have a frame filled in in
1223 // the execution context.
1225 llvm::StringRef expression, ExecutionContextScope *exe_scope,
1226 lldb::ValueObjectSP &result_valobj_sp,
1228 std::string *fixed_expression = nullptr, ValueObject *ctx_obj = nullptr);
1229
1230 lldb::ExpressionVariableSP GetPersistentVariable(ConstString name);
1231
1233
1234 /// This method will return the address of the starting function for
1235 /// this binary, e.g. main() or its equivalent. This can be used as
1236 /// an address of a function that is not called once a binary has
1237 /// started running - e.g. as a return address for inferior function
1238 /// calls that are unambiguous completion of the function call, not
1239 /// called during the course of the inferior function code running.
1240 ///
1241 /// If no entry point can be found, an invalid address is returned.
1242 ///
1243 /// \param [out] err
1244 /// This object will be set to failure if no entry address could
1245 /// be found, and may contain a helpful error message.
1246 //
1247 /// \return
1248 /// Returns the entry address for this program, or an error
1249 /// if none can be found.
1250 llvm::Expected<lldb_private::Address> GetEntryPointAddress();
1251
1252 CompilerType GetRegisterType(const std::string &name,
1253 const lldb_private::RegisterFlags &flags,
1254 uint32_t byte_size);
1255
1256 // Target Stop Hooks
1257 class StopHook : public UserID {
1258 public:
1259 StopHook(const StopHook &rhs);
1260 virtual ~StopHook() = default;
1261
1264 KeepStopped = 0,
1267 };
1268
1269 lldb::TargetSP &GetTarget() { return m_target_sp; }
1270
1271 // Set the specifier. The stop hook will own the specifier, and is
1272 // responsible for deleting it when we're done.
1273 void SetSpecifier(SymbolContextSpecifier *specifier);
1274
1276
1277 bool ExecutionContextPasses(const ExecutionContext &exe_ctx);
1278
1279 // Called on stop, this gets passed the ExecutionContext for each "stop
1280 // with a reason" thread. It should add to the stream whatever text it
1281 // wants to show the user, and return False to indicate it wants the target
1282 // not to stop.
1284 lldb::StreamSP output) = 0;
1285
1286 // Set the Thread Specifier. The stop hook will own the thread specifier,
1287 // and is responsible for deleting it when we're done.
1288 void SetThreadSpecifier(ThreadSpec *specifier);
1289
1291
1292 bool IsActive() { return m_active; }
1293
1294 void SetIsActive(bool is_active) { m_active = is_active; }
1295
1296 void SetAutoContinue(bool auto_continue) {
1297 m_auto_continue = auto_continue;
1298 }
1299
1300 bool GetAutoContinue() const { return m_auto_continue; }
1301
1302 void GetDescription(Stream *s, lldb::DescriptionLevel level) const;
1304 lldb::DescriptionLevel level) const = 0;
1305
1306 protected:
1307 lldb::TargetSP m_target_sp;
1308 lldb::SymbolContextSpecifierSP m_specifier_sp;
1309 std::unique_ptr<ThreadSpec> m_thread_spec_up;
1310 bool m_active = true;
1311 bool m_auto_continue = false;
1312
1313 StopHook(lldb::TargetSP target_sp, lldb::user_id_t uid);
1314 };
1315
1317 public:
1318 ~StopHookCommandLine() override = default;
1319
1321 void SetActionFromString(const std::string &strings);
1322 void SetActionFromStrings(const std::vector<std::string> &strings);
1323
1325 lldb::StreamSP output_sp) override;
1327 lldb::DescriptionLevel level) const override;
1328
1329 private:
1331 // Use CreateStopHook to make a new empty stop hook. The GetCommandPointer
1332 // and fill it with commands, and SetSpecifier to set the specifier shared
1333 // pointer (can be null, that will match anything.)
1334 StopHookCommandLine(lldb::TargetSP target_sp, lldb::user_id_t uid)
1335 : StopHook(target_sp, uid) {}
1336 friend class Target;
1337 };
1338
1340 public:
1341 ~StopHookScripted() override = default;
1343 lldb::StreamSP output) override;
1344
1345 Status SetScriptCallback(std::string class_name,
1346 StructuredData::ObjectSP extra_args_sp);
1347
1349 lldb::DescriptionLevel level) const override;
1350
1351 private:
1352 std::string m_class_name;
1353 /// This holds the dictionary of keys & values that can be used to
1354 /// parametrize any given callback's behavior.
1356 /// This holds the python callback object.
1358
1359 /// Use CreateStopHook to make a new empty stop hook. The GetCommandPointer
1360 /// and fill it with commands, and SetSpecifier to set the specifier shared
1361 /// pointer (can be null, that will match anything.)
1362 StopHookScripted(lldb::TargetSP target_sp, lldb::user_id_t uid)
1363 : StopHook(target_sp, uid) {}
1364 friend class Target;
1365 };
1366
1367 typedef std::shared_ptr<StopHook> StopHookSP;
1368
1369 /// Add an empty stop hook to the Target's stop hook list, and returns a
1370 /// shared pointer to it in new_hook. Returns the id of the new hook.
1372
1373 /// If you tried to create a stop hook, and that failed, call this to
1374 /// remove the stop hook, as it will also reset the stop hook counter.
1376
1377 // Runs the stop hooks that have been registered for this target.
1378 // Returns true if the stop hooks cause the target to resume.
1379 bool RunStopHooks();
1380
1382
1383 bool SetSuppresStopHooks(bool suppress) {
1384 bool old_value = m_suppress_stop_hooks;
1385 m_suppress_stop_hooks = suppress;
1386 return old_value;
1387 }
1388
1390
1392
1393 void RemoveAllStopHooks();
1394
1396
1397 bool SetStopHookActiveStateByID(lldb::user_id_t uid, bool active_state);
1398
1399 void SetAllStopHooksActiveState(bool active_state);
1400
1401 size_t GetNumStopHooks() const { return m_stop_hooks.size(); }
1402
1404 if (index >= GetNumStopHooks())
1405 return StopHookSP();
1406 StopHookCollection::iterator pos = m_stop_hooks.begin();
1407
1408 while (index > 0) {
1409 pos++;
1410 index--;
1411 }
1412 return (*pos).second;
1413 }
1414
1415 lldb::PlatformSP GetPlatform() { return m_platform_sp; }
1416
1417 void SetPlatform(const lldb::PlatformSP &platform_sp) {
1418 m_platform_sp = platform_sp;
1419 }
1420
1422
1423 // Methods.
1424 lldb::SearchFilterSP
1425 GetSearchFilterForModule(const FileSpec *containingModule);
1426
1427 lldb::SearchFilterSP
1428 GetSearchFilterForModuleList(const FileSpecList *containingModuleList);
1429
1430 lldb::SearchFilterSP
1431 GetSearchFilterForModuleAndCUList(const FileSpecList *containingModules,
1432 const FileSpecList *containingSourceFiles);
1433
1434 lldb::REPLSP GetREPL(Status &err, lldb::LanguageType language,
1435 const char *repl_options, bool can_create);
1436
1437 void SetREPL(lldb::LanguageType language, lldb::REPLSP repl_sp);
1438
1441 }
1442
1444
1445 /// Add a signal for the target. This will get copied over to the process
1446 /// if the signal exists on that target. Only the values with Yes and No are
1447 /// set, Calculate values will be ignored.
1448protected:
1454 : pass(pass), notify(notify), stop(stop) {}
1456 };
1457 using DummySignalElement = llvm::StringMapEntry<DummySignalValues>;
1458 static bool UpdateSignalFromDummy(lldb::UnixSignalsSP signals_sp,
1459 const DummySignalElement &element);
1460 static bool ResetSignalFromDummy(lldb::UnixSignalsSP signals_sp,
1461 const DummySignalElement &element);
1462
1463public:
1464 /// Add a signal to the Target's list of stored signals/actions. These
1465 /// values will get copied into any processes launched from
1466 /// this target.
1467 void AddDummySignal(llvm::StringRef name, LazyBool pass, LazyBool print,
1468 LazyBool stop);
1469 /// Updates the signals in signals_sp using the stored dummy signals.
1470 /// If warning_stream_sp is not null, if any stored signals are not found in
1471 /// the current process, a warning will be emitted here.
1472 void UpdateSignalsFromDummy(lldb::UnixSignalsSP signals_sp,
1473 lldb::StreamSP warning_stream_sp);
1474 /// Clear the dummy signals in signal_names from the target, or all signals
1475 /// if signal_names is empty. Also remove the behaviors they set from the
1476 /// process's signals if it exists.
1477 void ClearDummySignals(Args &signal_names);
1478 /// Print all the signals set in this target.
1479 void PrintDummySignals(Stream &strm, Args &signals);
1480
1481protected:
1482 /// Implementing of ModuleList::Notifier.
1483
1484 void NotifyModuleAdded(const ModuleList &module_list,
1485 const lldb::ModuleSP &module_sp) override;
1486
1487 void NotifyModuleRemoved(const ModuleList &module_list,
1488 const lldb::ModuleSP &module_sp) override;
1489
1490 void NotifyModuleUpdated(const ModuleList &module_list,
1491 const lldb::ModuleSP &old_module_sp,
1492 const lldb::ModuleSP &new_module_sp) override;
1493
1494 void NotifyWillClearList(const ModuleList &module_list) override;
1495
1496 void NotifyModulesRemoved(lldb_private::ModuleList &module_list) override;
1497
1498 class Arch {
1499 public:
1500 explicit Arch(const ArchSpec &spec);
1501 const Arch &operator=(const ArchSpec &spec);
1502
1503 const ArchSpec &GetSpec() const { return m_spec; }
1504 Architecture *GetPlugin() const { return m_plugin_up.get(); }
1505
1506 private:
1508 std::unique_ptr<Architecture> m_plugin_up;
1509 };
1510
1511 // Member variables.
1513 lldb::PlatformSP m_platform_sp; ///< The platform for this target.
1514 std::recursive_mutex m_mutex; ///< An API mutex that is used by the lldb::SB*
1515 /// classes make the SB interface thread safe
1516 /// When the private state thread calls SB API's - usually because it is
1517 /// running OS plugin or Python ThreadPlan code - it should not block on the
1518 /// API mutex that is held by the code that kicked off the sequence of events
1519 /// that led us to run the code. We hand out this mutex instead when we
1520 /// detect that code is running on the private state thread.
1521 std::recursive_mutex m_private_mutex;
1523 ModuleList m_images; ///< The list of images for this process (shared
1524 /// libraries and anything dynamically loaded).
1529 std::map<ConstString, std::unique_ptr<BreakpointName>>;
1531
1532 lldb::BreakpointSP m_last_created_breakpoint;
1534 lldb::WatchpointSP m_last_created_watchpoint;
1535 // We want to tightly control the process destruction process so we can
1536 // correctly tear down everything that we need to, so the only class that
1537 // knows about the process lifespan is this target class.
1538 lldb::ProcessSP m_process_sp;
1539 lldb::SearchFilterSP m_search_filter_sp;
1542
1543 typedef std::map<lldb::LanguageType, lldb::REPLSP> REPLMap;
1545
1546 lldb::SourceManagerUP m_source_manager_up;
1547
1548 typedef std::map<lldb::user_id_t, StopHookSP> StopHookCollection;
1551 uint32_t m_latest_stop_hook_id; /// This records the last natural stop at
1552 /// which we ran a stop-hook.
1554 bool m_suppress_stop_hooks; /// Used to not run stop hooks for expressions
1557 /// An optional \a lldb_private::Trace object containing processor trace
1558 /// information of this target.
1559 lldb::TraceSP m_trace_sp;
1560 /// Stores the frame recognizers of this target.
1561 lldb::StackFrameRecognizerManagerUP m_frame_recognizer_manager_up;
1562 /// These are used to set the signal state when you don't have a process and
1563 /// more usefully in the Dummy target where you can't know exactly what
1564 /// signals you will have.
1565 llvm::StringMap<DummySignalValues> m_dummy_signals;
1566
1567 static void ImageSearchPathsChanged(const PathMappingList &path_list,
1568 void *baton);
1569
1570 // Utilities for `statistics` command.
1571private:
1572 // Target metrics storage.
1574
1575public:
1576 /// Get metrics associated with this target in JSON format.
1577 ///
1578 /// Target metrics help measure timings and information that is contained in
1579 /// a target. These are designed to help measure performance of a debug
1580 /// session as well as represent the current state of the target, like
1581 /// information on the currently modules, currently set breakpoints and more.
1582 ///
1583 /// \return
1584 /// Returns a JSON value that contains all target metrics.
1585 llvm::json::Value ReportStatistics();
1586
1588
1589private:
1590 /// Construct with optional file and arch.
1591 ///
1592 /// This member is private. Clients must use
1593 /// TargetList::CreateTarget(const FileSpec*, const ArchSpec*)
1594 /// so all targets can be tracked from the central target list.
1595 ///
1596 /// \see TargetList::CreateTarget(const FileSpec*, const ArchSpec*)
1597 Target(Debugger &debugger, const ArchSpec &target_arch,
1598 const lldb::PlatformSP &platform_sp, bool is_dummy_target);
1599
1600 // Helper function.
1601 bool ProcessIsValid();
1602
1603 // Copy breakpoints, stop hooks and so forth from the dummy target:
1604 void PrimeFromDummyTarget(Target &target);
1605
1606 void AddBreakpoint(lldb::BreakpointSP breakpoint_sp, bool internal);
1607
1609
1610 /// Return a recommended size for memory reads at \a addr, optimizing for
1611 /// cache usage.
1613
1614 Target(const Target &) = delete;
1615 const Target &operator=(const Target &) = delete;
1616};
1617
1618} // namespace lldb_private
1619
1620#endif // LLDB_TARGET_TARGET_H
static llvm::raw_ostream & error(Stream &strm)
A section + offset based address class.
Definition: Address.h:59
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:39
A class to manage flag bits.
Definition: Debugger.h:78
void SetLanguage(lldb::LanguageType language)
Definition: Target.h:311
const char * GetPrefix() const
Definition: Target.h:315
void SetOneThreadTimeout(const Timeout< std::micro > &timeout)
Definition: Target.h:357
uint64_t GetRetriesWithFixIts() const
Definition: Target.h:436
void SetUnwindOnError(bool unwind=false)
Definition: Target.h:330
const char * GetPoundLineFilePath() const
Definition: Target.h:416
lldb::DynamicValueType m_use_dynamic
Definition: Target.h:464
void SetExecutionPolicy(ExecutionPolicy policy=eExecutionPolicyAlways)
Definition: Target.h:305
Timeout< std::micro > m_one_thread_timeout
Definition: Target.h:466
bool InvokeCancelCallback(lldb::ExpressionEvaluationPhase phase) const
Definition: Target.h:398
lldb::DynamicValueType GetUseDynamic() const
Definition: Target.h:342
void SetKeepInMemory(bool keep=true)
Definition: Target.h:340
void SetCoerceToId(bool coerce=true)
Definition: Target.h:326
ExecutionPolicy GetExecutionPolicy() const
Definition: Target.h:303
Timeout< std::micro > m_timeout
Definition: Target.h:465
void SetPrefix(const char *prefix)
Definition: Target.h:319
void SetTryAllThreads(bool try_others=true)
Definition: Target.h:363
lldb::LanguageType GetLanguage() const
Definition: Target.h:309
void SetPoundLine(const char *path, uint32_t line) const
Definition: Target.h:406
void SetRetriesWithFixIts(uint64_t number_of_retries)
Definition: Target.h:432
void SetTimeout(const Timeout< std::micro > &timeout)
Definition: Target.h:351
static constexpr ExecutionPolicy default_execution_policy
Definition: Target.h:298
void SetStopOthers(bool stop_others=true)
Definition: Target.h:367
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:462
void SetCancelCallback(lldb::ExpressionCancelCallback callback, void *baton)
Definition: Target.h:393
const Timeout< std::micro > & GetTimeout() const
Definition: Target.h:349
void SetIgnoreBreakpoints(bool ignore=false)
Definition: Target.h:334
void SetUseDynamic(lldb::DynamicValueType dynamic=lldb::eDynamicCanRunTarget)
Definition: Target.h:345
lldb::ExpressionCancelCallback m_cancel_callback
Definition: Target.h:467
static constexpr std::chrono::milliseconds default_timeout
Definition: Target.h:293
const Timeout< std::micro > & GetOneThreadTimeout() const
Definition: Target.h:353
"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:24
A file utility class.
Definition: FileSpec.h:56
Encapsulates a function that can be called.
A collection class for Module objects.
Definition: ModuleList.h:82
bool LoadScriptingResourcesInTarget(Target *target, std::list< Status > &errors, Stream *feedback_stream=nullptr, 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:33
uint32_t GetMaximumSizeOfStringSummary() const
Definition: Target.cpp:4504
FileSpecList GetDebugFileSearchPaths()
Definition: Target.cpp:4391
bool GetDisplayRecognizedArguments() const
Definition: Target.cpp:4662
ImportStdModule GetImportStdModule() const
Definition: Target.cpp:4407
bool GetMoveToNearestCode() const
Definition: Target.cpp:4165
void AppendExecutableSearchPaths(const FileSpec &)
Definition: Target.cpp:4378
bool GetEnableSyntheticValue() const
Definition: Target.cpp:4477
void SetStandardInputPath(const char *path)=delete
ProcessLaunchInfo m_launch_info
Definition: Target.h:278
uint64_t GetExprAllocAlign() const
Definition: Target.cpp:4583
MemoryModuleLoadLevel GetMemoryModuleLoadLevel() const
Definition: Target.cpp:4634
llvm::StringRef GetArg0() const
Definition: Target.cpp:4258
uint32_t GetMaximumMemReadSize() const
Definition: Target.cpp:4510
void SetRunArguments(const Args &args)
Definition: Target.cpp:4275
FileSpec GetStandardErrorPath() const
Definition: Target.cpp:4536
bool GetEnableNotifyAboutFixIts() const
Definition: Target.cpp:4433
bool SetPreferDynamicValue(lldb::DynamicValueType d)
Definition: Target.cpp:4178
void SetDisplayRecognizedArguments(bool b)
Definition: Target.cpp:4668
const ProcessLaunchInfo & GetProcessLaunchInfo() const
Definition: Target.cpp:4673
Environment ComputeEnvironment() const
Definition: Target.cpp:4281
void SetInjectLocalVariables(ExecutionContext *exe_ctx, bool b)
Definition: Target.cpp:4145
void SetStandardOutputPath(const char *path)=delete
bool GetUserSpecifiedTrapHandlerNames(Args &args) const
Definition: Target.cpp:4641
uint64_t GetExprErrorLimit() const
Definition: Target.cpp:4565
bool GetEnableAutoImportClangModules() const
Definition: Target.cpp:4401
bool GetDebugUtilityExpression() const
Definition: Target.cpp:4779
DynamicClassInfoHelper GetDynamicClassInfoHelper() const
Definition: Target.cpp:4414
FileSpec GetStandardOutputPath() const
Definition: Target.cpp:4526
void SetDisplayRuntimeSupportValues(bool b)
Definition: Target.cpp:4657
uint32_t GetMaximumNumberOfChildrenToDisplay() const
Definition: Target.cpp:4489
void SetRequireHardwareBreakpoints(bool b)
Definition: Target.cpp:4711
bool GetAutoInstallMainExecutable() const
Definition: Target.cpp:4716
uint64_t GetNumberOfRetriesWithFixits() const
Definition: Target.cpp:4427
uint64_t GetExprAllocSize() const
Definition: Target.cpp:4577
llvm::StringRef GetExpressionPrefixContents()
Definition: Target.cpp:4551
const char * GetDisassemblyFlavor() const
Definition: Target.cpp:4238
FileSpec GetStandardInputPath() const
Definition: Target.cpp:4516
lldb::DynamicValueType GetPreferDynamicValue() const
Definition: Target.cpp:4171
InlineStrategy GetInlineStrategy() const
Definition: Target.cpp:4251
Environment GetTargetEnvironment() const
Definition: Target.cpp:4341
bool GetDisplayRuntimeSupportValues() const
Definition: Target.cpp:4651
void SetUserSpecifiedTrapHandlerNames(const Args &args)
Definition: Target.cpp:4646
bool GetUseHexImmediates() const
Definition: Target.cpp:4595
uint32_t GetMaxZeroPaddingInFloatFormat() const
Definition: Target.cpp:4483
uint64_t GetExprAllocAddress() const
Definition: Target.cpp:4571
LoadCWDlldbinitFile GetLoadCWDlldbinitFile() const
Definition: Target.cpp:4620
Environment GetInheritedEnvironment() const
Definition: Target.cpp:4313
void SetArg0(llvm::StringRef arg)
Definition: Target.cpp:4264
bool GetInjectLocalVariables(ExecutionContext *exe_ctx) const
Definition: Target.cpp:4131
void SetStandardErrorPath(const char *path)=delete
Environment GetEnvironment() const
Definition: Target.cpp:4309
void SetProcessLaunchInfo(const ProcessLaunchInfo &launch_info)
Definition: Target.cpp:4677
FileSpec GetSaveJITObjectsDir() const
Definition: Target.cpp:4439
void SetEnvironment(Environment env)
Definition: Target.cpp:4352
LoadScriptFromSymFile GetLoadScriptFromSymbolFile() const
Definition: Target.cpp:4613
void SetStandardErrorPath(llvm::StringRef path)
Definition: Target.cpp:4541
bool GetRunArguments(Args &args) const
Definition: Target.cpp:4270
bool GetBreakpointsConsultPlatformAvoidList()
Definition: Target.cpp:4589
FileSpecList GetExecutableSearchPaths()
Definition: Target.cpp:4386
ArchSpec GetDefaultArchitecture() const
Definition: Target.cpp:4155
Disassembler::HexImmediateStyle GetHexImmediateStyle() const
Definition: Target.cpp:4627
std::unique_ptr< TargetExperimentalProperties > m_experimental_properties_up
Definition: Target.h:279
FileSpecList GetClangModuleSearchPaths()
Definition: Target.cpp:4396
void SetStandardOutputPath(llvm::StringRef path)
Definition: Target.cpp:4531
bool GetRequireHardwareBreakpoints() const
Definition: Target.cpp:4705
PathMappingList & GetSourcePathMap() const
Definition: Target.cpp:4364
bool GetAutoSourceMapRelative() const
Definition: Target.cpp:4372
void SetDefaultArchitecture(const ArchSpec &arch)
Definition: Target.cpp:4160
void SetStandardInputPath(llvm::StringRef path)
Definition: Target.cpp:4521
lldb::LanguageType GetLanguage() const
Definition: Target.cpp:4546
bool GetDisplayExpressionsInCrashlogs() const
Definition: Target.cpp:4607
bool GetEnableAutoApplyFixIts() const
Definition: Target.cpp:4421
void SetDebugUtilityExpression(bool debug)
Definition: Target.cpp:4785
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:4496
A class that represents statistics for a since lldb_private::Target.
Definition: Statistics.h:134
std::unique_ptr< Architecture > m_plugin_up
Definition: Target.h:1508
const ArchSpec & GetSpec() const
Definition: Target.h:1503
const Arch & operator=(const ArchSpec &spec)
Definition: Target.cpp:82
Architecture * GetPlugin() const
Definition: Target.h:1504
void SetActionFromString(const std::string &strings)
Definition: Target.cpp:3693
StopHookCommandLine(lldb::TargetSP target_sp, lldb::user_id_t uid)
Definition: Target.h:1334
void SetActionFromStrings(const std::vector< std::string > &strings)
Definition: Target.cpp:3697
void GetSubclassDescription(Stream *s, lldb::DescriptionLevel level) const override
Definition: Target.cpp:3674
StopHookResult HandleStop(ExecutionContext &exc_ctx, lldb::StreamSP output_sp) override
Definition: Target.cpp:3704
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:1357
Status SetScriptCallback(std::string class_name, StructuredData::ObjectSP extra_args_sp)
Definition: Target.cpp:3738
StopHookResult HandleStop(ExecutionContext &exc_ctx, lldb::StreamSP output) override
Definition: Target.cpp:3759
StopHookScripted(lldb::TargetSP target_sp, lldb::user_id_t uid)
Use CreateStopHook to make a new empty stop hook.
Definition: Target.h:1362
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:1355
virtual void GetSubclassDescription(Stream *s, lldb::DescriptionLevel level) const =0
SymbolContextSpecifier * GetSpecifier()
Definition: Target.h:1275
void GetDescription(Stream *s, lldb::DescriptionLevel level) const
Definition: Target.cpp:3632
void SetSpecifier(SymbolContextSpecifier *specifier)
Definition: Target.cpp:3608
virtual StopHookResult HandleStop(ExecutionContext &exe_ctx, lldb::StreamSP output)=0
std::unique_ptr< ThreadSpec > m_thread_spec_up
Definition: Target.h:1309
void SetIsActive(bool is_active)
Definition: Target.h:1294
void SetThreadSpecifier(ThreadSpec *specifier)
Definition: Target.cpp:3612
ThreadSpec * GetThreadSpecifier()
Definition: Target.h:1290
lldb::TargetSP m_target_sp
Definition: Target.h:1307
bool GetAutoContinue() const
Definition: Target.h:1300
bool ExecutionContextPasses(const ExecutionContext &exe_ctx)
Definition: Target.cpp:3616
lldb::TargetSP & GetTarget()
Definition: Target.h:1269
lldb::SymbolContextSpecifierSP m_specifier_sp
Definition: Target.h:1308
void SetAutoContinue(bool auto_continue)
Definition: Target.h:1296
const ModuleList & GetModuleList() const
Definition: Target.h:531
void Dump(Stream *s) const override
Definition: Target.cpp:4805
static llvm::StringRef GetFlavorString()
Definition: Target.cpp:4801
static ModuleList GetModuleListFromEvent(const Event *event_ptr)
Definition: Target.cpp:4834
static const TargetEventData * GetEventDataFromEvent(const Event *event_ptr)
Definition: Target.cpp:4815
llvm::StringRef GetFlavor() const override
Definition: Target.h:517
const lldb::TargetSP & GetTarget() const
Definition: Target.h:529
TargetEventData(const TargetEventData &)=delete
const TargetEventData & operator=(const TargetEventData &)=delete
static lldb::TargetSP GetTargetFromEvent(const Event *event_ptr)
Definition: Target.cpp:4825
void ModulesDidLoad(ModuleList &module_list)
Definition: Target.cpp:1647
lldb::ThreadSP CalculateThread() override
Definition: Target.cpp:2313
REPLMap m_repl_map
Definition: Target.h:1544
StopHookCollection m_stop_hooks
Definition: Target.h:1549
Module * GetExecutableModulePointer()
Definition: Target.cpp:1387
void Dump(Stream *s, lldb::DescriptionLevel description_level)
Dump a description of this object to a Stream.
Definition: Target.cpp:156
bool m_suppress_stop_hooks
Definition: Target.h:1554
void DisableAllBreakpoints(bool internal_also=false)
Definition: Target.cpp:921
lldb::WatchpointSP CreateWatchpoint(lldb::addr_t addr, size_t size, const CompilerType *type, uint32_t kind, Status &error)
Definition: Target.cpp:814
void ApplyNameToBreakpoints(BreakpointName &bp_name)
Definition: Target.cpp:768
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:2727
lldb::TraceSP GetTrace()
Get the Trace object containing processor trace information of this target.
Definition: Target.cpp:3273
PathMappingList & GetImageSearchPathList()
Definition: Target.cpp:2322
void FinalizeFileActions(ProcessLaunchInfo &info)
Definition: Target.cpp:3392
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:2701
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:2709
ModuleList & GetImages()
Definition: Target.h:956
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:622
static Target * GetTargetFromContexts(const ExecutionContext *exe_ctx_ptr, const SymbolContext *sc_ptr)
Definition: Target.cpp:2539
lldb::addr_t GetBreakableLoadAddress(lldb::addr_t addr)
Definition: Target.cpp:2716
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:3540
bool SetSuppresStopHooks(bool suppress)
Definition: Target.h:1383
static void ImageSearchPathsChanged(const PathMappingList &path_list, void *baton)
Definition: Target.cpp:2326
llvm::Expected< lldb_private::Address > GetEntryPointAddress()
This method will return the address of the starting function for this binary, e.g.
Definition: Target.cpp:2665
bool IgnoreWatchpointByID(lldb::watch_id_t watch_id, uint32_t ignore_count)
Definition: Target.cpp:1357
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:588
lldb::BreakpointSP GetBreakpointByID(lldb::break_id_t break_id)
Definition: Target.cpp:326
std::shared_ptr< StopHook > StopHookSP
Definition: Target.h:1367
void SymbolsDidLoad(ModuleList &module_list)
Definition: Target.cpp:1664
bool ClearAllWatchpointHistoricValues()
Definition: Target.cpp:1271
void SetTrace(const lldb::TraceSP &trace_sp)
Set the Trace object containing processor trace information of this target.
Definition: Target.cpp:3271
BreakpointList & GetBreakpointList(bool internal=false)
Definition: Target.cpp:312
CompilerType GetRegisterType(const std::string &name, const lldb_private::RegisterFlags &flags, uint32_t byte_size)
Definition: Target.cpp:2363
BreakpointNameList m_breakpoint_names
Definition: Target.h:1530
llvm::StringRef GetABIName() const
Returns the name of the target's ABI plugin.
Definition: Target.cpp:301
SourceManager & GetSourceManager()
Definition: Target.cpp:2721
lldb::SearchFilterSP GetSearchFilterForModuleList(const FileSpecList *containingModuleList)
Definition: Target.cpp:551
StopHookSP GetStopHookByID(lldb::user_id_t uid)
Definition: Target.cpp:2756
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:1565
lldb::ProcessSP m_process_sp
Definition: Target.h:1538
lldb::SearchFilterSP m_search_filter_sp
Definition: Target.h:1539
PersistentExpressionState * GetPersistentExpressionStateForLanguage(lldb::LanguageType language)
Definition: Target.cpp:2406
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:2425
static ConstString & GetStaticBroadcasterClass()
Definition: Target.cpp:88
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:3528
bool m_is_dummy_target
Used to not run stop hooks for expressions.
Definition: Target.h:1555
static bool UpdateSignalFromDummy(lldb::UnixSignalsSP signals_sp, const DummySignalElement &element)
Definition: Target.cpp:3486
PathMappingList m_image_search_paths
Definition: Target.h:1540
bool ModuleIsExcludedForUnconstrainedSearches(const FileSpec &module_spec)
Return whether this FileSpec corresponds to a module that should be considered for general searches.
Definition: Target.cpp:1718
lldb::StackFrameSP CalculateStackFrame() override
Definition: Target.cpp:2315
SectionLoadList & GetSectionLoadList()
Definition: Target.h:1109
lldb::addr_t GetPersistentSymbol(ConstString name)
Definition: Target.cpp:2645
void PrimeFromDummyTarget(Target &target)
Definition: Target.cpp:134
std::map< ConstString, std::unique_ptr< BreakpointName > > BreakpointNameList
Definition: Target.h:1529
static void SettingsTerminate()
Definition: Target.cpp:2518
bool EnableWatchpointByID(lldb::watch_id_t watch_id)
Definition: Target.cpp:1322
bool ResolveFileAddress(lldb::addr_t load_addr, Address &so_addr)
Definition: Target.cpp:3014
Debugger & GetDebugger()
Definition: Target.h:1037
bool ClearAllWatchpointHitCounts()
Definition: Target.cpp:1257
size_t ReadMemoryFromFileCache(const Address &addr, void *dst, size_t dst_len, Status &error)
Definition: Target.cpp:1750
void ClearAllLoadedSections()
Definition: Target.cpp:3090
size_t GetNumStopHooks() const
Definition: Target.h:1401
std::vector< lldb::TypeSystemSP > GetScratchTypeSystems(bool create_on_demand=true)
Definition: Target.cpp:2372
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:2042
void DeleteCurrentProcess()
Definition: Target.cpp:191
BreakpointList m_internal_breakpoint_list
Definition: Target.h:1527
lldb::BreakpointSP CreateAddressInModuleBreakpoint(lldb::addr_t file_addr, bool internal, const FileSpec *file_spec, bool request_hardware)
Definition: Target.cpp:442
void DisableAllowedBreakpoints()
Definition: Target.cpp:931
bool SetSectionUnloaded(const lldb::SectionSP &section_sp)
Definition: Target.cpp:3068
lldb::TargetSP CalculateTarget() override
Definition: Target.cpp:2309
const lldb::ProcessSP & GetProcessSP() const
Definition: Target.cpp:219
void ClearModules(bool delete_locations)
Definition: Target.cpp:1409
bool RemoveBreakpointByID(lldb::break_id_t break_id)
Definition: Target.cpp:955
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:2112
static bool ResetSignalFromDummy(lldb::UnixSignalsSP signals_sp, const DummySignalElement &element)
Definition: Target.cpp:3513
Architecture * GetArchitecturePlugin() const
Definition: Target.h:1035
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:2457
TargetStats & GetStatistics()
Definition: Target.h:1587
void EnableAllBreakpoints(bool internal_also=false)
Definition: Target.cpp:938
Status Launch(ProcessLaunchInfo &launch_info, Stream *stream)
Definition: Target.cpp:3103
bool DisableBreakpointByID(lldb::break_id_t break_id)
Definition: Target.cpp:975
BreakpointName * FindBreakpointName(ConstString name, bool can_create, Status &error)
Definition: Target.cpp:721
std::map< lldb::user_id_t, StopHookSP > StopHookCollection
Definition: Target.h:1548
llvm::Expected< lldb::TraceSP > CreateTrace()
Create a Trace object for the current target using the using the default supported tracing technology...
Definition: Target.cpp:3275
lldb::TraceSP m_trace_sp
An optional lldb_private::Trace object containing processor trace information of this target.
Definition: Target.h:1559
bool RemoveAllWatchpoints(bool end_to_end=true)
Definition: Target.cpp:1175
bool ReadPointerFromMemory(const Address &addr, Status &error, Address &pointer_addr, bool force_live_memory=false)
Definition: Target.cpp:2082
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:2742
WatchpointList m_watchpoint_list
Definition: Target.h:1533
@ eBroadcastBitModulesLoaded
Definition: Target.h:489
@ eBroadcastBitSymbolsChanged
Definition: Target.h:493
@ eBroadcastBitSymbolsLoaded
Definition: Target.h:492
@ eBroadcastBitModulesUnloaded
Definition: Target.h:490
@ eBroadcastBitWatchpointChanged
Definition: Target.h:491
@ eBroadcastBitBreakpointChanged
Definition: Target.h:488
BreakpointList m_breakpoint_list
Definition: Target.h:1526
lldb::SourceManagerUP m_source_manager_up
Definition: Target.h:1546
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:1782
bool RemoveWatchpointByID(lldb::watch_id_t watch_id)
Definition: Target.cpp:1341
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:1993
void DeleteBreakpointName(ConstString name)
Definition: Target.cpp:744
void NotifyWillClearList(const ModuleList &module_list) override
Definition: Target.cpp:1609
bool SetArchitecture(const ArchSpec &arch_spec, bool set_platform=false, bool merge=true)
Set the architecture for this target.
Definition: Target.cpp:1489
void AddNameToBreakpoint(lldb::BreakpointSP &bp_sp, const char *name, Status &error)
void NotifyModuleAdded(const ModuleList &module_list, const lldb::ModuleSP &module_sp) override
Implementing of ModuleList::Notifier.
Definition: Target.cpp:1611
llvm::Expected< lldb::TypeSystemSP > GetScratchTypeSystemForLanguage(lldb::LanguageType language, bool create_on_demand=true)
Definition: Target.cpp:2335
void ConfigureBreakpointName(BreakpointName &bp_name, const BreakpointOptions &options, const BreakpointName::Permissions &permissions)
Definition: Target.cpp:760
lldb::SearchFilterSP GetSearchFilterForModuleAndCUList(const FileSpecList *containingModules, const FileSpecList *containingSourceFiles)
Definition: Target.cpp:568
lldb::ModuleSP GetExecutableModule()
Gets the module for the main executable.
Definition: Target.cpp:1373
bool SetStopHookActiveStateByID(lldb::user_id_t uid, bool active_state)
Definition: Target.cpp:2766
const lldb::ProcessSP & CreateProcess(lldb::ListenerSP listener_sp, llvm::StringRef plugin_name, const FileSpec *crash_file, bool can_connect)
Definition: Target.cpp:207
void SetAllStopHooksActiveState(bool active_state)
Definition: Target.cpp:2777
lldb::ExpressionVariableSP GetPersistentVariable(ConstString name)
Definition: Target.cpp:2626
void NotifyModulesRemoved(lldb_private::ModuleList &module_list) override
Definition: Target.cpp:1643
size_t ReadCStringFromMemory(const Address &addr, std::string &out_str, Status &error, bool force_live_memory=false)
Definition: Target.cpp:1903
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:1514
void ModulesDidUnload(ModuleList &module_list, bool delete_locations)
Definition: Target.cpp:1679
void CalculateExecutionContext(ExecutionContext &exe_ctx) override
Reconstruct the object's execution context into sc.
Definition: Target.cpp:2317
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:3300
void NotifyModuleUpdated(const ModuleList &module_list, const lldb::ModuleSP &old_module_sp, const lldb::ModuleSP &new_module_sp) override
Definition: Target.cpp:1631
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:500
Status SerializeBreakpointsToFile(const FileSpec &file, const BreakpointIDList &bp_ids, bool append)
Definition: Target.cpp:1016
void DidExec()
Called as the last function in Process::DidExec().
Definition: Target.cpp:1416
void SaveScriptedLaunchInfo(lldb_private::ProcessInfo &process_info)
Definition: Target.cpp:3092
bool GetSuppressStopHooks()
Definition: Target.h:1389
lldb::user_id_t m_stop_hook_next_id
Definition: Target.h:1550
void RemoveAllStopHooks()
Definition: Target.cpp:2754
static FileSpecList GetDefaultExecutableSearchPaths()
Definition: Target.cpp:2520
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:605
lldb::SearchFilterSP GetSearchFilterForModule(const FileSpec *containingModule)
Definition: Target.cpp:533
llvm::StringMapEntry< DummySignalValues > DummySignalElement
Definition: Target.h:1457
std::recursive_mutex & GetAPIMutex()
Definition: Target.cpp:4842
static FileSpecList GetDefaultDebugFileSearchPaths()
Definition: Target.cpp:2524
void EnableAllowedBreakpoints()
Definition: Target.cpp:948
uint32_t m_latest_stop_hook_id
Definition: Target.h:1551
StackFrameRecognizerManager & GetFrameRecognizerManager()
Definition: Target.h:1439
void RemoveAllowedBreakpoints()
Definition: Target.cpp:900
StopHookSP GetStopHookAtIndex(size_t index)
Definition: Target.h:1403
bool DisableAllWatchpoints(bool end_to_end=true)
Definition: Target.cpp:1204
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:1980
lldb::PlatformSP m_platform_sp
The platform for this target.
Definition: Target.h:1513
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:2487
static TargetProperties & GetGlobalProperties()
Definition: Target.cpp:2953
Status Install(ProcessLaunchInfo *launch_info)
Definition: Target.cpp:2961
lldb::PlatformSP GetPlatform()
Definition: Target.h:1415
void NotifyModuleRemoved(const ModuleList &module_list, const lldb::ModuleSP &module_sp) override
Definition: Target.cpp:1621
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:354
bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr, uint32_t stop_id=SectionLoadHistory::eStopIDNow)
Definition: Target.cpp:3009
void RemoveAllBreakpoints(bool internal_also=false)
Definition: Target.cpp:909
bool LoadScriptingResources(std::list< Status > &errors, Stream *feedback_stream=nullptr, bool continue_on_error=true)
Definition: Target.h:930
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:337
static ArchSpec GetDefaultArchitecture()
Definition: Target.cpp:2528
void ResetBreakpointHitCounts()
Resets the hit count of all breakpoints.
Definition: Target.cpp:1012
const ModuleList & GetImages() const
Get accessor for the images for this process.
Definition: Target.h:954
const ArchSpec & GetArchitecture() const
Definition: Target.h:996
WatchpointList & GetWatchpointList()
Definition: Target.h:748
unsigned m_next_persistent_variable_index
Definition: Target.h:1556
bool EnableBreakpointByID(lldb::break_id_t break_id)
Definition: Target.cpp:993
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:2071
TargetStats m_stats
Definition: Target.h:1573
bool IgnoreAllWatchpoints(uint32_t ignore_count)
Definition: Target.cpp:1286
void AddBreakpoint(lldb::BreakpointSP breakpoint_sp, bool internal)
Definition: Target.cpp:667
TypeSystemMap m_scratch_type_system_map
Definition: Target.h:1541
void AddBreakpointName(std::unique_ptr< BreakpointName > bp_name)
Definition: Target.cpp:716
SectionLoadHistory m_section_load_history
Definition: Target.h:1525
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:782
bool IsDummyTarget() const
Definition: Target.h:555
size_t UnloadModuleSections(const lldb::ModuleSP &module_sp)
Definition: Target.cpp:3049
bool m_valid
This records the last natural stop at which we ran a stop-hook.
Definition: Target.h:1553
bool DisableWatchpointByID(lldb::watch_id_t watch_id)
Definition: Target.cpp:1303
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:3471
lldb::WatchpointSP m_last_created_watchpoint
Definition: Target.h:1534
Status CreateBreakpointsFromFile(const FileSpec &file, BreakpointIDList &new_bps)
Definition: Target.cpp:1108
Debugger & m_debugger
Definition: Target.h:1512
void SetREPL(lldb::LanguageType language, lldb::REPLSP repl_sp)
Definition: Target.cpp:271
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:1422
lldb::StackFrameRecognizerManagerUP m_frame_recognizer_manager_up
Stores the frame recognizers of this target.
Definition: Target.h:1561
llvm::json::Value ReportStatistics()
Get metrics associated with this target in JSON format.
Definition: Target.cpp:4850
lldb::REPLSP GetREPL(Status &err, lldb::LanguageType language, const char *repl_options, bool can_create)
Definition: Target.cpp:221
ModuleList m_images
The list of images for this process (shared libraries and anything dynamically loaded).
Definition: Target.h:1523
lldb::ProcessSP CalculateProcess() override
Definition: Target.cpp:2311
void PrintDummySignals(Stream &strm, Args &signals)
Print all the signals set in this target.
Definition: Target.cpp:3565
void SetPlatform(const lldb::PlatformSP &platform_sp)
Definition: Target.h:1417
bool SetSectionLoadAddress(const lldb::SectionSP &section, lldb::addr_t load_addr, bool warn_multiple=false)
Definition: Target.cpp:3019
Status Attach(ProcessAttachInfo &attach_info, Stream *stream)
Definition: Target.cpp:3306
std::map< lldb::LanguageType, lldb::REPLSP > REPLMap
Definition: Target.h:1543
static void SetDefaultArchitecture(const ArchSpec &arch)
Definition: Target.cpp:2532
lldb::BreakpointSP m_last_created_breakpoint
Definition: Target.h:1532
lldb::WatchpointSP GetLastCreatedWatchpoint()
Definition: Target.h:744
void RemoveNameFromBreakpoint(lldb::BreakpointSP &bp_sp, ConstString name)
Definition: Target.cpp:755
bool RemoveStopHookByID(lldb::user_id_t uid)
Definition: Target.cpp:2749
lldb::BreakpointSP GetLastCreatedBreakpoint()
Definition: Target.h:638
static void SettingsInitialize()
Definition: Target.cpp:2516
~Target() override
Definition: Target.cpp:128
void AddNameToBreakpoint(BreakpointID &id, const char *name, Status &error)
Definition: Target.cpp:690
bool EnableAllWatchpoints(bool end_to_end=true)
Definition: Target.cpp:1231
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:1521
lldb::BreakpointSP CreateBreakpoint(lldb::SearchFilterSP &filter_sp, lldb::BreakpointResolverSP &resolver_sp, bool internal, bool request_hardware, bool resolve_indirect_symbols)
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:2553
bool MergeArchitecture(const ArchSpec &arch_spec)
Definition: Target.cpp:1584
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:3837
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
InlineStrategy
Definition: Target.h:44
@ eInlineBreakpointsNever
Definition: Target.h:45
@ eInlineBreakpointsAlways
Definition: Target.h:47
@ eInlineBreakpointsHeaders
Definition: Target.h:46
ExpressionEvaluationPhase
Expression Evaluation Stages.
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
LanguageType
Programming language type.
@ eLanguageTypeUnknown
Unknown or invalid language value.
bool(* ExpressionCancelCallback)(ExpressionEvaluationPhase phase, void *baton)
Definition: lldb-types.h:76
ExpressionResults
The results of expression evaluation.
int32_t break_id_t
Definition: lldb-types.h:84
int32_t watch_id_t
Definition: lldb-types.h:85
uint64_t user_id_t
Definition: lldb-types.h:80
uint64_t addr_t
Definition: lldb-types.h:79
@ eDynamicCanRunTarget
@ eNoDynamicValues
Add a signal for the target.
Definition: Target.h:1449
DummySignalValues(LazyBool pass, LazyBool notify, LazyBool stop)
Definition: Target.h:1453
A mix in class that contains a generic user ID.
Definition: UserID.h:31