3 /// Java Debug server classes
7 Copyright (C) 2009, Nicolas VIVIEN
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU General Public License in the COPYING file at the
19 root directory of this project for more details.
22 #ifndef __BARRYJDWP_SERVER_H__
23 #define __BARRYJDWP_SERVER_H__
26 #include "j_manager.h"
27 #include "dp_codinfo.h"
28 #include "m_jvmdebug.h"
29 #include "threadwrap.h"
34 namespace Barry
{ namespace JDWP
{
36 class BXEXPORT JDWServer
39 typedef void (*ConsoleCallbackType
)(const std::string
&);
42 Barry::Mode::JVMDebug
*jvmdebug
;
55 Barry::JVMModulesList modulesList
; // List of COD applications installed on the device
56 Barry::JDG::DebugFileList debugFileList
; // List of debug file on the host
58 JDWAppList appList
; // List of BlackBerry application (an application contents several COD files)
59 Barry::JDG::ClassList visibleClassList
; // Visible class list from JDB
61 std::auto_ptr
<Thread
> handler
;
62 ConsoleCallbackType printConsoleMessage
;
64 void CommandsetProcess(Barry::Data
&cmd
);
66 void CommandsetVirtualMachineProcess(Barry::Data
&cmd
);
67 void CommandsetEventRequestProcess(Barry::Data
&cmd
);
69 void CommandVersion(Barry::Data
&cmd
);
70 void CommandIdSizes(Barry::Data
&cmd
);
71 void CommandAllClasses(Barry::Data
&cmd
);
72 void CommandAllThreads(Barry::Data
&cmd
);
73 void CommandSuspend(Barry::Data
&cmd
);
74 void CommandResume(Barry::Data
&cmd
);
75 void CommandClassPaths(Barry::Data
&cmd
);
77 void CommandSet(Barry::Data
&cmd
);
79 // void BackgroundDeviceProcess();
84 JDWServer(Barry::Mode::JVMDebug
&device
, const char *address
, int port
);
87 void SetPasswordDevice(std::string password
);
89 void SetConsoleCallback(ConsoleCallbackType callback
);
91 bool Start(); // starts new thread
92 bool AcceptConnection();
93 bool AttachToDevice();
94 bool InitVisibleClassList();
97 void DetachFromDevice();
98 bool Stop(); // cancels thread if still running, and
102 }} // namespace Barry::JDWP