📄 debugevent.cpp
字号:
/*Copyright (C) 2006 Evan Teran eteran@alum.rit.eduThis program is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2 of the License, or(at your option) any later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.*/#include "DebugEvent.h"#include <sys/types.h>#include <sys/wait.h>//------------------------------------------------------------------------------// Name: DebugEvent()// Desc: constructor//------------------------------------------------------------------------------DebugEvent::DebugEvent() : status(0) {}//------------------------------------------------------------------------------// Name: DebugEvent(const DebugEvent &other)// Desc: copy constructor//------------------------------------------------------------------------------DebugEvent::DebugEvent(const DebugEvent &other) : status(other.status) {}//------------------------------------------------------------------------------// Name: DebugEvent(int s)// Desc: constructor//------------------------------------------------------------------------------DebugEvent::DebugEvent(int s) : status(s) {}//------------------------------------------------------------------------------// Name: exited() const// Desc: was this even caused by an exit?//------------------------------------------------------------------------------bool DebugEvent::exited() const { return WIFEXITED(status) != 0;}//------------------------------------------------------------------------------// Name: signaled() const// Desc: was this event caused by a signal//------------------------------------------------------------------------------bool DebugEvent::signaled() const { return WIFSIGNALED(status) != 0;}//------------------------------------------------------------------------------// Name: stopped() const// Desc: was this event caused by stop//------------------------------------------------------------------------------bool DebugEvent::stopped() const { return WIFSTOPPED(status) != 0;}//------------------------------------------------------------------------------// Name: exitStatus() const// Desc: if it was an exit event, what was the status//------------------------------------------------------------------------------int DebugEvent::exitStatus() const { return WEXITSTATUS(status);}//------------------------------------------------------------------------------// Name: exitSignal() const// Desc: if it was a signal, what was the signal number//------------------------------------------------------------------------------int DebugEvent::exitSignal() const { return WTERMSIG(status);}//------------------------------------------------------------------------------// Name: stopSignal() const// Desc: if it was a stop, what was the status//------------------------------------------------------------------------------int DebugEvent::stopSignal() const { return WSTOPSIG(status);}//------------------------------------------------------------------------------// Name: reason() const// Desc: what was the reason for this event//------------------------------------------------------------------------------DebugEvent::REASON DebugEvent::reason() const { // this basically converts our value into a "switchable" value for convinience if(stopped()) { return EVENT_STOPPED; } else if(signaled()) { return EVENT_SIGNALED; } else if(exited()) { return EVENT_EXITED; } else { return EVENT_UNKNOWN; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -