annotate agent/src/os/win32/Dispatcher.cpp @ 3237:399aa66d375e

Fixed a bug in which the valueEquals method was misused. The method does only check the equality of the node data and not full GVN equality by taking inputs and successors into account.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Wed, 27 Jul 2011 14:16:38 -0700
parents c18cbe5936b8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
2 * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 #include <stdio.h>
a61af66fc99e Initial load
duke
parents:
diff changeset
26 #include <string.h>
a61af66fc99e Initial load
duke
parents:
diff changeset
27 #include "dispatcher.hpp"
a61af66fc99e Initial load
duke
parents:
diff changeset
28
a61af66fc99e Initial load
duke
parents:
diff changeset
29 const char* CMD_ASCII = "ascii";
a61af66fc99e Initial load
duke
parents:
diff changeset
30 const char* CMD_UNICODE = "unicode";
a61af66fc99e Initial load
duke
parents:
diff changeset
31 const char* CMD_PROCLIST = "proclist";
a61af66fc99e Initial load
duke
parents:
diff changeset
32 const char* CMD_ATTACH = "attach";
a61af66fc99e Initial load
duke
parents:
diff changeset
33 const char* CMD_DETACH = "detach";
a61af66fc99e Initial load
duke
parents:
diff changeset
34 const char* CMD_LIBINFO = "libinfo";
a61af66fc99e Initial load
duke
parents:
diff changeset
35 const char* CMD_PEEK = "peek";
a61af66fc99e Initial load
duke
parents:
diff changeset
36 const char* CMD_POKE = "poke";
a61af66fc99e Initial load
duke
parents:
diff changeset
37 const char* CMD_THREADLIST = "threadlist";
a61af66fc99e Initial load
duke
parents:
diff changeset
38 const char* CMD_DUPHANDLE = "duphandle";
a61af66fc99e Initial load
duke
parents:
diff changeset
39 const char* CMD_CLOSEHANDLE = "closehandle";
a61af66fc99e Initial load
duke
parents:
diff changeset
40 const char* CMD_GETCONTEXT = "getcontext";
a61af66fc99e Initial load
duke
parents:
diff changeset
41 const char* CMD_SETCONTEXT = "setcontext";
a61af66fc99e Initial load
duke
parents:
diff changeset
42 const char* CMD_SELECTORENTRY = "selectorentry";
a61af66fc99e Initial load
duke
parents:
diff changeset
43 const char* CMD_SUSPEND = "suspend";
a61af66fc99e Initial load
duke
parents:
diff changeset
44 const char* CMD_RESUME = "resume";
a61af66fc99e Initial load
duke
parents:
diff changeset
45 const char* CMD_POLLEVENT = "pollevent";
a61af66fc99e Initial load
duke
parents:
diff changeset
46 const char* CMD_CONTINUEEVENT = "continueevent";
a61af66fc99e Initial load
duke
parents:
diff changeset
47 const char* CMD_EXIT = "exit";
a61af66fc99e Initial load
duke
parents:
diff changeset
48
a61af66fc99e Initial load
duke
parents:
diff changeset
49 // Uncomment the #define below to get messages on stderr
a61af66fc99e Initial load
duke
parents:
diff changeset
50 // #define DEBUGGING
a61af66fc99e Initial load
duke
parents:
diff changeset
51
a61af66fc99e Initial load
duke
parents:
diff changeset
52 void
a61af66fc99e Initial load
duke
parents:
diff changeset
53 Dispatcher::dispatch(char* cmd, Handler* handler) {
a61af66fc99e Initial load
duke
parents:
diff changeset
54 if (!strncmp(cmd, CMD_ASCII, strlen(CMD_ASCII))) {
a61af66fc99e Initial load
duke
parents:
diff changeset
55 handler->ascii(cmd + strlen(CMD_ASCII));
a61af66fc99e Initial load
duke
parents:
diff changeset
56
a61af66fc99e Initial load
duke
parents:
diff changeset
57 } else if (!strncmp(cmd, CMD_UNICODE, strlen(CMD_UNICODE))) {
a61af66fc99e Initial load
duke
parents:
diff changeset
58 handler->unicode(cmd + strlen(CMD_UNICODE));
a61af66fc99e Initial load
duke
parents:
diff changeset
59
a61af66fc99e Initial load
duke
parents:
diff changeset
60 } else if (!strncmp(cmd, CMD_PROCLIST, strlen(CMD_PROCLIST))) {
a61af66fc99e Initial load
duke
parents:
diff changeset
61 handler->procList(cmd + strlen(CMD_PROCLIST));
a61af66fc99e Initial load
duke
parents:
diff changeset
62
a61af66fc99e Initial load
duke
parents:
diff changeset
63 } else if (!strncmp(cmd, CMD_ATTACH, strlen(CMD_ATTACH))) {
a61af66fc99e Initial load
duke
parents:
diff changeset
64 handler->attach(cmd + strlen(CMD_ATTACH));
a61af66fc99e Initial load
duke
parents:
diff changeset
65
a61af66fc99e Initial load
duke
parents:
diff changeset
66 } else if (!strncmp(cmd, CMD_DETACH, strlen(CMD_DETACH))) {
a61af66fc99e Initial load
duke
parents:
diff changeset
67 handler->detach(cmd + strlen(CMD_DETACH));
a61af66fc99e Initial load
duke
parents:
diff changeset
68
a61af66fc99e Initial load
duke
parents:
diff changeset
69 } else if (!strncmp(cmd, CMD_LIBINFO, strlen(CMD_LIBINFO))) {
a61af66fc99e Initial load
duke
parents:
diff changeset
70 handler->libInfo(cmd + strlen(CMD_LIBINFO));
a61af66fc99e Initial load
duke
parents:
diff changeset
71
a61af66fc99e Initial load
duke
parents:
diff changeset
72 } else if (!strncmp(cmd, CMD_PEEK, strlen(CMD_PEEK))) {
a61af66fc99e Initial load
duke
parents:
diff changeset
73 handler->peek(cmd + strlen(CMD_PEEK));
a61af66fc99e Initial load
duke
parents:
diff changeset
74
a61af66fc99e Initial load
duke
parents:
diff changeset
75 } else if (!strncmp(cmd, CMD_POKE, strlen(CMD_POKE))) {
a61af66fc99e Initial load
duke
parents:
diff changeset
76 handler->poke(cmd + strlen(CMD_POKE));
a61af66fc99e Initial load
duke
parents:
diff changeset
77
a61af66fc99e Initial load
duke
parents:
diff changeset
78 } else if (!strncmp(cmd, CMD_THREADLIST, strlen(CMD_THREADLIST))) {
a61af66fc99e Initial load
duke
parents:
diff changeset
79 handler->threadList(cmd + strlen(CMD_THREADLIST));
a61af66fc99e Initial load
duke
parents:
diff changeset
80
a61af66fc99e Initial load
duke
parents:
diff changeset
81 } else if (!strncmp(cmd, CMD_DUPHANDLE, strlen(CMD_DUPHANDLE))) {
a61af66fc99e Initial load
duke
parents:
diff changeset
82 handler->dupHandle(cmd + strlen(CMD_DUPHANDLE));
a61af66fc99e Initial load
duke
parents:
diff changeset
83
a61af66fc99e Initial load
duke
parents:
diff changeset
84 } else if (!strncmp(cmd, CMD_CLOSEHANDLE, strlen(CMD_CLOSEHANDLE))) {
a61af66fc99e Initial load
duke
parents:
diff changeset
85 handler->closeHandle(cmd + strlen(CMD_CLOSEHANDLE));
a61af66fc99e Initial load
duke
parents:
diff changeset
86
a61af66fc99e Initial load
duke
parents:
diff changeset
87 } else if (!strncmp(cmd, CMD_GETCONTEXT, strlen(CMD_GETCONTEXT))) {
a61af66fc99e Initial load
duke
parents:
diff changeset
88 handler->getContext(cmd + strlen(CMD_GETCONTEXT));
a61af66fc99e Initial load
duke
parents:
diff changeset
89
a61af66fc99e Initial load
duke
parents:
diff changeset
90 } else if (!strncmp(cmd, CMD_SETCONTEXT, strlen(CMD_SETCONTEXT))) {
a61af66fc99e Initial load
duke
parents:
diff changeset
91 handler->setContext(cmd + strlen(CMD_SETCONTEXT));
a61af66fc99e Initial load
duke
parents:
diff changeset
92
a61af66fc99e Initial load
duke
parents:
diff changeset
93 } else if (!strncmp(cmd, CMD_SELECTORENTRY, strlen(CMD_SELECTORENTRY))) {
a61af66fc99e Initial load
duke
parents:
diff changeset
94 handler->selectorEntry(cmd + strlen(CMD_SELECTORENTRY));
a61af66fc99e Initial load
duke
parents:
diff changeset
95
a61af66fc99e Initial load
duke
parents:
diff changeset
96 } else if (!strncmp(cmd, CMD_SUSPEND, strlen(CMD_SUSPEND))) {
a61af66fc99e Initial load
duke
parents:
diff changeset
97 handler->suspend(cmd + strlen(CMD_SUSPEND));
a61af66fc99e Initial load
duke
parents:
diff changeset
98
a61af66fc99e Initial load
duke
parents:
diff changeset
99 } else if (!strncmp(cmd, CMD_RESUME, strlen(CMD_RESUME))) {
a61af66fc99e Initial load
duke
parents:
diff changeset
100 handler->resume(cmd + strlen(CMD_RESUME));
a61af66fc99e Initial load
duke
parents:
diff changeset
101
a61af66fc99e Initial load
duke
parents:
diff changeset
102 } else if (!strncmp(cmd, CMD_POLLEVENT, strlen(CMD_POLLEVENT))) {
a61af66fc99e Initial load
duke
parents:
diff changeset
103 handler->pollEvent(cmd + strlen(CMD_POLLEVENT));
a61af66fc99e Initial load
duke
parents:
diff changeset
104
a61af66fc99e Initial load
duke
parents:
diff changeset
105 } else if (!strncmp(cmd, CMD_CONTINUEEVENT, strlen(CMD_CONTINUEEVENT))) {
a61af66fc99e Initial load
duke
parents:
diff changeset
106 handler->continueEvent(cmd + strlen(CMD_CONTINUEEVENT));
a61af66fc99e Initial load
duke
parents:
diff changeset
107
a61af66fc99e Initial load
duke
parents:
diff changeset
108 } else if (!strcmp(cmd, CMD_EXIT)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
109 handler->exit(cmd + strlen(CMD_EXIT));
a61af66fc99e Initial load
duke
parents:
diff changeset
110 }
a61af66fc99e Initial load
duke
parents:
diff changeset
111
a61af66fc99e Initial load
duke
parents:
diff changeset
112 #ifdef DEBUGGING
a61af66fc99e Initial load
duke
parents:
diff changeset
113 else fprintf(stderr, "Ignoring illegal command \"%s\"\n", cmd);
a61af66fc99e Initial load
duke
parents:
diff changeset
114 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
115 }