Merge branch 'v8.2' of ssh://git.dyninst.org/pub/dyninst into v8.2
[dyninst.git] / proccontrol / h / Event.h
1 /*
2  * See the dyninst/COPYRIGHT file for copyright information.
3  * 
4  * We provide the Paradyn Tools (below described as "Paradyn")
5  * on an AS IS basis, and do not warrant its validity or performance.
6  * We reserve the right to update, modify, or discontinue this
7  * software at any time.  We shall have no obligation to supply such
8  * updates or modifications or any other form of support to you.
9  * 
10  * By your use of Paradyn, you understand and agree that we (or any
11  * other person or entity with proprietary rights in Paradyn) are
12  * under no obligation to provide either maintenance services,
13  * update services, notices of latent defects, or correction of
14  * defects for Paradyn.
15  * 
16  * This library is free software; you can redistribute it and/or
17  * modify it under the terms of the GNU Lesser General Public
18  * License as published by the Free Software Foundation; either
19  * version 2.1 of the License, or (at your option) any later version.
20  * 
21  * This library is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
24  * Lesser General Public License for more details.
25  * 
26  * You should have received a copy of the GNU Lesser General Public
27  * License along with this library; if not, write to the Free Software
28  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
29  */
30 #if !defined(EVENT_H_)
31 #define EVENT_H_
32
33 #include <string>
34 #include <set>
35 #include "dyntypes.h"
36 #include "MachSyscall.h"
37 #include "EventType.h"
38 #include "PCProcess.h"
39 #include "util.h"
40
41 class HandlerPool;
42 class HandleCallbacks;
43
44 namespace Dyninst {
45 namespace ProcControlAPI {
46
47 class PC_EXPORT ArchEvent
48 {
49 private:
50    std::string name;
51 public:
52    ArchEvent(std::string name_ = std::string(""));
53    virtual ~ArchEvent();
54    std::string getName(); 
55 };
56
57 class Handler;
58 class EventTerminate;
59 class EventExit;
60 class EventCrash;
61 class EventForceTerminate;
62 class EventExec;
63 class EventBreakpoint;
64 class EventStop;
65 class EventNewThread;
66 class EventNewUserThread;
67 class EventNewLWP;
68 class EventThreadDestroy;
69 class EventUserThreadDestroy;
70 class EventLWPDestroy;
71 class EventFork;
72 class EventSignal;
73 class EventBootstrap;
74 class EventRPC;
75 class EventSingleStep;
76 class EventBreakpointClear;
77 class EventBreakpointRestore;
78 class EventLibrary;
79 class EventRPCLaunch;
80 class EventAsync;
81 class EventChangePCStop;
82 class EventPreBootstrap;
83 class EventDetach;
84 class EventIntBootstrap;
85 class EventNop;
86 class EventThreadDB;
87 class EventWinStopThreadDestroy;
88 class EventControlAuthority;
89 class EventAsyncIO;
90 class EventAsyncRead;
91 class EventAsyncWrite;
92 class EventAsyncReadAllRegs;
93 class EventAsyncSetAllRegs;
94 class EventAsyncFileRead;
95 class EventPostponedSyscall;
96 class EventSyscall;
97 class EventPreSyscall;
98 class EventPostSyscall;
99
100 class PC_EXPORT Event : public boost::enable_shared_from_this<Event>
101 {
102    friend void boost::checked_delete<Event>(Event *);
103    friend void boost::checked_delete<const Event>(const Event *);
104    friend class ::HandlerPool;
105    friend class ::int_process;
106    friend class ::HandleCallbacks;
107  public:
108    typedef boost::shared_ptr<Event> ptr;
109    typedef boost::shared_ptr<const Event> const_ptr;
110    typedef boost::weak_ptr<Event> weak_ptr;
111
112    Event(EventType etype_, Thread::ptr thread_ = Thread::ptr());
113    virtual ~Event();
114
115    typedef enum {
116       unset,
117       async,
118       sync_thread,
119       sync_process
120    } SyncType;
121
122    EventType getEventType() const;
123    Thread::const_ptr getThread() const;
124    Process::const_ptr getProcess() const;
125    SyncType getSyncType() const;
126    std::string name() const;
127
128    void setThread(Thread::const_ptr t);
129    void setProcess(Process::const_ptr p);
130    void setSyncType(SyncType t);
131    void setSuppressCB(bool b);
132
133    virtual bool suppressCB() const;
134    virtual bool triggersCB() const;
135    virtual bool canFastHandle() const;
136    virtual bool userEvent() const;
137    virtual void setUserEvent(bool b);
138    virtual bool procStopper() const;
139
140    Event::weak_ptr subservientTo() const;
141    void addSubservientEvent(Event::ptr ev);
142
143    boost::shared_ptr<EventTerminate> getEventTerminate();
144    boost::shared_ptr<const EventTerminate> getEventTerminate() const;
145
146    boost::shared_ptr<EventExit> getEventExit();
147    boost::shared_ptr<const EventExit> getEventExit() const;
148
149    boost::shared_ptr<EventCrash> getEventCrash();
150    boost::shared_ptr<const EventCrash> getEventCrash() const;
151
152    boost::shared_ptr<EventForceTerminate> getEventForceTerminate();
153    boost::shared_ptr<const EventForceTerminate> getEventForceTerminate() const;
154
155    boost::shared_ptr<EventExec> getEventExec();
156    boost::shared_ptr<const EventExec> getEventExec() const;
157
158    boost::shared_ptr<EventStop> getEventStop();
159    boost::shared_ptr<const EventStop> getEventStop() const;
160
161    boost::shared_ptr<EventBreakpoint> getEventBreakpoint();
162    boost::shared_ptr<const EventBreakpoint> getEventBreakpoint() const;
163
164    boost::shared_ptr<EventNewThread> getEventNewThread();
165    boost::shared_ptr<const EventNewThread> getEventNewThread() const;
166
167    boost::shared_ptr<EventNewUserThread> getEventNewUserThread();
168    boost::shared_ptr<const EventNewUserThread> getEventNewUserThread() const;
169
170    boost::shared_ptr<EventNewLWP> getEventNewLWP();
171    boost::shared_ptr<const EventNewLWP> getEventNewLWP() const;
172
173    boost::shared_ptr<EventThreadDestroy> getEventThreadDestroy();
174    boost::shared_ptr<const EventThreadDestroy> getEventThreadDestroy() const;
175
176    boost::shared_ptr<EventUserThreadDestroy> getEventUserThreadDestroy();
177    boost::shared_ptr<const EventUserThreadDestroy> getEventUserThreadDestroy() const;
178
179    boost::shared_ptr<EventLWPDestroy> getEventLWPDestroy();
180    boost::shared_ptr<const EventLWPDestroy> getEventLWPDestroy() const;
181
182    boost::shared_ptr<EventFork> getEventFork();
183    boost::shared_ptr<const EventFork> getEventFork() const;
184
185    boost::shared_ptr<EventSignal> getEventSignal();
186    boost::shared_ptr<const EventSignal> getEventSignal() const;
187
188    boost::shared_ptr<EventBootstrap> getEventBootstrap();
189    boost::shared_ptr<const EventBootstrap> getEventBootstrap() const;
190
191    boost::shared_ptr<EventPreBootstrap> getEventPreBootstrap();
192    boost::shared_ptr<const EventPreBootstrap> getEventPreBootstrap() const;
193
194    boost::shared_ptr<EventRPC> getEventRPC();
195    boost::shared_ptr<const EventRPC> getEventRPC() const;
196
197    boost::shared_ptr<EventRPCLaunch> getEventRPCLaunch();
198    boost::shared_ptr<const EventRPCLaunch> getEventRPCLaunch() const;
199
200    boost::shared_ptr<EventSingleStep> getEventSingleStep();
201    boost::shared_ptr<const EventSingleStep> getEventSingleStep() const;
202
203    boost::shared_ptr<EventBreakpointClear> getEventBreakpointClear();
204    boost::shared_ptr<const EventBreakpointClear> getEventBreakpointClear() const;
205
206    boost::shared_ptr<EventBreakpointRestore> getEventBreakpointRestore();
207    boost::shared_ptr<const EventBreakpointRestore> getEventBreakpointRestore() const;
208
209    boost::shared_ptr<EventLibrary> getEventLibrary();
210    boost::shared_ptr<const EventLibrary> getEventLibrary() const;
211
212    boost::shared_ptr<EventAsync> getEventAsync();
213    boost::shared_ptr<const EventAsync> getEventAsync() const;
214
215    boost::shared_ptr<EventChangePCStop> getEventChangePCStop();
216    boost::shared_ptr<const EventChangePCStop> getEventChangePCStop() const;
217
218    boost::shared_ptr<EventDetach> getEventDetach();
219    boost::shared_ptr<const EventDetach> getEventDetach() const;
220
221    boost::shared_ptr<EventIntBootstrap> getEventIntBootstrap();
222    boost::shared_ptr<const EventIntBootstrap> getEventIntBootstrap() const;
223
224    boost::shared_ptr<EventNop> getEventNop();
225    boost::shared_ptr<const EventNop> getEventNop() const;
226
227    boost::shared_ptr<EventThreadDB> getEventThreadDB();
228    boost::shared_ptr<const EventThreadDB> getEventThreadDB() const;
229
230    boost::shared_ptr<EventWinStopThreadDestroy> getEventWinStopThreadDestroy();
231    boost::shared_ptr<const EventWinStopThreadDestroy> getEventWinStopThreadDestroy() const;
232
233    boost::shared_ptr<EventControlAuthority> getEventControlAuthority();
234    boost::shared_ptr<const EventControlAuthority> getEventControlAuthority() const;
235
236    boost::shared_ptr<EventAsyncIO> getEventAsyncIO();
237    boost::shared_ptr<const EventAsyncIO> getEventAsyncIO() const;
238
239    boost::shared_ptr<EventAsyncRead> getEventAsyncRead();
240    boost::shared_ptr<const EventAsyncRead> getEventAsyncRead() const;
241
242    boost::shared_ptr<EventAsyncWrite> getEventAsyncWrite();
243    boost::shared_ptr<const EventAsyncWrite> getEventAsyncWrite() const;
244
245    boost::shared_ptr<EventAsyncReadAllRegs> getEventAsyncReadAllRegs();
246    boost::shared_ptr<const EventAsyncReadAllRegs> getEventAsyncReadAllRegs() const;
247
248    boost::shared_ptr<EventAsyncSetAllRegs> getEventAsyncSetAllRegs();
249    boost::shared_ptr<const EventAsyncSetAllRegs> getEventAsyncSetAllRegs() const;
250
251    boost::shared_ptr<EventAsyncFileRead> getEventAsyncFileRead();
252    boost::shared_ptr<const EventAsyncFileRead> getEventAsyncFileRead() const;
253
254    boost::shared_ptr<EventPostponedSyscall> getEventPostponedSyscall();
255    boost::shared_ptr<const EventPostponedSyscall> getEventPostponedSyscall() const;
256
257    boost::shared_ptr<EventSyscall> getEventSyscall();
258    boost::shared_ptr<const EventSyscall> getEventSyscall() const;
259    
260    boost::shared_ptr<EventPreSyscall> getEventPreSyscall();
261    boost::shared_ptr<const EventPreSyscall> getEventPreSyscall() const;
262    
263    boost::shared_ptr<EventPostSyscall> getEventPostSyscall();
264    boost::shared_ptr<const EventPostSyscall> getEventPostSyscall() const;
265
266
267    //Not meant for public consumption
268    void setLastError(err_t ec, const char *es);
269  protected:
270    EventType etype;
271    Thread::const_ptr thread;
272    Process::const_ptr proc;
273    SyncType stype;
274    std::vector<Event::ptr> subservient_events;
275    Event::weak_ptr master_event;
276    std::set<Handler *> handled_by;
277    bool suppress_cb;
278    bool user_event;
279    bool handling_started;
280    bool noted_event;
281 };
282
283 template<typename OS>
284 OS& operator<<(OS& str, Event& e)
285 {
286         str << e.getEventType().name() << " event is ";
287         switch(e.getSyncType())
288         {
289         case Event::async:
290                 str << "asynchronous ";
291                 break;
292         case Event::sync_thread:
293                 str << "thread synchronous ";
294                 break;
295         case Event::sync_process:
296                 str << "process synchronous ";
297                 break;
298         default:
299                 str << "<UNKNOWN SYNC TYPE> ";
300                 break;
301         }
302         str << "on " << (e.getProcess() ? e.getProcess()->getPid() : -1);
303         str << "/" << ((e.getThread()) ?  e.getThread()->getLWP() : (Dyninst::LWP) -1);
304         str << "\n";
305         return str;
306 }
307
308 class PC_EXPORT EventTerminate : public Event
309 {
310    friend void boost::checked_delete<EventTerminate>(EventTerminate *);
311    friend void boost::checked_delete<const EventTerminate>(const EventTerminate *);
312  public:
313    typedef boost::shared_ptr<EventTerminate> ptr;
314    typedef boost::shared_ptr<const EventTerminate> const_ptr;
315    EventTerminate(EventType type_);
316    virtual ~EventTerminate();
317 };
318
319 class PC_EXPORT EventExit : public EventTerminate
320 {
321    friend void boost::checked_delete<EventExit>(EventExit *);
322    friend void boost::checked_delete<const EventExit>(const EventExit *);
323  private:
324    int exitcode;
325  public:
326    typedef boost::shared_ptr<EventExit> ptr;
327    typedef boost::shared_ptr<const EventExit> const_ptr;
328    int getExitCode() const;
329    EventExit(EventType::Time eventtime, int exitcode_);
330    virtual ~EventExit();
331 };
332
333 class PC_EXPORT EventCrash : public EventTerminate
334 {
335    friend void boost::checked_delete<EventCrash>(EventCrash *);
336    friend void boost::checked_delete<const EventCrash>(const EventCrash *);
337  private:
338    int termsig;
339  public:
340    typedef boost::shared_ptr<EventCrash> ptr;
341    typedef boost::shared_ptr<const EventCrash> const_ptr;
342    int getTermSignal() const;
343    EventCrash(int termsig);
344    virtual ~EventCrash();
345 };
346
347 class PC_EXPORT EventForceTerminate : public EventTerminate
348 {
349    friend void boost::checked_delete<EventForceTerminate>(EventForceTerminate *);
350    friend void boost::checked_delete<const EventForceTerminate>(const EventForceTerminate *);
351  private:
352    int termsig;
353  public:
354    typedef boost::shared_ptr<EventForceTerminate> ptr;
355    typedef boost::shared_ptr<const EventForceTerminate> const_ptr;
356    int getTermSignal() const;
357    EventForceTerminate(int termsig);
358    virtual ~EventForceTerminate();
359 };
360
361 class PC_EXPORT EventExec : public Event
362 {
363    friend void boost::checked_delete<EventExec>(EventExec *);
364    friend void boost::checked_delete<const EventExec>(const EventExec *);
365  private:
366    std::string execpath;
367  public:
368    typedef boost::shared_ptr<EventExec> ptr;
369    typedef boost::shared_ptr<const EventExec> const_ptr;
370    EventExec(EventType::Time etime_, std::string path = std::string(""));
371    virtual ~EventExec();
372
373    std::string getExecPath() const;
374    void setExecPath(std::string path_);
375 };
376
377 class PC_EXPORT EventStop : public Event
378 {
379    friend void boost::checked_delete<EventStop>(EventStop *);
380    friend void boost::checked_delete<const EventStop>(const EventStop *);
381  public:
382    typedef boost::shared_ptr<EventStop> ptr;
383    typedef boost::shared_ptr<const EventStop> const_ptr;
384    EventStop();
385    virtual ~EventStop();
386 };
387
388 class PC_EXPORT EventNewThread : public Event
389 {
390    friend void boost::checked_delete<EventNewThread>(EventNewThread *);
391    friend void boost::checked_delete<const EventNewThread>(const EventNewThread *);
392  public:
393    typedef boost::shared_ptr<EventNewThread> ptr;
394    typedef boost::shared_ptr<const EventNewThread> const_ptr;
395    EventNewThread(EventType et);
396    virtual ~EventNewThread();
397
398    virtual Dyninst::LWP getLWP() const = 0;
399    virtual Thread::const_ptr getNewThread() const = 0;
400 };
401
402 class int_eventNewUserThread;
403 class PC_EXPORT EventNewUserThread : public EventNewThread
404 {
405    friend void boost::checked_delete<EventNewUserThread>(EventNewUserThread *);
406    friend void boost::checked_delete<const EventNewUserThread>(const EventNewUserThread *);
407   private:
408    int_eventNewUserThread *iev;
409   public:
410    typedef boost::shared_ptr<EventNewUserThread> ptr;
411    typedef boost::shared_ptr<const EventNewUserThread> const_ptr;   
412
413    EventNewUserThread();
414    virtual ~EventNewUserThread();
415    int_eventNewUserThread *getInternalEvent() const;
416
417    virtual Dyninst::LWP getLWP() const;
418    virtual Thread::const_ptr getNewThread() const;
419 };
420
421 class int_eventNewLWP;
422 class PC_EXPORT EventNewLWP : public EventNewThread
423 {
424    friend void boost::checked_delete<EventNewLWP>(EventNewLWP *);
425    friend void boost::checked_delete<const EventNewLWP>(const EventNewLWP *);
426   private:
427    int_eventNewLWP *iev;
428    Dyninst::LWP lwp;
429   public:
430    int_eventNewLWP *getInternalEvent();
431    typedef boost::shared_ptr<EventNewLWP> ptr;
432    typedef boost::shared_ptr<const EventNewLWP> const_ptr;   
433    EventNewLWP(Dyninst::LWP lwp_, int status = 0);
434    virtual ~EventNewLWP();
435
436    virtual Dyninst::LWP getLWP() const;
437    virtual Thread::const_ptr getNewThread() const;
438 };
439
440 class PC_EXPORT EventThreadDestroy : public Event
441 {
442    friend void boost::checked_delete<EventThreadDestroy>(EventThreadDestroy *);
443    friend void boost::checked_delete<const EventThreadDestroy>(const EventThreadDestroy *);
444  public:
445    typedef boost::shared_ptr<EventThreadDestroy> ptr;
446    typedef boost::shared_ptr<const EventThreadDestroy> const_ptr;
447    EventThreadDestroy(EventType et);
448    virtual ~EventThreadDestroy() = 0;
449 };
450
451 class PC_EXPORT EventUserThreadDestroy : public EventThreadDestroy
452 {
453    friend void boost::checked_delete<EventUserThreadDestroy>(EventUserThreadDestroy *);
454    friend void boost::checked_delete<const EventUserThreadDestroy>(const EventUserThreadDestroy *);
455  public:
456    typedef boost::shared_ptr<EventUserThreadDestroy> ptr;
457    typedef boost::shared_ptr<const EventUserThreadDestroy> const_ptr;
458    EventUserThreadDestroy(EventType::Time time_);
459    virtual ~EventUserThreadDestroy();
460 };
461
462 class PC_EXPORT EventLWPDestroy : public EventThreadDestroy
463 {
464    friend void boost::checked_delete<EventLWPDestroy>(EventLWPDestroy *);
465    friend void boost::checked_delete<const EventLWPDestroy>(const EventLWPDestroy *);
466  public:
467    typedef boost::shared_ptr<EventLWPDestroy> ptr;
468    typedef boost::shared_ptr<const EventLWPDestroy> const_ptr;
469    EventLWPDestroy(EventType::Time time_);
470    virtual ~EventLWPDestroy();
471 };
472
473 class PC_EXPORT EventFork : public Event
474 {
475    friend void boost::checked_delete<EventFork>(EventFork *);
476    friend void boost::checked_delete<const EventFork>(const EventFork *);
477   private:
478    Dyninst::PID pid;
479   public:
480    typedef boost::shared_ptr<EventFork> ptr;
481    typedef boost::shared_ptr<const EventFork> const_ptr;
482    EventFork(EventType::Time time_, Dyninst::PID pid_);
483    virtual ~EventFork();
484    Dyninst::PID getPID() const;
485    Process::const_ptr getChildProcess() const;
486 };
487
488 class PC_EXPORT EventSignal : public Event
489 {
490    friend void boost::checked_delete<EventSignal>(EventSignal *);
491    friend void boost::checked_delete<const EventSignal>(const EventSignal *);
492  private:
493    int sig;
494  public:
495    typedef boost::shared_ptr<EventSignal> ptr;
496    typedef boost::shared_ptr<const EventSignal> const_ptr;
497    EventSignal(int sig);
498    virtual ~EventSignal();
499
500    int getSignal() const;
501    void setThreadSignal(int newSignal) const;
502    void clearThreadSignal() const;
503 };
504
505 class PC_EXPORT EventBootstrap : public Event
506 {
507    friend void boost::checked_delete<EventBootstrap>(EventBootstrap *);
508    friend void boost::checked_delete<const EventBootstrap>(const EventBootstrap *);
509  public:
510    typedef boost::shared_ptr<EventBootstrap> ptr;
511    typedef boost::shared_ptr<const EventBootstrap> const_ptr;
512    EventBootstrap();
513    virtual ~EventBootstrap();
514 };
515
516 class PC_EXPORT EventPreBootstrap : public Event
517 {
518    friend void boost::checked_delete<EventPreBootstrap>(EventPreBootstrap *);
519    friend void boost::checked_delete<const EventPreBootstrap>(const EventPreBootstrap *);
520  public:
521    typedef boost::shared_ptr<EventPreBootstrap> ptr;
522    typedef boost::shared_ptr<const EventPreBootstrap> const_ptr;
523    EventPreBootstrap();
524    virtual ~EventPreBootstrap();
525 };
526
527
528 class int_eventRPC;
529 class PC_EXPORT EventRPC : public Event
530 {
531    friend void boost::checked_delete<EventRPC>(EventRPC *);
532    friend void boost::checked_delete<const EventRPC>(const EventRPC *);
533  private:
534    int_eventRPC *int_rpc;
535    rpc_wrapper *wrapper;
536  public:
537    virtual bool suppressCB() const;
538    rpc_wrapper *getllRPC();
539    typedef boost::shared_ptr<EventRPC> ptr;
540    typedef boost::shared_ptr<const EventRPC> const_ptr;
541    EventRPC(rpc_wrapper *wrapper_);
542    virtual ~EventRPC();
543
544    IRPC::const_ptr getIRPC() const;
545    int_eventRPC *getInternal() const;
546 };
547
548 class PC_EXPORT EventRPCLaunch : public Event
549 {
550    friend void boost::checked_delete<EventRPCLaunch>(EventRPCLaunch *);
551    friend void boost::checked_delete<const EventRPCLaunch>(const EventRPCLaunch *);
552  public:
553    typedef boost::shared_ptr<EventRPCLaunch> ptr;
554    typedef boost::shared_ptr<const EventRPCLaunch> const_ptr;
555    virtual bool procStopper() const;
556    EventRPCLaunch();
557    virtual ~EventRPCLaunch();
558 };
559
560 class PC_EXPORT EventSingleStep : public Event
561 {
562    friend void boost::checked_delete<EventSingleStep>(EventSingleStep *);
563    friend void boost::checked_delete<const EventSingleStep>(const EventSingleStep *);
564  public:
565    typedef boost::shared_ptr<EventSingleStep> ptr;
566    typedef boost::shared_ptr<const EventSingleStep> const_ptr;
567    EventSingleStep();
568    virtual ~EventSingleStep();
569 };
570
571 class PC_EXPORT EventSyscall : public Event
572 {
573    friend void boost::checked_delete<EventSyscall>(EventSyscall *);
574    friend void boost::checked_delete<const EventSyscall>(const EventSyscall *);
575
576    friend MachSyscall makeFromEvent(const EventSyscall *);
577
578  public:
579    typedef boost::shared_ptr<EventSyscall> ptr;
580    typedef boost::shared_ptr<const EventSyscall> const_ptr;
581    EventSyscall(EventType type_);
582    virtual ~EventSyscall();
583
584    Dyninst::Address getAddress() const;
585    MachSyscall getSyscall() const;
586    
587  private:
588     long getSyscallNumber() const;
589 };
590
591 class PC_EXPORT EventPreSyscall : public EventSyscall
592 {
593    friend void boost::checked_delete<EventPreSyscall>(EventPreSyscall *);
594    friend void boost::checked_delete<const EventPreSyscall>(const EventPreSyscall *);
595
596    friend MachSyscall makeFromEvent(const EventPreSyscall *);
597
598  public:
599    typedef boost::shared_ptr<EventPreSyscall> ptr;
600    typedef boost::shared_ptr<const EventPreSyscall> const_ptr;
601    EventPreSyscall();
602    virtual ~EventPreSyscall();
603 };
604
605 class PC_EXPORT EventPostSyscall : public EventSyscall
606 {
607    friend void boost::checked_delete<EventPostSyscall>(EventPostSyscall *);
608    friend void boost::checked_delete<const EventPostSyscall>(const EventPostSyscall *);
609
610    friend MachSyscall makeFromEvent(const EventPostSyscall *);
611
612  public:
613    typedef boost::shared_ptr<EventPostSyscall> ptr;
614    typedef boost::shared_ptr<const EventPostSyscall> const_ptr;
615    EventPostSyscall();
616    virtual ~EventPostSyscall();
617
618    long getReturnValue() const;
619 };
620
621 class int_eventBreakpoint;
622 class PC_EXPORT EventBreakpoint : public Event
623 {
624    friend void boost::checked_delete<EventBreakpoint>(EventBreakpoint *);
625    friend void boost::checked_delete<const EventBreakpoint>(const EventBreakpoint *);
626  private:
627    int_eventBreakpoint *int_bp;
628  public:
629    typedef boost::shared_ptr<EventBreakpoint> ptr;
630    typedef boost::shared_ptr<const EventBreakpoint> const_ptr;
631    int_eventBreakpoint *getInternal() const;
632
633    EventBreakpoint(int_eventBreakpoint *ibp);
634    virtual ~EventBreakpoint();
635
636    Dyninst::Address getAddress() const;
637    void getBreakpoints(std::vector<Breakpoint::const_ptr> &bps) const;
638    void getBreakpoints(std::vector<Breakpoint::ptr> &bps);
639    virtual bool suppressCB() const;
640    virtual bool procStopper() const;
641 };
642
643
644 class int_eventBreakpointClear;
645 class PC_EXPORT EventBreakpointClear : public Event
646 {
647    friend void boost::checked_delete<EventBreakpointClear>(EventBreakpointClear *);
648    friend void boost::checked_delete<const EventBreakpointClear>(const EventBreakpointClear *);
649   private:
650    int_eventBreakpointClear *int_bpc;
651   public:
652    typedef boost::shared_ptr<EventBreakpointClear> ptr;
653    typedef boost::shared_ptr<const EventBreakpointClear> const_ptr;
654    EventBreakpointClear();
655    virtual ~EventBreakpointClear();
656    
657    int_eventBreakpointClear *getInternal() const;
658    virtual bool procStopper() const;
659 };
660
661 class int_eventBreakpointRestore;
662 class EventBreakpointRestore : public Event
663 {
664    friend void boost::checked_delete<EventBreakpointRestore>(EventBreakpointRestore *);
665    friend void boost::checked_delete<const EventBreakpointRestore>(const EventBreakpointRestore *);
666   private:
667    int_eventBreakpointRestore *int_bpr;
668   public:
669    typedef boost::shared_ptr<EventBreakpointRestore> ptr;
670    typedef boost::shared_ptr<const EventBreakpointRestore> const_ptr;
671
672    EventBreakpointRestore(int_eventBreakpointRestore *iebpr);
673    virtual ~EventBreakpointRestore();
674
675    int_eventBreakpointRestore *getInternal() const;
676 };
677
678 class PC_EXPORT EventLibrary : public Event
679 {
680    friend void boost::checked_delete<EventLibrary>(EventLibrary *);
681    friend void boost::checked_delete<const EventLibrary>(const EventLibrary *);
682  private:
683    std::set<Library::ptr> added_libs;
684    std::set<Library::ptr> rmd_libs;
685  public:
686    typedef boost::shared_ptr<EventLibrary> ptr;
687    typedef boost::shared_ptr<const EventLibrary> const_ptr;
688    EventLibrary();
689    EventLibrary(const std::set<Library::ptr> &added_libs_,
690                 const std::set<Library::ptr> &rmd_libs_);
691    virtual ~EventLibrary();
692
693    void setLibs(const std::set<Library::ptr> &added_libs_,
694                 const std::set<Library::ptr> &rmd_libs_);
695    const std::set<Library::ptr> &libsAdded() const;
696    const std::set<Library::ptr> &libsRemoved() const;
697 };
698
699 class int_eventAsync;
700 class PC_EXPORT EventAsync : public Event
701 {
702    friend void boost::checked_delete<EventAsync>(EventAsync *);
703    friend void boost::checked_delete<const EventAsync>(const EventAsync *);
704    
705   private:
706    int_eventAsync *internal;
707   public:
708    typedef boost::shared_ptr<EventAsync> ptr;
709    typedef boost::shared_ptr<const EventAsync> const_ptr;
710
711    EventAsync(int_eventAsync *ievent);
712    virtual ~EventAsync();
713    int_eventAsync *getInternal() const;
714 };
715
716 class PC_EXPORT EventChangePCStop : public Event
717 {
718    friend void boost::checked_delete<EventChangePCStop>(EventChangePCStop *);
719    friend void boost::checked_delete<const EventChangePCStop>(const EventChangePCStop *);
720  public:
721    typedef boost::shared_ptr<EventChangePCStop> ptr;
722    typedef boost::shared_ptr<const EventChangePCStop> const_ptr;
723    EventChangePCStop();
724    virtual ~EventChangePCStop();
725 };
726
727 class int_eventDetach;
728 class PC_EXPORT EventDetach : public Event
729 {
730    friend void boost::checked_delete<EventDetach>(EventDetach *);
731    friend void boost::checked_delete<const EventDetach>(const EventDetach *);
732    int_eventDetach *int_detach;
733  public:
734    typedef boost::shared_ptr<EventDetach> ptr;
735    typedef boost::shared_ptr<const EventDetach> const_ptr;
736
737    EventDetach();
738    virtual ~EventDetach();
739    int_eventDetach *getInternal() const;
740    virtual bool procStopper() const;
741 };
742
743 class PC_EXPORT EventIntBootstrap : public Event
744 {
745    friend void boost::checked_delete<EventIntBootstrap>(EventIntBootstrap *);
746    friend void boost::checked_delete<const EventIntBootstrap>(const EventIntBootstrap *);
747    
748    void *data;
749  public:
750    typedef boost::shared_ptr<EventIntBootstrap> ptr;
751    typedef boost::shared_ptr<const EventIntBootstrap> const_ptr;
752    EventIntBootstrap(void *d = NULL);
753    virtual ~EventIntBootstrap();
754
755    void *getData() const;
756    void setData(void *v);
757 };
758
759 class PC_EXPORT EventNop : public Event
760 {
761    friend void boost::checked_delete<EventNop>(EventNop *);
762    friend void boost::checked_delete<const EventNop>(const EventNop *);
763  public:
764    typedef boost::shared_ptr<EventNop> ptr;
765    typedef boost::shared_ptr<const EventNop> const_ptr;
766    EventNop();
767    virtual ~EventNop();
768 };
769
770 class int_eventThreadDB;
771 class PC_EXPORT EventThreadDB : public Event
772 {
773    friend void boost::checked_delete<EventThreadDB>(EventThreadDB *);
774    friend void boost::checked_delete<const EventThreadDB>(const EventThreadDB *);
775    int_eventThreadDB *int_etdb;
776   public:
777    typedef boost::shared_ptr<EventThreadDB> ptr;
778    typedef boost::shared_ptr<const EventThreadDB> const_ptr;
779    int_eventThreadDB *getInternal() const;
780
781    EventThreadDB();
782    virtual ~EventThreadDB();
783
784    virtual bool triggersCB() const;
785 };
786
787 class PC_EXPORT EventWinStopThreadDestroy : public EventThreadDestroy
788 {
789    friend void boost::checked_delete<EventWinStopThreadDestroy>(EventWinStopThreadDestroy *);
790    friend void boost::checked_delete<const EventWinStopThreadDestroy>(const EventWinStopThreadDestroy *);
791  public:
792    typedef boost::shared_ptr<EventWinStopThreadDestroy> ptr;
793    typedef boost::shared_ptr<const EventWinStopThreadDestroy> const_ptr;
794    EventWinStopThreadDestroy(EventType::Time time_);
795    virtual ~EventWinStopThreadDestroy();
796 };
797
798 class int_eventControlAuthority;
799 class PC_EXPORT EventControlAuthority : public Event
800 {
801    friend void boost::checked_delete<EventControlAuthority>(EventControlAuthority *);
802    friend void boost::checked_delete<const EventControlAuthority>(const EventControlAuthority *);
803    int_eventControlAuthority *iev;
804   public:
805    typedef boost::shared_ptr<EventControlAuthority> ptr;
806    typedef boost::shared_ptr<const EventControlAuthority> const_ptr;
807    int_eventControlAuthority *getInternalEvent() const;
808
809    EventControlAuthority(EventType::Time t, int_eventControlAuthority *iev_);
810    virtual ~EventControlAuthority();
811    virtual bool procStopper() const;
812
813    std::string otherToolName() const;
814    unsigned int otherToolID() const;
815    int otherToolPriority() const;
816    
817    typedef enum {
818       ControlUnset,
819       ControlLost,
820       ControlGained,
821       ControlNoChange
822    } Trigger;
823    Trigger eventTrigger() const;
824 };
825
826 class int_eventAsyncIO;
827 class PC_EXPORT EventAsyncIO : public Event {
828    friend void boost::checked_delete<EventAsyncIO>(EventAsyncIO *);
829    friend void boost::checked_delete<const EventAsyncIO>(const EventAsyncIO *);
830   protected:
831    int_eventAsyncIO *iev;
832   public:
833    typedef boost::shared_ptr<EventAsyncIO> ptr;
834    typedef boost::shared_ptr<const EventAsyncIO> const_ptr;
835    int_eventAsyncIO *getInternalEvent() const;
836
837    EventAsyncIO(EventType et, int_eventAsyncIO *iev_);
838    ~EventAsyncIO();
839
840    bool hadError() const;
841    void *getOpaqueVal() const;
842 };
843
844 class PC_EXPORT EventAsyncRead : public EventAsyncIO {
845    friend void boost::checked_delete<EventAsyncRead>(EventAsyncRead *);
846    friend void boost::checked_delete<const EventAsyncRead>(const EventAsyncRead *);
847   public:
848    typedef boost::shared_ptr<EventAsyncRead> ptr;
849    typedef boost::shared_ptr<const EventAsyncRead> const_ptr;
850    
851    EventAsyncRead(int_eventAsyncIO *iev_);
852    ~EventAsyncRead();
853
854    void *getMemory() const;
855    size_t getSize() const;
856    Dyninst::Address getAddress() const;
857 };
858
859 class PC_EXPORT EventAsyncWrite : public EventAsyncIO {
860    friend void boost::checked_delete<EventAsyncWrite>(EventAsyncWrite *);
861    friend void boost::checked_delete<const EventAsyncWrite>(const EventAsyncWrite *);
862   public:
863    typedef boost::shared_ptr<EventAsyncWrite> ptr;
864    typedef boost::shared_ptr<const EventAsyncWrite> const_ptr;
865    
866    EventAsyncWrite(int_eventAsyncIO *iev_);
867    ~EventAsyncWrite();
868
869    size_t getSize() const;
870    Dyninst::Address getAddress() const;
871 };
872
873 class PC_EXPORT EventAsyncReadAllRegs : public EventAsyncIO {
874    friend void boost::checked_delete<EventAsyncReadAllRegs>(EventAsyncReadAllRegs *);
875    friend void boost::checked_delete<const EventAsyncReadAllRegs>(const EventAsyncReadAllRegs *);
876   public:
877    typedef boost::shared_ptr<EventAsyncReadAllRegs> ptr;
878    typedef boost::shared_ptr<const EventAsyncReadAllRegs> const_ptr;
879    
880    EventAsyncReadAllRegs(int_eventAsyncIO *iev_);
881    ~EventAsyncReadAllRegs();
882
883    const RegisterPool &getRegisters() const;
884 };
885
886 class PC_EXPORT EventAsyncSetAllRegs : public EventAsyncIO {
887    friend void boost::checked_delete<EventAsyncSetAllRegs>(EventAsyncSetAllRegs *);
888    friend void boost::checked_delete<const EventAsyncSetAllRegs>(const EventAsyncSetAllRegs *);
889   public:
890    typedef boost::shared_ptr<EventAsyncSetAllRegs> ptr;
891    typedef boost::shared_ptr<const EventAsyncSetAllRegs> const_ptr;
892    
893    EventAsyncSetAllRegs(int_eventAsyncIO *iev_);
894    ~EventAsyncSetAllRegs();
895 };
896
897 class int_eventAsyncFileRead;
898 class PC_EXPORT EventAsyncFileRead : public Event {
899    friend void boost::checked_delete<EventAsyncFileRead>(EventAsyncFileRead *);
900    friend void boost::checked_delete<const EventAsyncFileRead>(const EventAsyncFileRead *);
901    int_eventAsyncFileRead *iev;
902   public:
903    typedef boost::shared_ptr<EventAsyncFileRead> ptr;
904    typedef boost::shared_ptr<const EventAsyncFileRead> const_ptr;
905    int_eventAsyncFileRead *getInternal();
906    
907    EventAsyncFileRead(int_eventAsyncFileRead *iev_);
908    ~EventAsyncFileRead();
909    
910    std::string getFilename() const;
911    size_t getReadSize() const;
912    Dyninst::Offset getReadOffset() const;
913
914    void *getBuffer() const;
915    size_t getBufferSize() const;
916
917    bool isEOF() const;
918    int errorCode() const;
919 };
920
921 class EventPostponedSyscall : public Event
922 {
923    friend void boost::checked_delete<EventPostponedSyscall>(EventPostponedSyscall *);
924    friend void boost::checked_delete<const EventPostponedSyscall>(const EventPostponedSyscall *);
925   public:
926    typedef boost::shared_ptr<EventPostponedSyscall> ptr;
927    typedef boost::shared_ptr<const EventPostponedSyscall> const_ptr;
928
929    EventPostponedSyscall();
930    virtual ~EventPostponedSyscall();
931 };
932
933 }
934 }
935
936 #endif