3 /// Mode class for the JVMDebug mode
7 Copyright (C) 2005-2011, 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__
27 #include "m_mode_base.h"
34 // forward declarations
39 class JVMModulesEntry
;
40 class JVMThreadsEntry
;
43 class BXEXPORT JVMModulesList
: public std::vector
<JVMModulesEntry
>
46 typedef std::vector
<JVMModulesEntry
> base_type
;
47 typedef base_type::iterator iterator
;
48 typedef base_type::const_iterator const_iterator
;
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
) {
61 class BXEXPORT JVMModulesEntry
69 void Dump(std::ostream
&os
) const;
73 class BXEXPORT JVMThreadsList
: public std::vector
<JVMThreadsEntry
>
76 typedef std::vector
<JVMThreadsEntry
> base_type
;
77 typedef base_type::iterator iterator
;
78 typedef base_type::const_iterator const_iterator
;
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
) {
91 class BXEXPORT JVMThreadsEntry
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
108 void Dump(std::ostream
&os
, int num
) const;
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
132 void ThrowJVMError(const std::string
&msg
, uint8_t cmd
);
134 //////////////////////////////////
137 virtual void OnOpen();
140 JVMDebug(Controller
&con
);
143 //////////////////////////////////
150 // mid-attachment operations
151 void Unknown01(); // FIXME - make these into a proper API, or
152 // hide under protected:
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
);
171 }} // namespace Barry::Mode