├── deci3dbg.vcxproj.user
├── README.md
├── deci3dbg.vcxproj.filters
├── deci3dbg.sln
├── plugin.cpp
├── consts.h
├── deci3dbg.vcproj
├── debmod.h
├── deci3dbg.vcxproj
└── debug.cpp
/deci3dbg.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # deci3dbg
2 |
3 | -----
4 |
5 | Ida Pro debugger module for Playstation 3.
6 |
7 | More info [here](http://oct0xor.github.io/2014/05/30/deci3dbg/)
8 |
9 | Author: oct0xor
10 |
11 | Licensed under the GPLv2 license.
--------------------------------------------------------------------------------
/deci3dbg.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {525a00d1-d801-4e59-8b89-2574bf9e603c}
6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat
7 |
8 |
9 | {13e4669a-8ccd-400f-b903-a22176be339c}
10 | h;hpp;hxx;hm;inl
11 |
12 |
13 | {84f1e70d-144d-4993-8c3e-695275771696}
14 | ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 | Source Files
23 |
24 |
25 |
26 |
27 | Header Files
28 |
29 |
30 | Header Files
31 |
32 |
33 | Header Files
34 |
35 |
36 | Header Files
37 |
38 |
39 | Header Files
40 |
41 |
42 | Header Files
43 |
44 |
45 | Header Files
46 |
47 |
48 | Header Files
49 |
50 |
51 | Header Files
52 |
53 |
54 |
--------------------------------------------------------------------------------
/deci3dbg.sln:
--------------------------------------------------------------------------------
1 | Microsoft Visual Studio Solution File, Format Version 12.00
2 | # Visual Studio 2012
3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "deci3dbg", "deci3dbg.vcxproj", "{8B9EEC53-D710-48D0-9761-1A799CB7039E}"
4 | EndProject
5 | Global
6 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
7 | Debug|Win32 = Debug|Win32
8 | Debug|x64 = Debug|x64
9 | Debug64|Win32 = Debug64|Win32
10 | Debug64|x64 = Debug64|x64
11 | Release|Win32 = Release|Win32
12 | Release|x64 = Release|x64
13 | Release64|Win32 = Release64|Win32
14 | Release64|x64 = Release64|x64
15 | EndGlobalSection
16 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
17 | {8B9EEC53-D710-48D0-9761-1A799CB7039E}.Debug|Win32.ActiveCfg = Debug|Win32
18 | {8B9EEC53-D710-48D0-9761-1A799CB7039E}.Debug|Win32.Build.0 = Debug|Win32
19 | {8B9EEC53-D710-48D0-9761-1A799CB7039E}.Debug|x64.ActiveCfg = Debug|x64
20 | {8B9EEC53-D710-48D0-9761-1A799CB7039E}.Debug|x64.Build.0 = Debug|x64
21 | {8B9EEC53-D710-48D0-9761-1A799CB7039E}.Debug64|Win32.ActiveCfg = Debug64|Win32
22 | {8B9EEC53-D710-48D0-9761-1A799CB7039E}.Debug64|Win32.Build.0 = Debug64|Win32
23 | {8B9EEC53-D710-48D0-9761-1A799CB7039E}.Debug64|x64.ActiveCfg = Debug64|Win32
24 | {8B9EEC53-D710-48D0-9761-1A799CB7039E}.Debug64|x64.Build.0 = Debug64|Win32
25 | {8B9EEC53-D710-48D0-9761-1A799CB7039E}.Release|Win32.ActiveCfg = Release|Win32
26 | {8B9EEC53-D710-48D0-9761-1A799CB7039E}.Release|Win32.Build.0 = Release|Win32
27 | {8B9EEC53-D710-48D0-9761-1A799CB7039E}.Release|x64.ActiveCfg = Release|x64
28 | {8B9EEC53-D710-48D0-9761-1A799CB7039E}.Release|x64.Build.0 = Release|x64
29 | {8B9EEC53-D710-48D0-9761-1A799CB7039E}.Release64|Win32.ActiveCfg = Release64|Win32
30 | {8B9EEC53-D710-48D0-9761-1A799CB7039E}.Release64|Win32.Build.0 = Release64|Win32
31 | {8B9EEC53-D710-48D0-9761-1A799CB7039E}.Release64|x64.ActiveCfg = Release64|x64
32 | {8B9EEC53-D710-48D0-9761-1A799CB7039E}.Release64|x64.Build.0 = Release64|x64
33 | EndGlobalSection
34 | GlobalSection(SolutionProperties) = preSolution
35 | HideSolutionNode = FALSE
36 | EndGlobalSection
37 | EndGlobal
38 |
--------------------------------------------------------------------------------
/plugin.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2014 oct0xor
2 | //
3 | // This program is free software : you can redistribute it and / or modify
4 | // it under the terms of the GNU General Public License as published by
5 | // the Free Software Foundation, version 2.0.
6 | //
7 | // This program is distributed in the hope that it will be useful,
8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
10 | // GNU General Public License 2.0 for more details.
11 | //
12 | // A copy of the GPL 2.0 should have been included with the program.
13 | // If not, see http ://www.gnu.org/licenses/
14 |
15 | #include
16 | #include
17 | #include
18 | #include
19 | #include
20 | #include
21 |
22 | extern debugger_t debugger;
23 |
24 | static bool init_plugin(void);
25 |
26 | bool plugin_inited;
27 |
28 | //--------------------------------------------------------------------------
29 | // Initialize debugger plugin
30 | static int idaapi init(void)
31 | {
32 | if (init_plugin())
33 | {
34 | dbg = &debugger;
35 | plugin_inited = true;
36 | return PLUGIN_KEEP;
37 | }
38 | return PLUGIN_SKIP;
39 | }
40 |
41 | //--------------------------------------------------------------------------
42 | // Terminate debugger plugin
43 | static void idaapi term(void)
44 | {
45 | if (plugin_inited)
46 | {
47 | //term_plugin();
48 | plugin_inited = false;
49 | }
50 | }
51 |
52 | //--------------------------------------------------------------------------
53 | // The plugin method - usually is not used for debugger plugins
54 | static void idaapi run(int /*arg*/)
55 | {
56 |
57 | }
58 |
59 | //--------------------------------------------------------------------------
60 | // Initialize PPC debugger plugin
61 | static bool init_plugin(void)
62 | {
63 | if (ph.id != PLFM_PPC)
64 | return false;
65 |
66 | return true;
67 | }
68 |
69 | //--------------------------------------------------------------------------
70 | char comment[] = "DECI3 debugger plugin by oct0xor.";
71 |
72 | char help[] =
73 | "DECI3 debugger plugin by oct0xor.\n"
74 | "\n"
75 | "This module lets you debug programs running in Playstation 3.\n";
76 |
77 |
78 | //--------------------------------------------------------------------------
79 | //
80 | // PLUGIN DESCRIPTION BLOCK
81 | //
82 | //--------------------------------------------------------------------------
83 | plugin_t PLUGIN =
84 | {
85 | IDP_INTERFACE_VERSION,
86 | PLUGIN_DBG, // plugin flags
87 | init, // initialize
88 |
89 | term, // terminate. this pointer may be NULL.
90 |
91 | run, // invoke plugin
92 |
93 | comment, // long comment about the plugin
94 | // it could appear in the status line
95 | // or as a hint
96 |
97 | help, // multiline help about the plugin
98 |
99 | "DECI3 debugger plugin", // the preferred short name of the plugin
100 |
101 | "" // the preferred hotkey to run the plugin
102 | };
103 |
--------------------------------------------------------------------------------
/consts.h:
--------------------------------------------------------------------------------
1 | #ifndef __CONSTS__
2 | #define __CONSTS__
3 |
4 | //
5 | // This file contains definition and consts shared among all debugger clients and servers
6 | //
7 | //
8 |
9 | #include
10 |
11 | #define TIMEOUT (1000/25) // in milliseconds, timeout for polling
12 | #define TIMEOUT_INFINITY -1
13 |
14 | // the idarpc_stream_struct_t structure is not defined.
15 | // it is used as an opaque type provided by the transport level.
16 | // the transport level defines its own local type for it.
17 | typedef struct idarpc_stream_struct_t idarpc_stream_t;
18 |
19 | // bidirectional codes (client <-> server)
20 | #define RPC_OK 0 // response: function call succeeded
21 | #define RPC_UNK 1 // response: unknown function code
22 | #define RPC_MEM 2 // response: no memory
23 |
24 | #define RPC_OPEN 3 // server->client: i'm ready, the very first packet
25 |
26 | #define RPC_EVENT 4 // server->client: debug event ready, followed by debug_event
27 | #define RPC_EVOK 5 // client->server: event processed (in response to RPC_EVENT)
28 | // we need EVOK to handle the situation when the debug
29 | // event was detected by the server during polling and
30 | // was sent to the client using RPC_EVENT but client has not received it yet
31 | // and requested GET_DEBUG_EVENT. In this case we should not
32 | // call remote_get_debug_event() but instead force the client
33 | // to use the event sent by RPC_EVENT.
34 | // In other words, if the server has sent RPC_EVENT but has not
35 | // received RPC_EVOK, it should fail all GET_DEBUG_EVENTS.
36 |
37 | // client->server codes
38 | #define RPC_INIT 10
39 | #define RPC_TERM 11
40 | #define RPC_GET_PROCESS_INFO 12
41 | #define RPC_START_PROCESS 13
42 | #define RPC_EXIT_PROCESS 14
43 | #define RPC_ATTACH_PROCESS 15
44 | #define RPC_DETACH_PROCESS 16
45 | #define RPC_GET_DEBUG_EVENT 17
46 | #define RPC_PREPARE_TO_PAUSE_PROCESS 18
47 | #define RPC_STOPPED_AT_DEBUG_EVENT 19
48 | #define RPC_CONTINUE_AFTER_EVENT 20
49 | #define RPC_TH_SUSPEND 21
50 | #define RPC_TH_CONTINUE 22
51 | #define RPC_TH_SET_STEP 23
52 | #define RPC_GET_MEMORY_INFO 24
53 | #define RPC_READ_MEMORY 25
54 | #define RPC_WRITE_MEMORY 26
55 | #define RPC_UPDATE_BPTS 27
56 | #define RPC_UPDATE_LOWCNDS 28
57 | #define RPC_EVAL_LOWCND 29
58 | #define RPC_ISOK_BPT 30
59 | #define RPC_READ_REGS 31
60 | #define RPC_WRITE_REG 32
61 | #define RPC_GET_SREG_BASE 33
62 | #define RPC_SET_EXCEPTION_INFO 34
63 |
64 | #define RPC_OPEN_FILE 35
65 | #define RPC_CLOSE_FILE 36
66 | #define RPC_READ_FILE 38
67 | #define RPC_WRITE_FILE 39
68 | #define RPC_IOCTL 40 // both client and the server may send this packet
69 | #define RPC_UPDATE_CALL_STACK 41
70 | #define RPC_APPCALL 42
71 | #define RPC_CLEANUP_APPCALL 43
72 |
73 | // server->client codes
74 | #define RPC_SET_DEBUG_NAMES 50
75 | #define RPC_SYNC_STUB 51
76 | #define RPC_ERROR 52
77 | #define RPC_MSG 53
78 | #define RPC_WARNING 54
79 | #define RPC_HANDLE_DEBUG_EVENT 55
80 | #define RPC_REPORT_IDC_ERROR 56
81 |
82 | #pragma pack(push, 1)
83 |
84 | struct PACKED rpc_packet_t
85 | { // fields are always sent in the network order
86 | uint32 length; // length of the packet (do not count length & code)
87 | uchar code; // function code
88 | };
89 | CASSERT(sizeof(rpc_packet_t) == 5);
90 | #pragma pack(pop)
91 |
92 | // Error reporting functions
93 | class rpc_engine_t;
94 | AS_PRINTF(2, 0) void dmsg(rpc_engine_t *, const char *format, va_list va);
95 | AS_PRINTF(2, 0) void derror(rpc_engine_t *, const char *format, va_list va);
96 | AS_PRINTF(2, 0) void dwarning(rpc_engine_t *, const char *format, va_list va);
97 | AS_PRINTF(3, 0) ssize_t dvmsg(int code, rpc_engine_t *ud, const char *format, va_list va);
98 |
99 | // We use this to declare reporting functions with a given user data
100 | #define DECLARE_UD_REPORTING(fnc, rpc) \
101 | AS_PRINTF(2, 3) void d##fnc(const char *format, ...) \
102 | { \
103 | va_list va; \
104 | va_start(va, format); \
105 | ::d##fnc(rpc, format, va); \
106 | va_end(va); \
107 | }
108 |
109 | error_t idaapi GetRegValue(idc_value_t *argv, idc_value_t *r);
110 | error_t idaapi SetRegValue(idc_value_t *argv, idc_value_t *r);
111 | void report_idc_error(rpc_engine_t *rpc, ea_t ea, error_t code, ssize_t errval, const char *errprm);
112 |
113 | // IDC function name that is exported by a debugger module
114 | // to allow scripts to send debugger commands
115 | #define IDC_SENDDBG_CMD "SendDbgCommand"
116 | #define IDC_READ_MSR "ReadMsr"
117 | #define IDC_WRITE_MSR "WriteMsr"
118 |
119 | // A macro to convert a pointer to ea_t without sign extension.
120 | #define EA_T(ptr) (ea_t)(size_t)(ptr)
121 |
122 | #endif
123 |
--------------------------------------------------------------------------------
/deci3dbg.vcproj:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
11 |
12 |
13 |
21 |
39 |
41 |
52 |
60 |
62 |
64 |
66 |
70 |
72 |
74 |
76 |
78 |
80 |
81 |
89 |
106 |
108 |
120 |
128 |
130 |
132 |
134 |
138 |
140 |
142 |
144 |
146 |
148 |
149 |
150 |
151 |
152 |
153 |
156 |
158 |
159 |
161 |
162 |
164 |
165 |
166 |
169 |
171 |
172 |
174 |
175 |
176 |
179 |
180 |
181 |
182 |
183 |
184 |
--------------------------------------------------------------------------------
/debmod.h:
--------------------------------------------------------------------------------
1 | #ifndef __DEBUGGER_MODULE__
2 | #define __DEBUGGER_MODULE__
3 |
4 | //
5 | //
6 | // This is the base debmod_t class definition
7 | // From this class all debugger code must inherite and specialize
8 | //
9 | // Some OS specific functions must be implemented:
10 | // bool init_subsystem();
11 | // bool term_subsystem();
12 | // debmod_t *create_debug_session();
13 | // int create_thread(thread_cb_t thread_cb, void *context);
14 | //
15 |
16 | #include