📄 debugger.h
字号:
/*
* Copyright (c) 2005 Zhejiang University, P.R.China
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
//=============================================================================
/**
* \file Arch/ARMDebugger/Debugger.h
*
* $Id: Debugger.h,v 1.6 2005/04/20 06:15:20 shengj Exp $
*
* \author dragon <dragonsn@163.com>
*/
//=============================================================================
#ifndef ARM__DEBUGGER_H_INCLUDED
#define ARM__DEBUGGER_H_INCLUDED
#pragma warning (disable:4099)
#if defined(__GNUG__) && !defined(__APPLE__)
# pragma implementation "Debugger.cpp"
# pragma interface "Debugger.cpp"
#endif
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
// for all others, include the necessary headers
#ifndef WX_PRECOMP
# include "wx/wx.h"
#endif
//
#ifdef WIN32
//#include <windows.h>
typedef int SOCKET;
typedef struct timeval { long tv_sec; long tv_usec;} timeval;
#endif
//
#include "wx/socket.h"
#include <wx/thread.h>
#ifndef DEBUGGER_H_INCLUDED
#include <Core/Debugger.h>
#endif
#include "./signals.h"
namespace ARM {
class DebuggerThread;
class Debugger : public Core::Debugger
{
public:
Debugger(void);
virtual ~Debugger(void);
virtual void debug(Core::Part &);
virtual void stop();
virtual void on_create(void);
virtual void on_destroy(void);
//! debug
virtual void debug_run();
//! assign thread
virtual void set_debug_thread(DebuggerThread *thread);
static const char *hexchars;
static const int BUFMAX;
private:
void put_packet(wxSocketBase *csock, Core::u8 *buffer);
Core::s32 compose_packet_from_sock(wxSocketBase *csock,Core::u8 *buf, size_t len, Core::u8 *outbuf);
/*
static char * arm_register_name_strings[] =
{"r0", "r1", "r2", "r3", // 0 1 2 3
"r4", "r5", "r6", "r7", // 4 5 6 7
"r8", "r9", "r10", "r11", // 8 9 10 11
"r12", "sp", "lr", "pc", // 12 13 14 15
"f0", "f1", "f2", "f3", // 16 17 18 19
"f4", "f5", "f6", "f7", // 20 21 22 23
"fps", "cpsr" };
*/
typedef enum
{
R0_IDX = 0,
R1_IDX,
R2_IDX,
R3_IDX,
R4_IDX,
R5_IDX,
R6_IDX,
R7_IDX,
R8_IDX,
R9_IDX,
R10_IDX,
R11_IDX,
R12_IDX,
SP_IDX,
LR_IDX,
PC_IDX = 15,
F0_IDX = 16,
F1_IDX,
F2_IDX,
F3_IDX,
F4_IDX,
F5_IDX,
F6_IDX,
F7_IDX = 23,
FPS_IDX = 24, // need modification
CPSR_IDX = 25
}REG_IDX;
Core::s32 con(Core::u32 addr, Core::s32 sig) ;
Core::s32 step(Core::u32 addr, Core::s32 sig);
Core::s32 get_registers(Core::s32 *);
Core::s32 write_registers(Core::s32 *);
size_t Debugger::get_register(size_t regnum, Core::Register_Int &value);
size_t Debugger::write_register(size_t regnum, Core::Register_Int value);
size_t read_memory(Core::u32 addr, size_t len, Core::Bytecode_Type &buffer);
size_t write_memory(Core::u32 addr, size_t len, Core::Bytecode_Type &buffer);
Core::s32 remote_restart();
Core::s32 insert_BPWP(Breakpoint_Type type, Core::u32 addr, size_t len);
Core::s32 remove_BPWP(Breakpoint_Type type, Core::u32 addr, size_t len);
Core::s32 search(Core::s32 addr, Core::s32 pattern, Core::s32 mask);
void write_ok(Core::u8 *buf);
void write_err(Core::u8 *buf);
void do_with_special_char(Core::u8 *inbuf, size_t len);
void handle_q_packet(Core::u8 *inbuf, Core::u8 *outbuf);
void handle_H_packet(Core::u8 *inbuf, Core::u8 *outbuf);
void reply_T_packet(Core::u8 *outbuf);
void resume_reply(Core::u8 *outbuf);
bool get_stop_simulator();
bool get_debug();
int compute_signal(Core::s32 tt);
void reverse_4(char *buf, int count);
//! some functions used to do with the msgs received from gdb
int hex(Core::u8 ch);
int hex2int(Core::u8 **ptr, Core::s32 *intValue, Core::u8 divchar);
int hex2long(Core::u8 **ptr, long *longValue, Core::u8 divchar);
Core::u8 *int2hex(Core::s32 value, Core::u8 *outbuf);
Core::u8 *mem2hex(Core::u8 *mem, Core::u8 *buf, int count, int may_fault);
Core::u8 *hex2mem(Core::u8 *buf, Core::u8 *mem, int count, int may_fault);
const Core::u8 lnibble_to_hex (Core::s32 i);
//! some private data members
DebuggerThread * thread_;
bool iscont_;
};
class DebuggerThread : public ::wxThread
{
public:
//! constructor
DebuggerThread(Debugger *dbg = NULL) : dbg_(dbg) {}
//! destructor
virtual ~DebuggerThread(){}
bool test_destroy()
{
return TestDestroy();
}
private:
virtual ::wxThread::ExitCode Entry();
Debugger * dbg_;
};
} //namespace
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -