/[pcsx2_0.9.7]/trunk/pcsx2/SourceLog.cpp
ViewVC logotype

Contents of /trunk/pcsx2/SourceLog.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 62 - (show annotations) (download)
Tue Sep 7 11:08:22 2010 UTC (10 years, 2 months ago) by william
File size: 8757 byte(s)
Auto Commited Import of: pcsx2-0.9.7-r3738-debug in ./trunk
1 /* PCSX2 - PS2 Emulator for PCs
2 * Copyright (C) 2002-2010 PCSX2 Dev Team
3 *
4 * PCSX2 is free software: you can redistribute it and/or modify it under the terms
5 * of the GNU Lesser General Public License as published by the Free Software Found-
6 * ation, either version 3 of the License, or (at your option) any later version.
7 *
8 * PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
10 * PURPOSE. See the GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License along with PCSX2.
13 * If not, see <http://www.gnu.org/licenses/>.
14 */
15
16 // --------------------------------------------------------------------------------------
17 // Source / Tracre Logging (high volume logging facilities)
18 // --------------------------------------------------------------------------------------
19 // This module defines functions for performing high-volume diagnostic trace logging.
20 // Only ASCII versions of these logging functions are provided. Translated messages are
21 // not supported, and typically all logs are written to disk (ASCII), thus making the
22 // ASCII versions the more efficient option.
23
24 #include "PrecompiledHeader.h"
25
26 #ifndef _WIN32
27 # include <sys/time.h>
28 #endif
29
30 #include <cstdarg>
31 #include <ctype.h>
32
33 #include "R3000A.h"
34 #include "iR5900.h"
35 #include "System.h"
36 #include "DebugTools/Debug.h"
37
38 using namespace R5900;
39
40 FILE *emuLog;
41 wxString emuLogName;
42
43 SysTraceLogPack SysTrace;
44 SysConsoleLogPack SysConsole;
45
46 typedef void Fntype_SrcLogPrefix( FastFormatAscii& dest );
47
48 // writes text directly to the logfile, no newlines appended.
49 void __Log( const char* fmt, ... )
50 {
51 va_list list;
52 va_start(list, fmt);
53
54 if( emuLog != NULL )
55 {
56 fputs( FastFormatAscii().WriteV(fmt,list), emuLog );
57 fputs( "\n", emuLog );
58 fflush( emuLog );
59 }
60
61 va_end( list );
62 }
63
64 void SysTraceLog::DoWrite( const char *msg ) const
65 {
66 if( emuLog == NULL ) return;
67
68 fputs( msg, emuLog );
69 fputs( "\n", emuLog );
70 fflush( emuLog );
71 }
72
73 void SysTraceLog_EE::ApplyPrefix( FastFormatAscii& ascii ) const
74 {
75 ascii.Write( "%-4s(%8.8lx %8.8lx): ", ((SysTraceLogDescriptor*)m_Descriptor)->Prefix, cpuRegs.pc, cpuRegs.cycle );
76 }
77
78 void SysTraceLog_IOP::ApplyPrefix( FastFormatAscii& ascii ) const
79 {
80 ascii.Write( "%-4s(%8.8lx %8.8lx): ", ((SysTraceLogDescriptor*)m_Descriptor)->Prefix, psxRegs.pc, psxRegs.cycle );
81 }
82
83 void SysTraceLog_VIFcode::ApplyPrefix( FastFormatAscii& ascii ) const
84 {
85 _parent::ApplyPrefix(ascii);
86 ascii.Write( "vifCode_" );
87 }
88
89 // --------------------------------------------------------------------------------------
90 // SysConsoleLogPack (descriptions)
91 // --------------------------------------------------------------------------------------
92 static const TraceLogDescriptor
93
94 TLD_ELF = {
95 L"ELF", L"ELF",
96 wxLt("Dumps detailed information for PS2 executables (ELFs).")
97 },
98
99 TLD_eeRecPerf = {
100 L"EErecPerf", L"EErec Performance",
101 wxLt("Logs manual protection, split blocks, and other things that might impact performance.")
102 },
103
104 TLD_eeConsole = {
105 L"EEout", L"EE Console",
106 wxLt("Shows the game developer's logging text (EE processor)")
107 },
108
109 TLD_iopConsole = {
110 L"IOPout", L"IOP Console",
111 wxLt("Shows the game developer's logging text (IOP processor)")
112 },
113
114 TLD_deci2 = {
115 L"DECI2", L"DECI2 Console",
116 wxLt("Shows DECI2 debugging logs (EE processor)")
117 };
118
119 SysConsoleLogPack::SysConsoleLogPack()
120 : ELF (&TLD_ELF, Color_Gray)
121 , eeRecPerf (&TLD_eeRecPerf, Color_Gray)
122 , eeConsole (&TLD_eeConsole)
123 , iopConsole(&TLD_iopConsole)
124 , deci2 (&TLD_deci2)
125 {
126 }
127
128 // --------------------------------------------------------------------------------------
129 // SysTraceLogPack (descriptions)
130 // --------------------------------------------------------------------------------------
131 static const SysTraceLogDescriptor
132 TLD_SIF = {
133 L"SIF", L"SIF (EE <-> IOP)",
134 wxLt(""),
135 "SIF"
136 };
137
138 // ----------------------------
139 // EmotionEngine (EE/R5900)
140 // ----------------------------
141
142 static const SysTraceLogDescriptor
143 TLD_EE_Bios = {
144 L"Bios", L"Bios",
145 wxLt("SYSCALL and DECI2 activity."),
146 "EE"
147 },
148
149 TLD_EE_Memory = {
150 L"Memory", L"Memory",
151 wxLt("Direct memory accesses to unknown or unmapped EE memory space."),
152 "eMem"
153 },
154
155 TLD_EE_R5900 = {
156 L"R5900", L"R5900 Core",
157 wxLt("Disasm of executing core instructions (excluding COPs and CACHE)."),
158 "eDis"
159 },
160
161 TLD_EE_COP0 = {
162 L"COP0", L"COP0",
163 wxLt("Disasm of COP0 instructions (MMU, cpu and dma status, etc)."),
164 "eDis"
165 },
166
167 TLD_EE_COP1 = {
168 L"FPU", L"COP1/FPU",
169 wxLt("Disasm of the EE's floating point unit (FPU) only."),
170 "eDis"
171 },
172
173 TLD_EE_COP2 = {
174 L"VUmacro", L"COP2/VUmacro",
175 wxLt("Disasm of the EE's VU0macro co-processor instructions."),
176 "eDis"
177 },
178
179 TLD_EE_Cache = {
180 L"Cache", L"Cache",
181 wxLt("Execution of EE cache instructions."),
182 "eDis"
183 },
184
185 TLD_EE_KnownHw = {
186 L"HwRegs", L"Hardware Regs",
187 wxLt("All known hardware register accesses (very slow!); not including sub filter options below."),
188 "eReg"
189 },
190
191 TLD_EE_UnknownHw = {
192 L"UnknownRegs", L"Unknown Regs",
193 wxLt("Logs only unknown, unmapped, or unimplemented register accesses."),
194 "eReg"
195 },
196
197 TLD_EE_DMAhw = {
198 L"DmaRegs", L"DMA Regs",
199 wxLt("Logs only DMA-related registers."),
200 "eReg"
201 },
202
203 TLD_EE_IPU = {
204 L"IPU", L"IPU",
205 wxLt("IPU activity: hardware registers, decoding operations, DMA status, etc."),
206 "IPU"
207 },
208
209 TLD_EE_GIFtag = {
210 L"GIFtags", L"GIFtags",
211 wxLt("All GIFtag parse activity; path index, tag type, etc."),
212 "GIF"
213 },
214
215 TLD_EE_VIFcode = {
216 L"VIFcodes", L"VIFcodes",
217 wxLt("All VIFcode processing; command, tag style, interrupts."),
218 "VIF"
219 },
220
221 TLD_EE_SPR = {
222 L"MFIFO", L"Scratchpad MFIFO",
223 wxLt("Scratchpad's MFIFO activity."),
224 "SPR"
225 },
226
227 TLD_EE_DMAC = {
228 L"DmaCtrl", L"DMA Controller",
229 wxLt("Actual data transfer logs, bus right arbitration, stalls, etc."),
230 "eDmaC"
231 },
232
233 TLD_EE_Counters = {
234 L"Counters", L"Counters",
235 wxLt("Tracks all EE counters events and some counter register activity."),
236 "eCnt"
237 },
238
239 TLD_EE_VIF = {
240 L"VIF", L"VIF",
241 wxLt("Dumps various VIF and VIFcode processing data."),
242 "VIF"
243 },
244
245 TLD_EE_GIF = {
246 L"GIF", L"GIF",
247 wxLt("Dumps various GIF and GIFtag parsing data."),
248 "GIF"
249 };
250
251 // ----------------------------------
252 // IOP - Input / Output Processor
253 // ----------------------------------
254
255 static const SysTraceLogDescriptor
256 TLD_IOP_Bios = {
257 L"Bios", L"Bios",
258 wxLt("SYSCALL and IRX activity."),
259 "IOP"
260 },
261
262 TLD_IOP_Memory = {
263 L"Memory", L"Memory",
264 wxLt("Direct memory accesses to unknown or unmapped IOP memory space."),
265 "iMem"
266 },
267
268 TLD_IOP_R3000A = {
269 L"R3000A", L"R3000A Core",
270 wxLt("Disasm of executing core instructions (excluding COPs and CACHE)."),
271 "iDis"
272 },
273
274 TLD_IOP_COP2 = {
275 L"COP2/GPU", L"COP2",
276 wxLt("Disasm of the IOP's GPU co-processor instructions."),
277 "iDis"
278 },
279
280 TLD_IOP_KnownHw = {
281 L"HwRegs", L"Hardware Regs",
282 wxLt("All known hardware register accesses, not including the sub-filters below."),
283 "iReg"
284 },
285
286 TLD_IOP_UnknownHw = {
287 L"UnknownRegs", L"Unknown Regs",
288 wxLt("Logs only unknown, unmapped, or unimplemented register accesses."),
289 "iReg"
290 },
291
292 TLD_IOP_DMAhw = {
293 L"DmaRegs", L"DMA Regs",
294 wxLt("Logs only DMA-related registers."),
295 "iReg"
296 },
297
298 TLD_IOP_Memcards = {
299 L"Memorycards", L"Memorycards",
300 wxLt("Memorycard reads, writes, erases, terminators, and other processing."),
301 "Mcd"
302 },
303
304 TLD_IOP_PAD = {
305 L"Pad", L"Pad",
306 wxLt("Gamepad activity on the SIO."),
307 "Pad"
308 },
309
310 TLD_IOP_DMAC = {
311 L"DmaCrl", L"DMA Controller",
312 wxLt("Actual DMA event processing and data transfer logs."),
313 "iDmaC"
314 },
315
316 TLD_IOP_Counters = {
317 L"Counters", L"Counters",
318 wxLt("Tracks all IOP counters events and some counter register activity."),
319 "iCnt"
320 },
321
322 TLD_IOP_CDVD = {
323 L"CDVD", L"CDVD",
324 wxLt("Detailed logging of CDVD hardware."),
325 "CDVD"
326 };
327
328 SysTraceLogPack::SysTraceLogPack()
329 : SIF (&TLD_SIF)
330 {
331 }
332
333 SysTraceLogPack::EE_PACK::EE_PACK()
334 : Bios (&TLD_EE_Bios)
335 , Memory (&TLD_EE_Memory)
336 , GIFtag (&TLD_EE_GIFtag)
337 , VIFcode (&TLD_EE_VIFcode)
338
339 , R5900 (&TLD_EE_R5900)
340 , COP0 (&TLD_EE_COP0)
341 , COP1 (&TLD_EE_COP1)
342 , COP2 (&TLD_EE_COP2)
343 , Cache (&TLD_EE_Cache)
344
345 , KnownHw (&TLD_EE_KnownHw)
346 , UnknownHw (&TLD_EE_UnknownHw)
347 , DMAhw (&TLD_EE_DMAhw)
348 , IPU (&TLD_EE_IPU)
349
350 , DMAC (&TLD_EE_DMAC)
351 , Counters (&TLD_EE_Counters)
352 , SPR (&TLD_EE_SPR)
353
354 , VIF (&TLD_EE_VIF)
355 , GIF (&TLD_EE_GIF)
356 {
357 }
358
359 SysTraceLogPack::IOP_PACK::IOP_PACK()
360 : Bios (&TLD_IOP_Bios)
361 , Memcards (&TLD_IOP_Memcards)
362 , PAD (&TLD_IOP_PAD)
363
364 , R3000A (&TLD_IOP_R3000A)
365 , COP2 (&TLD_IOP_COP2)
366 , Memory (&TLD_IOP_Memory)
367
368 , KnownHw (&TLD_IOP_KnownHw)
369 , UnknownHw (&TLD_IOP_UnknownHw)
370 , DMAhw (&TLD_IOP_DMAhw)
371
372 , DMAC (&TLD_IOP_DMAC)
373 , Counters (&TLD_IOP_Counters)
374 , CDVD (&TLD_IOP_CDVD)
375 {
376 }

  ViewVC Help
Powered by ViewVC 1.1.22