source: vendor/emx/current/src/pmgdb/pmdebug.cc

Last change on this file was 18, checked in by bird, 22 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 2.4 KB
Line 
1/* pmdebug.cc
2 Copyright (c) 1996 Eberhard Mattes
3
4This file is part of pmgdb.
5
6pmgdb is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2, or (at your option)
9any later version.
10
11pmgdb is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with pmgdb; see the file COPYING. If not, write to
18the Free Software Foundation, 59 Temple Place - Suite 330,
19Boston, MA 02111-1307, USA. */
20
21
22#define INCL_DOS
23#define INCL_WIN
24#include <os2.h>
25#include <stdlib.h>
26#include <string.h>
27#include "pmdebug.h"
28
29
30pmdebug pmdbg;
31
32
33static VOID APIENTRY pmdebug_exitlist (ULONG)
34{
35 pmdbg.exit ();
36 DosExitList (EXLST_EXIT, NULL);
37}
38
39
40pmdebug::pmdebug ()
41{
42 cur_mode = off; locked = false; pid = 0; hwndLock = NULLHANDLE;
43}
44
45
46pmdebug::~pmdebug ()
47{
48 exit ();
49}
50
51
52void pmdebug::exit ()
53{
54 if (cur_mode == sync && locked)
55 {
56 // TODO: Destroy all windows of the debuggee (pid)
57 // TODO: Kill debuggee (important!)
58 WinLockInput (NULLHANDLE, FALSE);
59 locked = false;
60 }
61 set_mode (off, NULLHANDLE);
62}
63
64
65void pmdebug::set_mode (mode new_mode, HWND hwnd, int in_pid)
66{
67 if (new_mode == cur_mode)
68 return;
69 if (cur_mode == sync && locked)
70 {
71 WinLockInput (NULLHANDLE, FALSE);
72 locked = false;
73 }
74 if (new_mode == sync)
75 DosExitList (EXLST_ADD | (0 << 8), pmdebug_exitlist);
76 else if (cur_mode == sync)
77 DosExitList (EXLST_REMOVE, pmdebug_exitlist);
78 cur_mode = new_mode;
79 pid = in_pid; hwndLock = hwnd;
80}
81
82
83void pmdebug::start ()
84{
85 switch (cur_mode)
86 {
87 case sync:
88 if (locked)
89 WinLockInput (NULLHANDLE, FALSE);
90 locked = false;
91 break;
92 default:
93 break;
94 }
95}
96
97
98void pmdebug::stop ()
99{
100 switch (cur_mode)
101 {
102 case sync:
103 if (!locked)
104 {
105 locked = true;
106 WinLockInput (NULLHANDLE, FALSE);
107 WinLockInput (NULLHANDLE, WLI_NOBUTTONUP);
108 WinSetSysModalWindow (HWND_DESKTOP, hwndLock);
109 WinSetFocus (HWND_DESKTOP, hwndLock);
110 WinSetSysModalWindow (HWND_DESKTOP, NULLHANDLE);
111 }
112 break;
113 default:
114 break;
115 }
116}
117
118
119void pmdebug::term ()
120{
121 pid = 0;
122 start ();
123}
Note: See TracBrowser for help on using the repository browser.