#include <TraceEngine.h>

Definition at line 133 of file TraceEngine.h.
Public Member Functions | |
| void | read_procfile (const char *filename) |
| Read a procfile. | |
| CTraceEngine (class CSystem *sys) | |
| Constructor. | |
| ~CTraceEngine (void) | |
| Destructor. | |
| void | trace (class CAlphaCPU *cpu, u64 f, u64 t, bool down, bool up, const char *x, int y) |
| Trace function calling. | |
| void | trace_br (class CAlphaCPU *cpu, u64 f, u64 t) |
| Trace a branch. | |
| void | add_function (u64 address, const char *fn_name, const char *fn_arglist, bool step_over) |
| Add a function to the database of known functions. | |
| bool | get_fnc_name (class CAlphaCPU *cpu, u64 address, char **p_fn_name) |
| See if a function name is known for a given address. | |
| void | set_waitfor (class CAlphaCPU *cpu, u64 address) |
| Suspend tracing until the given address is reached. | |
| FILE * | trace_file () |
| Get file handle for current trace file. | |
| void | trace_dev (const char *text) |
| Print a string to the current trace file. | |
| int | parse (char command[100][100]) |
| Parse an IDB command. | |
| void | run_script (const char *filename) |
| Run an IDB script, or prompt user for input. | |
| void | list_all () |
| List all memory contents. | |
Protected Member Functions | |
| int | get_prbr (u64 prbr, u64 hwpcb) |
| Get process context record for a PRBR/HWPCB combination. | |
| void | write_arglist (CAlphaCPU *c, FILE *f, const char *a) |
| Parse the argument list string a, get the necessary registers from CPU c, and print the formatted argument list to file fl. | |
Protected Attributes | |
| class CSystem * | cSystem |
| int | trcfncs |
| int | iNumFunctions |
| int | iNumPRBRs |
| struct STraceFunction | asFunctions [25000] |
| struct STraceCPU | asCPUs [4] |
| struct STracePRBR | asPRBRs [1000] |
| FILE * | current_trace_file |
| u64 | iBreakPoint |
| int | iBreakPointMode |
| bool | bBreakPoint |
| u32 | iBreakPointInstruction |
| CTraceEngine::CTraceEngine | ( | class CSystem * | sys | ) |
Constructor.
Definition at line 215 of file TraceEngine.cpp.
References asCPUs, bBreakPoint, cSystem, current_trace_file, iNumFunctions, iNumPRBRs, and STraceCPU::last_prbr.
| CTraceEngine::~CTraceEngine | ( | void | ) |
| void CTraceEngine::read_procfile | ( | const char * | filename | ) |
Read a procfile.
This file contains lines of the form: <address>;<function name>="">;<argument list>="">;<step over>="">
Definition at line 713 of file TraceEngine.cpp.
References add_function(), LL, and U64.
Referenced by parse().
| void CTraceEngine::trace | ( | class CAlphaCPU * | cpu, | |
| u64 | f, | |||
| u64 | t, | |||
| bool | down, | |||
| bool | up, | |||
| const char * | x, | |||
| int | y | |||
| ) |
Trace function calling.
| cpu | Pointer to the CPU that jumps | |
| f | Address of the current instruction | |
| t | Address being jumped to | |
| down | This could be a function call | |
| up | This could be a return from a call | |
| x | Optional printf argument that describes what happens (eg "GO PAL %0x") | |
| y | Optional extra argument for the printf statement. |
Definition at line 251 of file TraceEngine.cpp.
References asCPUs, asFunctions, asPRBRs, CAlphaCPU::get_cpuid(), CAlphaCPU::get_hwpcb(), CAlphaCPU::get_prbr(), get_prbr(), CAlphaCPU::get_r(), iNumFunctions, STraceCPU::last_prbr, LL, real_address(), trace_br(), STracePRBR::trc_waitfor, STracePRBR::trcadd, STracePRBR::trchide, STracePRBR::trclvl, U64, and write_arglist().
Trace a branch.
This can't be a function call or return; stay at the same trace level.
| cpu | Pointer to the CPU that jumps | |
| f | Address of the current instruction | |
| t | Address being jumped to |
Definition at line 438 of file TraceEngine.cpp.
References asCPUs, asFunctions, asPRBRs, CAlphaCPU::get_cpuid(), CAlphaCPU::get_hwpcb(), CAlphaCPU::get_prbr(), get_prbr(), iNumFunctions, STraceCPU::last_prbr, LL, real_address(), STracePRBR::trc_waitfor, STracePRBR::trchide, STracePRBR::trclvl, U64, and write_arglist().
Referenced by trace().
| void CTraceEngine::add_function | ( | u64 | address, | |
| const char * | fn_name, | |||
| const char * | fn_arglist, | |||
| bool | step_over | |||
| ) |
Add a function to the database of known functions.
Definition at line 532 of file TraceEngine.cpp.
References STraceFunction::address, asFunctions, STraceFunction::fn_arglist, STraceFunction::fn_name, iNumFunctions, and STraceFunction::step_over.
Referenced by read_procfile().
See if a function name is known for a given address.
Definition at line 557 of file TraceEngine.cpp.
References asFunctions, STraceFunction::fn_name, iNumFunctions, and real_address().
Suspend tracing until the given address is reached.
Definition at line 545 of file TraceEngine.cpp.
References asPRBRs, CAlphaCPU::get_hwpcb(), CAlphaCPU::get_prbr(), get_prbr(), STracePRBR::trc_waitfor, and U64.
| FILE * CTraceEngine::trace_file | ( | ) |
Get file handle for current trace file.
Definition at line 778 of file TraceEngine.cpp.
References current_trace_file.
| void CTraceEngine::trace_dev | ( | const char * | text | ) |
Print a string to the current trace file.
Definition at line 770 of file TraceEngine.cpp.
References current_trace_file.
| int CTraceEngine::parse | ( | char | command[100][100] | ) |
Parse an IDB command.
Definition at line 883 of file TraceEngine.cpp.
References bBreakPoint, bDisassemble, bHashing, bTB_Debug, bTrace, CAlphaCPU::get_clean_pc(), CSystem::get_cpu(), CAlphaCPU::get_current_pc_physical(), CAlphaCPU::get_f(), CAlphaCPU::get_instruction_count(), CAlphaCPU::get_last_instruction(), CAlphaCPU::get_pc(), CAlphaCPU::get_r(), got_sigint, iBreakPoint, iBreakPointInstruction, iBreakPointMode, list_all(), CAlphaCPU::listing(), LL, read_procfile(), CSystem::RestoreState(), CFlash::RestoreStateF(), CDPR::RestoreStateF(), run_script(), CSystem::SaveState(), CFlash::SaveStateF(), CDPR::SaveStateF(), CAlphaCPU::set_f(), CAlphaCPU::set_pc(), CAlphaCPU::set_r(), sigint_handler(), CSystem::SingleStep(), strcasecmp, strncasecmp, theDPR, theSROM, theSystem, and U64.
Referenced by run_script().
| void CTraceEngine::run_script | ( | const char * | filename | ) |
Run an IDB script, or prompt user for input.
Definition at line 786 of file TraceEngine.cpp.
References CAlphaCPU::get_clean_pc(), CSystem::get_cpu(), CAlphaCPU::get_pc(), LL, lockstep_receive(), lockstep_send(), parse(), theSystem, and U64.
| void CTraceEngine::list_all | ( | ) |
List all memory contents.
Try to leave out memory that is only 00's, ef's or ff's.
Definition at line 1554 of file TraceEngine.cpp.
References sRegion::from, CSystem::get_cpu(), CSystem::get_memory_bits(), CAlphaCPU::listing(), LL, sRegion::pNext, CSystem::PtrToMem(), theSystem, sRegion::to, and U64.
Referenced by parse().
Get process context record for a PRBR/HWPCB combination.
Definition at line 579 of file TraceEngine.cpp.
References asPRBRs, cSystem, current_trace_file, STracePRBR::f, STracePRBR::generation, CSystem::get_memory_bits(), STracePRBR::hwpcb, iNumPRBRs, LL, STracePRBR::prbr, CSystem::PtrToMem(), STracePRBR::trc_waitfor, STracePRBR::trchide, STracePRBR::trclvl, and U64.
Referenced by set_waitfor(), trace(), and trace_br().
| void CTraceEngine::write_arglist | ( | CAlphaCPU * | c, | |
| FILE * | f, | |||
| const char * | a | |||
| ) | [protected] |
Parse the argument list string a, get the necessary registers from CPU c, and print the formatted argument list to file fl.
Definition at line 632 of file TraceEngine.cpp.
References cSystem, CSystem::get_memory_bits(), CAlphaCPU::get_r(), LL, printable(), CSystem::PtrToMem(), real_address(), U64, and write_printable_s().
Referenced by trace(), and trace_br().
class CSystem* CTraceEngine::cSystem [protected] |
Definition at line 152 of file TraceEngine.h.
Referenced by CTraceEngine(), get_prbr(), and write_arglist().
int CTraceEngine::trcfncs [protected] |
Definition at line 153 of file TraceEngine.h.
int CTraceEngine::iNumFunctions [protected] |
Definition at line 154 of file TraceEngine.h.
Referenced by add_function(), CTraceEngine(), get_fnc_name(), trace(), and trace_br().
int CTraceEngine::iNumPRBRs [protected] |
Definition at line 155 of file TraceEngine.h.
Referenced by CTraceEngine(), get_prbr(), and ~CTraceEngine().
struct STraceFunction CTraceEngine::asFunctions[25000] [read, protected] |
Definition at line 156 of file TraceEngine.h.
Referenced by add_function(), get_fnc_name(), trace(), and trace_br().
struct STraceCPU CTraceEngine::asCPUs[4] [read, protected] |
Definition at line 157 of file TraceEngine.h.
Referenced by CTraceEngine(), trace(), and trace_br().
struct STracePRBR CTraceEngine::asPRBRs[1000] [read, protected] |
Definition at line 158 of file TraceEngine.h.
Referenced by get_prbr(), set_waitfor(), trace(), trace_br(), and ~CTraceEngine().
FILE* CTraceEngine::current_trace_file [protected] |
Definition at line 161 of file TraceEngine.h.
Referenced by CTraceEngine(), get_prbr(), trace_dev(), and trace_file().
u64 CTraceEngine::iBreakPoint [protected] |
int CTraceEngine::iBreakPointMode [protected] |
bool CTraceEngine::bBreakPoint [protected] |
u32 CTraceEngine::iBreakPointInstruction [protected] |