10Sduke/* 22001Sdfazunen * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. 30Sduke * Copyright 2013, Rene Gollent, rene@gollent.com. 40Sduke * Distributed under the terms of the MIT License. 50Sduke */ 60Sduke#ifndef DEBUG_EVENT_H 7180Sohair#define DEBUG_EVENT_H 80Sduke 9180Sohair#include <debugger.h> 100Sduke 110Sduke#include "ImageInfo.h" 120Sduke#include "SignalInfo.h" 130Sduke#include "SyscallInfo.h" 140Sduke#include "Types.h" 150Sduke 160Sduke 170Sdukeclass CpuState; 180Sduke 190Sduke 200Sduke// constants for synthetic events generated via the 21180Sohair// start_system_watching() interface 22180Sohairenum { 23180Sohair DEBUGGER_MESSAGE_THREAD_RENAMED = 'dmtr', 240Sduke DEBUGGER_MESSAGE_THREAD_PRIORITY_CHANGED = 'dmpc' 250Sduke}; 261084Smikael 271084Smikael 281084Smikaelclass DebugEvent { 291084Smikaelpublic: 300Sduke DebugEvent(int32 eventType, 311461Smikael team_id team, thread_id thread); 321461Smikael virtual ~DebugEvent(); 331345Sihse 341084Smikael int32 EventType() const { return fEventType; } 35922Serikj team_id Team() const { return fTeam; } 36206Sohair thread_id Thread() const { return fThread; } 371891Serikj 381877Smikael bool ThreadStopped() const { return fThreadStopped; } 39157Sohair void SetThreadStopped(bool stopped); 40206Sohair 41157Sohairprivate: 42157Sohair int32 fEventType; 431084Smikael team_id fTeam; 44921Serikj thread_id fThread; 451930Serikj bool fThreadStopped; 461930Serikj}; 471930Serikj 481084Smikael 491930Serikjclass CpuStateEvent : public DebugEvent { 501930Serikjpublic: 511930Serikj CpuStateEvent(debug_debugger_message eventType, 521930Serikj team_id team, thread_id thread, 531930Serikj CpuState* state); 541930Serikj virtual ~CpuStateEvent(); 551930Serikj 561930Serikj CpuState* GetCpuState() const { return fCpuState; } 571930Serikj 581930Serikjprivate: 591930Serikj CpuState* fCpuState; 601930Serikj}; 611930Serikj 621930Serikj 631930Serikjclass ThreadDebuggedEvent : public DebugEvent { 641930Serikjpublic: 651930Serikj ThreadDebuggedEvent(team_id team, 661930Serikj thread_id thread); 671930Serikj}; 681930Serikj 691930Serikj 701930Serikjclass DebuggerCallEvent : public DebugEvent { 711930Serikjpublic: 721930Serikj DebuggerCallEvent(team_id team, 731930Serikj thread_id thread, target_addr_t message); 741930Serikj 751891Serikj target_addr_t Message() const { return fMessage; } 761891Serikj 771468Smikaelprivate: 782129Slmesnik target_addr_t fMessage; 791468Smikael}; 801930Serikj 811930Serikj 821964Serikjclass BreakpointHitEvent : public CpuStateEvent { 831964Serikjpublic: 841964Serikj BreakpointHitEvent(team_id team, 851964Serikj thread_id thread, CpuState* state); 861964Serikj}; 871964Serikj 881930Serikj 891930Serikjclass WatchpointHitEvent : public CpuStateEvent { 901930Serikjpublic: 911930Serikj WatchpointHitEvent(team_id team, 921930Serikj thread_id thread, CpuState* state); 931930Serikj}; 941930Serikj 951930Serikj 961930Serikjclass SingleStepEvent : public CpuStateEvent { 971964Serikjpublic: 981964Serikj SingleStepEvent(team_id team, 991964Serikj thread_id thread, CpuState* state); 1001964Serikj}; 1011964Serikj 1021964Serikj 1031964Serikjclass ExceptionOccurredEvent : public DebugEvent { 1041964Serikjpublic: 1051964Serikj ExceptionOccurredEvent(team_id team, 1061930Serikj thread_id thread, 1071964Serikj debug_exception_type exception); 1081964Serikj 1091964Serikj debug_exception_type Exception() const { return fException; } 1101964Serikj 1111964Serikjprivate: 1121964Serikj debug_exception_type fException; 1131964Serikj}; 1141964Serikj 1151964Serikj 1161964Serikjclass TeamDeletedEvent : public DebugEvent { 1171964Serikjpublic: 1181964Serikj TeamDeletedEvent(team_id team, 1191964Serikj thread_id thread); 1201930Serikj}; 1211930Serikj 1221930Serikj 1231084Smikaelclass TeamExecEvent : public DebugEvent { 1241964Serikjpublic: 1251084Smikael TeamExecEvent(team_id team, thread_id thread); 126921Serikj}; 1271084Smikael 1281229Siignatyev 1291229Siignatyevclass ThreadCreatedEvent : public DebugEvent { 1301964Serikjpublic: 1311084Smikael ThreadCreatedEvent(team_id team, 1322024Serikj thread_id thread, thread_id newThread); 1332024Serikj 1341964Serikj thread_id NewThread() const { return fNewThread; } 1351930Serikj 1362024Serikjprivate: 1372024Serikj thread_id fNewThread; 1382024Serikj}; 1392024Serikj 1402024Serikj 1411930Serikjclass ThreadRenamedEvent : public DebugEvent { 1421229Siignatyevpublic: 1431964Serikj ThreadRenamedEvent(team_id team, 1441930Serikj thread_id thread, thread_id renamedThread, 1451930Serikj const char* name); 1461930Serikj 1471084Smikael thread_id RenamedThread() const { return fRenamedThread; } 1481832Scjplummer const char* NewName() const { return fName; } 1491832Scjplummer 1501832Scjplummerprivate: 1511832Scjplummer thread_id fRenamedThread; 1521964Serikj char fName[B_OS_NAME_LENGTH]; 1531964Serikj}; 1541832Scjplummer 1551832Scjplummer 1561832Scjplummerclass ThreadPriorityChangedEvent : public DebugEvent { 1571832Scjplummerpublic: 1581832Scjplummer ThreadPriorityChangedEvent(team_id team, 1591832Scjplummer thread_id thread, thread_id changedThread, 1601832Scjplummer int32 newPriority); 1611832Scjplummer 1621832Scjplummer thread_id ChangedThread() const { return fChangedThread; } 1631832Scjplummer int32 NewPriority() const { return fNewPriority; } 1641084Smikael 1651084Smikaelprivate: 1661084Smikael thread_id fChangedThread; 1671084Smikael int32 fNewPriority; 1681461Smikael}; 1691084Smikael 1701084Smikael 1711084Smikaelclass ThreadDeletedEvent : public DebugEvent { 1721084Smikaelpublic: 1731084Smikael ThreadDeletedEvent(team_id team, 1741084Smikael thread_id thread); 1751084Smikael}; 1761084Smikael 1771084Smikael 1781084Smikaelclass ImageCreatedEvent : public DebugEvent { 1791084Smikaelpublic: 1801084Smikael ImageCreatedEvent(team_id team, 1811084Smikael thread_id thread, const ImageInfo& info); 1821758Serikj 1831758Serikj const ImageInfo& GetImageInfo() const { return fInfo; } 1841930Serikj 1851340Sihseprivate: 1861340Sihse ImageInfo fInfo; 1871084Smikael}; 1881084Smikael 1891084Smikael 1901084Smikaelclass ImageDeletedEvent : public DebugEvent { 1911084Smikaelpublic: 1921084Smikael ImageDeletedEvent(team_id team, 1931084Smikael thread_id thread, const ImageInfo& info); 1941084Smikael 1951084Smikael const ImageInfo& GetImageInfo() const { return fInfo; } 1961084Smikael 1972083Serikjprivate: 1982083Serikj ImageInfo fInfo; 1992083Serikj}; 2002083Serikj 2012083Serikj 2022083Serikjclass PostSyscallEvent : public DebugEvent { 2032083Serikjpublic: 2042083Serikj PostSyscallEvent(team_id team, 2052083Serikj thread_id thread, 2061084Smikael const SyscallInfo& info); 2071084Smikael 2081084Smikael const SyscallInfo& GetSyscallInfo() const { return fInfo; } 2091084Smikael 2101084Smikaelprivate: 2112129Slmesnik SyscallInfo fInfo; 2121891Serikj}; 2131417Stbell 2142129Slmesnik 2151891Serikjclass HandedOverEvent : public DebugEvent { 2161084Smikaelpublic: 2171084Smikael HandedOverEvent(team_id team, 2181084Smikael thread_id thread, thread_id causingThread); 2191084Smikael 2201084Smikael thread_id CausingThread() const { return fCausingThread; } 2211084Smikael 2221084Smikaelprivate: 2231084Smikael thread_id fCausingThread; 2241084Smikael}; 2251084Smikael 2261084Smikael 2271084Smikaelclass SignalReceivedEvent : public DebugEvent { 2281236Sihsepublic: 2291084Smikael SignalReceivedEvent(team_id team, 2301084Smikael thread_id thread, 2311084Smikael const SignalInfo& info); 2321084Smikael 2331084Smikael const SignalInfo& GetSignalInfo() const { return fInfo; } 2341084Smikael 2351084Smikaelprivate: 2361084Smikael SignalInfo fInfo; 2371084Smikael}; 2381084Smikael 2391084Smikael 2401084Smikael#endif // DEBUG_EVENT_H 2411084Smikael