bug.h
Go to the documentation of this file.
53 // https://www.intel.com/content/www/us/en/architecture-and-technology/64-ia-32-architectures-software-developer-system-programming-manual-325384.html
62 };
69 };
76 };
119 std::make_shared<MemoryWatchpoint_x86_64>(addr, size, cond, static_cast<DebugRegister>(dr), thread);
155 std::unordered_map<const pthread_t *, std::vector<std::shared_ptr<MemoryWatchpoint_x86_64>>> pool_;
184 MemoryWatchpoint_x86_64(void *addr, Size size, Condition cond, DebugRegister dr, const pthread_t *thread)
208 inline uint64_t MakeMask(DebugRegister reg) { return MakeFlags(reg, kBreakStateMask, kConditionMask, kSizeMask); }
220 thread_get_state(target_mach_thread, x86_DEBUG_STATE, reinterpret_cast<thread_state_t>(&dr), &dr_count);
223 throw std::runtime_error("MemoryWatchpoint_x86_64::MemoryWatchpoint_x86_64(): thread_get_state failed");
244 rc = thread_set_state(target_mach_thread, x86_DEBUG_STATE, reinterpret_cast<thread_state_t>(&dr), dr_count);
247 throw std::runtime_error("MemoryWatchpoint_x86_64::MemoryWatchpoint_x86_64(): thread_set_state failed");
Definition: bug.h:270
virtual void set_prefix(const char *p)
This sets a prefix which preceeds all messages printing by Debugger.
Definition: bug.cpp:257
virtual void got_signal(int sig)
Called when signal sig is received. This is mainly for internal use.
Definition: bug.cpp:360
static void set_default_debugger(const std::shared_ptr< Debugger > &)
Set the global default debugger. The initial value is null.
Definition: bug.cpp:406
static void __traceback(const std::string &prefix, const char *reason=nullptr)
Definition: bug.cpp:414
virtual void handle_defaults()
This calls handle(int) with all of the major signals.
Definition: bug.cpp:219
static std::shared_ptr< Debugger > default_debugger()
Return the global default debugger.
Definition: bug.cpp:408
virtual void set_exit_on_signal(int)
Turn on or off exit after a signel. The default is on.
Definition: bug.cpp:404
virtual void handle(int sig)
The Debugger will be activated when sig is caught.
Definition: bug.cpp:204
virtual void release(int sig)
Reverts the effect of handle(sig) , i.e. the Debugger will not be activated when sig is caught.
Definition: bug.cpp:212
static std::shared_ptr< Debugger > default_debugger_
Definition: bug.h:287
virtual void set_debug_on_signal(int)
Turn on or off debugging on a signel. The default is on.
Definition: bug.cpp:398
virtual void set_traceback_on_signal(int)
Turn on or off traceback on a signel. The default is on.
Definition: bug.cpp:400
a singleton pool of MemoryWatchpoint objects
Definition: bug.h:79
Pool & set(void *addr, Size size, Condition cond, const pthread_t *thread)
Definition: bug.h:107
static void initialize_instance(const std::vector< const pthread_t * > &threads)
Definition: bug.h:89
~Pool()=default
static constexpr const size_t nwatchpoints_per_thread
Definition: bug.h:81
MemoryWatchpoint_x86_64 * find(void *addr, const pthread_t *thread)
Definition: bug.h:130
static std::shared_ptr< Pool > instance()
accesses the unique pool; asserts that the default instance has been initialized by calling initializ...
Definition: bug.h:94
Pool & clear(void *addr, const pthread_t *thread)
Definition: bug.h:142
MemoryWatchpoint represents a hardware watchpoint for a memory location Implements a memory watchpoin...
Definition: bug.h:50
MemoryWatchpoint_x86_64(void *addr, Size size, Condition cond, DebugRegister dr, const pthread_t *thread)
creates a MemoryWatchpoint watching memory window [addr,addr+size) for condition cond from threads th...
Definition: bug.h:184
friend class MemoryWatchPool
Definition: bug.h:210
~MemoryWatchpoint_x86_64()
Definition: bug.h:189
DebugRegister debug_register() const
Definition: bug.h:194
void launch_debugger(int rank, const char *exec_name, const char *cmd)
Definition: bug.cpp:445