Bumped copyright dates for 2013
[barry.git] / src / m_jvmdebug.h
blobb2d624e0bdaeb0b8aac6980ddacd57e707c0e363
1 ///
2 /// \file m_jvmdebug.h
3 /// Mode class for the JVMDebug mode
4 ///
6 /*
7 Copyright (C) 2005-2013, Net Direct Inc. (http://www.netdirect.ca/)
8 Copyright (C) 2008-2009, Nicolas VIVIEN
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19 See the GNU General Public License in the COPYING file at the
20 root directory of this project for more details.
23 #ifndef __BARRY_M_JVMDEBUG_H__
24 #define __BARRY_M_JVMDEBUG_H__
26 #include "dll.h"
27 #include "m_mode_base.h"
28 #include "socket.h"
29 #include "record.h"
30 #include "data.h"
32 namespace Barry {
34 // forward declarations
35 class Parser;
36 class Builder;
37 class Controller;
39 class JVMModulesEntry;
40 class JVMThreadsEntry;
43 class BXEXPORT JVMModulesList : public std::vector<JVMModulesEntry>
45 public:
46 typedef std::vector<JVMModulesEntry> base_type;
47 typedef base_type::iterator iterator;
48 typedef base_type::const_iterator const_iterator;
50 public:
51 void Parse(const Data &entry_packet);
53 void Dump(std::ostream &os) const;
55 BXEXPORT inline std::ostream& operator<<(std::ostream &os, const JVMModulesList &list) {
56 list.Dump(os);
57 return os;
61 class BXEXPORT JVMModulesEntry
63 public:
64 uint32_t Id;
65 uint32_t UniqueID;
66 std::string Name;
68 public:
69 void Dump(std::ostream &os) const;
73 class BXEXPORT JVMThreadsList : public std::vector<JVMThreadsEntry>
75 public:
76 typedef std::vector<JVMThreadsEntry> base_type;
77 typedef base_type::iterator iterator;
78 typedef base_type::const_iterator const_iterator;
80 public:
81 void Parse(const Data &entry_packet);
83 void Dump(std::ostream &os) const;
85 BXEXPORT inline std::ostream& operator<<(std::ostream &os, const JVMThreadsList &list) {
86 list.Dump(os);
87 return os;
91 class BXEXPORT JVMThreadsEntry
93 public:
94 uint32_t Id;
95 uint8_t Byte;
96 uint32_t Address;
97 uint32_t Unknown01; // FIXME - perhaps should not expose
98 // these to the app level, until we
99 // have a name for them, since they
100 // might change without notice
101 uint32_t Unknown02;
102 uint32_t Unknown03;
103 uint32_t Unknown04;
104 uint32_t Unknown05;
105 uint32_t Unknown06;
107 public:
108 void Dump(std::ostream &os, int num) const;
112 namespace Mode {
115 // JVMDebug class
117 /// The main interface class to the java program debugger protocol
119 /// To use this class, use the following steps:
121 /// - Create a Controller object (see Controller class for more details)
122 /// - Create this Mode::JVMDebug object, passing in the Controller
123 /// object during construction
124 /// - Call Open() to open database socket and finish constructing.
126 class BXEXPORT JVMDebug : public Mode
128 private:
129 bool m_Attached;
131 protected:
132 void ThrowJVMError(const std::string &msg, uint16_t cmd);
134 //////////////////////////////////
135 // overrides
137 virtual void OnOpen();
139 public:
140 JVMDebug(Controller &con);
141 ~JVMDebug();
143 //////////////////////////////////
144 // API
145 void Close();
147 void Attach();
148 void Detach();
150 // mid-attachment operations
151 void Unknown01(); // FIXME - make these into a proper API, or
152 // hide under protected:
153 void Unknown02();
154 void Unknown03();
155 void Unknown04();
156 void Unknown05();
157 void Unknown06();
158 void Unknown07();
159 void Unknown08();
160 void Unknown09();
161 void Unknown10();
162 void GetModulesList(JVMModulesList &mylist);
163 void GetThreadsList(JVMThreadsList &mylist);
164 int GetConsoleMessage(std::string &msg);
165 bool GetStatus(int &status);
166 bool WaitStatus(int &status);
167 void Go();
168 void Stop();
171 }} // namespace Barry::Mode
173 #endif