From 17cbae24ce6da4f3c94f8487d55641dd1720189f Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Fri, 26 Jun 2015 22:26:50 -0400 Subject: [PATCH] Debugger: Add SignalInfo model class. - Represents information about a signal being delivered to the team. --- src/apps/debugger/Jamfile | 1 + src/apps/debugger/model/SignalInfo.cpp | 46 ++++++++++++++++++++++++++ src/apps/debugger/model/SignalInfo.h | 35 ++++++++++++++++++++ 3 files changed, 82 insertions(+) create mode 100644 src/apps/debugger/model/SignalInfo.cpp create mode 100644 src/apps/debugger/model/SignalInfo.h diff --git a/src/apps/debugger/Jamfile b/src/apps/debugger/Jamfile index 442115964a..4657d1d4f4 100644 --- a/src/apps/debugger/Jamfile +++ b/src/apps/debugger/Jamfile @@ -177,6 +177,7 @@ Application Debugger : LineDataSource.cpp ReturnValueInfo.cpp SemaphoreInfo.cpp + SignalInfo.cpp SourceCode.cpp StackFrame.cpp StackFrameValues.cpp diff --git a/src/apps/debugger/model/SignalInfo.cpp b/src/apps/debugger/model/SignalInfo.cpp new file mode 100644 index 0000000000..e91a53c742 --- /dev/null +++ b/src/apps/debugger/model/SignalInfo.cpp @@ -0,0 +1,46 @@ +/* + * Copyright 2015, Rene Gollent, rene@gollent.com. + * Distributed under the terms of the MIT License. + */ + +#include "SignalInfo.h" + +#include + + +SignalInfo::SignalInfo() + : + fSignal(0), + fDeadly(false) +{ + memset(&fHandler, 0, sizeof(fHandler)); +} + + +SignalInfo::SignalInfo(const SignalInfo& other) + : + fSignal(other.fSignal), + fDeadly(other.fDeadly) +{ + memcpy(&fHandler, &other.fHandler, sizeof(fHandler)); +} + + +SignalInfo::SignalInfo(int signal, const struct sigaction& handler, + bool deadly) + : + fSignal(signal), + fDeadly(deadly) +{ + memcpy(&fHandler, &handler, sizeof(fHandler)); +} + + +void +SignalInfo::SetTo(int signal, const struct sigaction& handler, bool deadly) +{ + fSignal = signal; + fDeadly = deadly; + + memcpy(&fHandler, &handler, sizeof(fHandler)); +} diff --git a/src/apps/debugger/model/SignalInfo.h b/src/apps/debugger/model/SignalInfo.h new file mode 100644 index 0000000000..ffd636171b --- /dev/null +++ b/src/apps/debugger/model/SignalInfo.h @@ -0,0 +1,35 @@ +/* + * Copyright 2015, Rene Gollent, rene@gollent.com. + * Distributed under the terms of the MIT License. + */ +#ifndef SIGNAL_INFO_H +#define SIGNAL_INFO_H + +#include + +#include "Types.h" + + +class SignalInfo { +public: + SignalInfo(); + SignalInfo(const SignalInfo& other); + SignalInfo(int signal, + const struct sigaction& handler, + bool deadly); + + void SetTo(int signal, + const struct sigaction& handler, + bool deadly); + + int Signal() const { return fSignal; } + const struct sigaction& Handler() const { return fHandler; } + bool Deadly() const { return fDeadly; } +private: + int fSignal; + struct sigaction fHandler; + bool fDeadly; +}; + + +#endif // SIGNAL_INFO_H