mirror of
https://github.com/momo5502/emulator.git
synced 2026-01-19 19:53:56 +00:00
Display application success in playground
This commit is contained in:
@@ -230,4 +230,11 @@ namespace debugger
|
||||
suspend_execution(2ms);
|
||||
}
|
||||
}
|
||||
|
||||
void handle_exit(std::optional<NTSTATUS> exit_status)
|
||||
{
|
||||
Debugger::ApplicationExitT response{};
|
||||
response.exit_status = exit_status;
|
||||
send_event(response);
|
||||
}
|
||||
}
|
||||
@@ -18,4 +18,5 @@ namespace debugger
|
||||
};
|
||||
|
||||
void handle_events(event_context& c);
|
||||
void handle_exit(std::optional<NTSTATUS> exit_status);
|
||||
}
|
||||
|
||||
@@ -59,6 +59,10 @@ table ReadRegisterResponse {
|
||||
data: [ubyte];
|
||||
}
|
||||
|
||||
table ApplicationExit {
|
||||
exit_status: uint32 = null;
|
||||
}
|
||||
|
||||
union Event {
|
||||
PauseRequest,
|
||||
RunRequest,
|
||||
@@ -72,6 +76,7 @@ union Event {
|
||||
WriteRegisterResponse,
|
||||
ReadRegisterRequest,
|
||||
ReadRegisterResponse,
|
||||
ApplicationExit,
|
||||
}
|
||||
|
||||
table DebugEvent {
|
||||
|
||||
@@ -63,6 +63,10 @@ struct ReadRegisterResponse;
|
||||
struct ReadRegisterResponseBuilder;
|
||||
struct ReadRegisterResponseT;
|
||||
|
||||
struct ApplicationExit;
|
||||
struct ApplicationExitBuilder;
|
||||
struct ApplicationExitT;
|
||||
|
||||
struct DebugEvent;
|
||||
struct DebugEventBuilder;
|
||||
struct DebugEventT;
|
||||
@@ -114,11 +118,12 @@ enum Event : uint8_t {
|
||||
Event_WriteRegisterResponse = 10,
|
||||
Event_ReadRegisterRequest = 11,
|
||||
Event_ReadRegisterResponse = 12,
|
||||
Event_ApplicationExit = 13,
|
||||
Event_MIN = Event_NONE,
|
||||
Event_MAX = Event_ReadRegisterResponse
|
||||
Event_MAX = Event_ApplicationExit
|
||||
};
|
||||
|
||||
inline const Event (&EnumValuesEvent())[13] {
|
||||
inline const Event (&EnumValuesEvent())[14] {
|
||||
static const Event values[] = {
|
||||
Event_NONE,
|
||||
Event_PauseRequest,
|
||||
@@ -132,13 +137,14 @@ inline const Event (&EnumValuesEvent())[13] {
|
||||
Event_WriteRegisterRequest,
|
||||
Event_WriteRegisterResponse,
|
||||
Event_ReadRegisterRequest,
|
||||
Event_ReadRegisterResponse
|
||||
Event_ReadRegisterResponse,
|
||||
Event_ApplicationExit
|
||||
};
|
||||
return values;
|
||||
}
|
||||
|
||||
inline const char * const *EnumNamesEvent() {
|
||||
static const char * const names[14] = {
|
||||
static const char * const names[15] = {
|
||||
"NONE",
|
||||
"PauseRequest",
|
||||
"RunRequest",
|
||||
@@ -152,13 +158,14 @@ inline const char * const *EnumNamesEvent() {
|
||||
"WriteRegisterResponse",
|
||||
"ReadRegisterRequest",
|
||||
"ReadRegisterResponse",
|
||||
"ApplicationExit",
|
||||
nullptr
|
||||
};
|
||||
return names;
|
||||
}
|
||||
|
||||
inline const char *EnumNameEvent(Event e) {
|
||||
if (::flatbuffers::IsOutRange(e, Event_NONE, Event_ReadRegisterResponse)) return "";
|
||||
if (::flatbuffers::IsOutRange(e, Event_NONE, Event_ApplicationExit)) return "";
|
||||
const size_t index = static_cast<size_t>(e);
|
||||
return EnumNamesEvent()[index];
|
||||
}
|
||||
@@ -215,6 +222,10 @@ template<> struct EventTraits<Debugger::ReadRegisterResponse> {
|
||||
static const Event enum_value = Event_ReadRegisterResponse;
|
||||
};
|
||||
|
||||
template<> struct EventTraits<Debugger::ApplicationExit> {
|
||||
static const Event enum_value = Event_ApplicationExit;
|
||||
};
|
||||
|
||||
template<typename T> struct EventUnionTraits {
|
||||
static const Event enum_value = Event_NONE;
|
||||
};
|
||||
@@ -267,6 +278,10 @@ template<> struct EventUnionTraits<Debugger::ReadRegisterResponseT> {
|
||||
static const Event enum_value = Event_ReadRegisterResponse;
|
||||
};
|
||||
|
||||
template<> struct EventUnionTraits<Debugger::ApplicationExitT> {
|
||||
static const Event enum_value = Event_ApplicationExit;
|
||||
};
|
||||
|
||||
struct EventUnion {
|
||||
Event type;
|
||||
void *value;
|
||||
@@ -393,6 +408,14 @@ struct EventUnion {
|
||||
return type == Event_ReadRegisterResponse ?
|
||||
reinterpret_cast<const Debugger::ReadRegisterResponseT *>(value) : nullptr;
|
||||
}
|
||||
Debugger::ApplicationExitT *AsApplicationExit() {
|
||||
return type == Event_ApplicationExit ?
|
||||
reinterpret_cast<Debugger::ApplicationExitT *>(value) : nullptr;
|
||||
}
|
||||
const Debugger::ApplicationExitT *AsApplicationExit() const {
|
||||
return type == Event_ApplicationExit ?
|
||||
reinterpret_cast<const Debugger::ApplicationExitT *>(value) : nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
bool VerifyEvent(::flatbuffers::Verifier &verifier, const void *obj, Event type);
|
||||
@@ -1200,6 +1223,61 @@ inline ::flatbuffers::Offset<ReadRegisterResponse> CreateReadRegisterResponseDir
|
||||
|
||||
::flatbuffers::Offset<ReadRegisterResponse> CreateReadRegisterResponse(::flatbuffers::FlatBufferBuilder &_fbb, const ReadRegisterResponseT *_o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
|
||||
struct ApplicationExitT : public ::flatbuffers::NativeTable {
|
||||
typedef ApplicationExit TableType;
|
||||
::flatbuffers::Optional<uint32_t> exit_status = ::flatbuffers::nullopt;
|
||||
};
|
||||
|
||||
struct ApplicationExit FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef ApplicationExitT NativeTableType;
|
||||
typedef ApplicationExitBuilder Builder;
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_EXIT_STATUS = 4
|
||||
};
|
||||
::flatbuffers::Optional<uint32_t> exit_status() const {
|
||||
return GetOptional<uint32_t, uint32_t>(VT_EXIT_STATUS);
|
||||
}
|
||||
bool mutate_exit_status(uint32_t _exit_status) {
|
||||
return SetField<uint32_t>(VT_EXIT_STATUS, _exit_status);
|
||||
}
|
||||
bool Verify(::flatbuffers::Verifier &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<uint32_t>(verifier, VT_EXIT_STATUS, 4) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
ApplicationExitT *UnPack(const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
void UnPackTo(ApplicationExitT *_o, const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
static ::flatbuffers::Offset<ApplicationExit> Pack(::flatbuffers::FlatBufferBuilder &_fbb, const ApplicationExitT* _o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
};
|
||||
|
||||
struct ApplicationExitBuilder {
|
||||
typedef ApplicationExit Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_exit_status(uint32_t exit_status) {
|
||||
fbb_.AddElement<uint32_t>(ApplicationExit::VT_EXIT_STATUS, exit_status);
|
||||
}
|
||||
explicit ApplicationExitBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<ApplicationExit> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<ApplicationExit>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<ApplicationExit> CreateApplicationExit(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
::flatbuffers::Optional<uint32_t> exit_status = ::flatbuffers::nullopt) {
|
||||
ApplicationExitBuilder builder_(_fbb);
|
||||
if(exit_status) { builder_.add_exit_status(*exit_status); }
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
::flatbuffers::Offset<ApplicationExit> CreateApplicationExit(::flatbuffers::FlatBufferBuilder &_fbb, const ApplicationExitT *_o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
|
||||
struct DebugEventT : public ::flatbuffers::NativeTable {
|
||||
typedef DebugEvent TableType;
|
||||
Debugger::EventUnion event{};
|
||||
@@ -1255,6 +1333,9 @@ struct DebugEvent FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
const Debugger::ReadRegisterResponse *event_as_ReadRegisterResponse() const {
|
||||
return event_type() == Debugger::Event_ReadRegisterResponse ? static_cast<const Debugger::ReadRegisterResponse *>(event()) : nullptr;
|
||||
}
|
||||
const Debugger::ApplicationExit *event_as_ApplicationExit() const {
|
||||
return event_type() == Debugger::Event_ApplicationExit ? static_cast<const Debugger::ApplicationExit *>(event()) : nullptr;
|
||||
}
|
||||
void *mutable_event() {
|
||||
return GetPointer<void *>(VT_EVENT);
|
||||
}
|
||||
@@ -1318,6 +1399,10 @@ template<> inline const Debugger::ReadRegisterResponse *DebugEvent::event_as<Deb
|
||||
return event_as_ReadRegisterResponse();
|
||||
}
|
||||
|
||||
template<> inline const Debugger::ApplicationExit *DebugEvent::event_as<Debugger::ApplicationExit>() const {
|
||||
return event_as_ApplicationExit();
|
||||
}
|
||||
|
||||
struct DebugEventBuilder {
|
||||
typedef DebugEvent Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
@@ -1684,6 +1769,32 @@ inline ::flatbuffers::Offset<ReadRegisterResponse> CreateReadRegisterResponse(::
|
||||
_data);
|
||||
}
|
||||
|
||||
inline ApplicationExitT *ApplicationExit::UnPack(const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<ApplicationExitT>(new ApplicationExitT());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
return _o.release();
|
||||
}
|
||||
|
||||
inline void ApplicationExit::UnPackTo(ApplicationExitT *_o, const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
(void)_o;
|
||||
(void)_resolver;
|
||||
{ auto _e = exit_status(); _o->exit_status = _e; }
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<ApplicationExit> ApplicationExit::Pack(::flatbuffers::FlatBufferBuilder &_fbb, const ApplicationExitT* _o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
return CreateApplicationExit(_fbb, _o, _rehasher);
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<ApplicationExit> CreateApplicationExit(::flatbuffers::FlatBufferBuilder &_fbb, const ApplicationExitT *_o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
(void)_rehasher;
|
||||
(void)_o;
|
||||
struct _VectorArgs { ::flatbuffers::FlatBufferBuilder *__fbb; const ApplicationExitT* __o; const ::flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
|
||||
auto _exit_status = _o->exit_status;
|
||||
return Debugger::CreateApplicationExit(
|
||||
_fbb,
|
||||
_exit_status);
|
||||
}
|
||||
|
||||
inline DebugEventT *DebugEvent::UnPack(const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<DebugEventT>(new DebugEventT());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
@@ -1766,6 +1877,10 @@ inline bool VerifyEvent(::flatbuffers::Verifier &verifier, const void *obj, Even
|
||||
auto ptr = reinterpret_cast<const Debugger::ReadRegisterResponse *>(obj);
|
||||
return verifier.VerifyTable(ptr);
|
||||
}
|
||||
case Event_ApplicationExit: {
|
||||
auto ptr = reinterpret_cast<const Debugger::ApplicationExit *>(obj);
|
||||
return verifier.VerifyTable(ptr);
|
||||
}
|
||||
default: return true;
|
||||
}
|
||||
}
|
||||
@@ -1833,6 +1948,10 @@ inline void *EventUnion::UnPack(const void *obj, Event type, const ::flatbuffers
|
||||
auto ptr = reinterpret_cast<const Debugger::ReadRegisterResponse *>(obj);
|
||||
return ptr->UnPack(resolver);
|
||||
}
|
||||
case Event_ApplicationExit: {
|
||||
auto ptr = reinterpret_cast<const Debugger::ApplicationExit *>(obj);
|
||||
return ptr->UnPack(resolver);
|
||||
}
|
||||
default: return nullptr;
|
||||
}
|
||||
}
|
||||
@@ -1888,6 +2007,10 @@ inline ::flatbuffers::Offset<void> EventUnion::Pack(::flatbuffers::FlatBufferBui
|
||||
auto ptr = reinterpret_cast<const Debugger::ReadRegisterResponseT *>(value);
|
||||
return CreateReadRegisterResponse(_fbb, ptr, _rehasher).Union();
|
||||
}
|
||||
case Event_ApplicationExit: {
|
||||
auto ptr = reinterpret_cast<const Debugger::ApplicationExitT *>(value);
|
||||
return CreateApplicationExit(_fbb, ptr, _rehasher).Union();
|
||||
}
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
@@ -1942,6 +2065,10 @@ inline EventUnion::EventUnion(const EventUnion &u) : type(u.type), value(nullptr
|
||||
value = new Debugger::ReadRegisterResponseT(*reinterpret_cast<Debugger::ReadRegisterResponseT *>(u.value));
|
||||
break;
|
||||
}
|
||||
case Event_ApplicationExit: {
|
||||
value = new Debugger::ApplicationExitT(*reinterpret_cast<Debugger::ApplicationExitT *>(u.value));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -2009,6 +2136,11 @@ inline void EventUnion::Reset() {
|
||||
delete ptr;
|
||||
break;
|
||||
}
|
||||
case Event_ApplicationExit: {
|
||||
auto ptr = reinterpret_cast<Debugger::ApplicationExitT *>(value);
|
||||
delete ptr;
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
value = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user