#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <errno.h>
#include <unistd.h>
#include <signal.h>
#include <sys/wait.h>
#include <ctype.h>
#include "dbg_msg.h"
#include "jt_instr.h"
#include "jt_arm.h"
#include "jt_mmu.h"
#include "jt_flash.h"
#include "arm_gdbstub.h"
#include "arm_gdbstub_callback.h"
#include "arm_memory_mmap.h"
#include "arm_gdbstub_break.h"
#include "arm_sfa_cmdseq.h"
#include "arm_gdbstub_rcmd_messages.h"
#include "convert.h"
enum AsignToken |
rcmd data with '=' somewhere in string
enum FunctionToken |
rcmd data without '=' in string
int gdb_monitor_Rcmd | ( | char * | query_str, | |
char * | response_str, | |||
struct reg_set * | raw_regs | |||
) |
quick and dirty parsing of the "rcmd" data
with data format:
VARIABLE [VARPARAM[,VARPARAM]] '=' VALUE [VALPARAM[,VALPARAM..]]
query_str | query string from GDB | |
response_str | response message string (here it's the query_str after qRmd) | |
raw_regs | currend set of all CPU registers |
>0 | sting length of response message | |
0 | OK no response message exists | |
-1 | error |
< SAM7SetGpnvmBit
< SAM7ClearGpnvmBit
References aTokenListElement::a_req_type, activateMemMap(), symbolTableEntry::addr, SymbolInfo::addr, memMap::MemBufferType::Flash::algo, allocateCmdCallbackEntry(), AllocateMemMapEntrys(), AllocCmdSeqences(), AllocCmdSequenceEntrys(), AllocMemMaps(), breakpointContainer::allow_auto_step, arm_sfa_ResetCPU(), atmelFlashClearGPNVM(), atmelFlashSetGPNVM(), SymbolInfo::breakIsActive, breakpointList, CB_ACTION_ERASE_FAIL, CB_ACTION_ERASE_INPROCESS, CB_ACTION_ERASE_SUCCEED, CB_ACTION_INPROCESS, CB_ACTION_MEMMAPINFO_INPROCESS, CB_ACTION_NON, CB_ACTION_PROGRAM_FAIL, CB_ACTION_PROGRAM_INPROCESS, CB_ACTION_PROGRAM_SUCCEED, CB_ACTION_VERIFY_DIFF, CB_ACTION_VERIFY_EQUAL, CB_ACTION_VERIFY_INPROCESS, changeWorkSpaceMode(), checkFlashCB_read_sector(), CMDSEQU_GET_CURRENT_THREAD_ID, CMDSEQU_GET_SAVED_REGSET, CMDSEQU_GET_THREAD_INFO, CMDSEQU_GET_TLS_ADDR, CMDSEQU_IS_TID_ALIVE, CMDSEQU_MINIMAL_THREAD_ID, CMDSEQU_MULTI_THREAD_ACTIVE, CMDSEQU_RESET_CPU, CMDSEQU_START_TARGET, CMDSEQU_STOP_TARGET, CMDSEQU_UNKOWN, CMDSEQUFLAG_ACCESS_FLAG, CMDSEQUFLAG_ADD, CMDSEQUFLAG_ADDRREF, CMDSEQUFLAG_ALIVE, CMDSEQUFLAG_ALLOC, CMDSEQUFLAG_AND, CMDSEQUFLAG_CALL, CMDSEQUFLAG_CALLWVAR, CMDSEQUFLAG_DIV, CMDSEQUFLAG_DUPARG, CMDSEQUFLAG_DUPRETVAL, CMDSEQUFLAG_DUPVAR, CMDSEQUFLAG_EXPORT_DATA_STORE, CMDSEQUFLAG_FORCE, CMDSEQUFLAG_INTERNAL, CMDSEQUFLAG_JMP, CMDSEQUFLAG_JMPEQ, CMDSEQUFLAG_JMPMI, CMDSEQUFLAG_JMPNE, CMDSEQUFLAG_JMPOVC, CMDSEQUFLAG_JMPOVS, CMDSEQUFLAG_JMPPOZ, CMDSEQUFLAG_JMPSGE, CMDSEQUFLAG_JMPSGT, CMDSEQUFLAG_JMPSLE, CMDSEQUFLAG_JMPSLT, CMDSEQUFLAG_JMPUHI, CMDSEQUFLAG_JMPUHS, CMDSEQUFLAG_JMPULO, CMDSEQUFLAG_JMPULS, CMDSEQUFLAG_LOAD, CMDSEQUFLAG_LSL, CMDSEQUFLAG_LSR, CMDSEQUFLAG_MOV, CMDSEQUFLAG_MUL, CMDSEQUFLAG_NOP, CMDSEQUFLAG_NOT, CMDSEQUFLAG_OR, CMDSEQUFLAG_RDWR_MSK, CMDSEQUFLAG_READ, CMDSEQUFLAG_RETURN, CMDSEQUFLAG_ROR, CMDSEQUFLAG_SETVAR, CMDSEQUFLAG_STORE, CMDSEQUFLAG_SUB, CMDSEQUFLAG_SUBREV, CMDSEQUFLAG_VALREF, CMDSEQUFLAG_WRITE, CMDSEQUFLAG_XOR, convertDiffTimeToMsec, reg_set::CPSR, CPU, CPU_CPSR_FLAG_CARRY, CPU_CPSR_FLAG_FAKE_CORTEX_M3, CPU_CPSR_FLAG_FIQ_DISABEL, CPU_CPSR_FLAG_IRQ_DISABEL, CPU_CPSR_FLAG_JAZELLE, CPU_CPSR_FLAG_NEGATIVE, CPU_CPSR_FLAG_OVERFLOW, CPU_CPSR_FLAG_Q_STICKY_OVERFLOW, CPU_CPSR_FLAG_THUMB, CPU_CPSR_FLAG_ZERO, CPU_CPSR_MODE_FLAGS, memMapCBContext::curr_Map, memMapCBContext::curr_memMap, memMapCBContext::curr_secCnt, DBG_LEVEL_GDB_ARM_INFO, DBG_LEVEL_GDB_ARM_INFO_LOW, dbg_msg_msk, dbgPrintf(), deactivateMemMap(), doCmdSequence(), eraseFlashCB_sector(), error_exit_code, reg_set::ext, F_FORCE_INVAL_FLASH, fTokenListElement::f_req_type, F_TOKEN_ACTIVATE, F_TOKEN_AUTO_STEP, F_TOKEN_CHKSUM_TEST_FL, F_TOKEN_CLEARSYMBOLS, F_TOKEN_CMD, F_TOKEN_CMDSEQ, F_TOKEN_CMDSEQ_BIND, F_TOKEN_DBG_MASK, F_TOKEN_DEACTIVATE, F_TOKEN_DEBUG_COM_CHAN, F_TOKEN_DEBUG_COM_FREAD_ENABLE, F_TOKEN_DEBUG_COM_IN_SIZE, F_TOKEN_DEBUG_COM_OUT_SIZE, F_TOKEN_DELAY, F_TOKEN_ENABLE_VIRT_2_PHYS, F_TOKEN_ERASE_FL, F_TOKEN_FL_STATE, F_TOKEN_FORCE_HW_BREAK, F_TOKEN_HELP, F_TOKEN_HIGH_VECTOR, F_TOKEN_INTERRUPT, F_TOKEN_INVAL, F_TOKEN_LPC_CHKSUM, F_TOKEN_LPC_FREQUENCE, F_TOKEN_MAINSYMBOL, F_TOKEN_MEMMAP, F_TOKEN_MODE_FLASH, F_TOKEN_MODE_MCLK, F_TOKEN_MODE_WORKSPACE, F_TOKEN_PROG_FL, F_TOKEN_PROGRAM_FLASH_ON_GO, F_TOKEN_RESTART, F_TOKEN_SAM7_CLEARGPNVM, F_TOKEN_SAM7_FREQUENCE, F_TOKEN_SAM7_SETGPNVM, F_TOKEN_STEP_EMULATION, F_TOKEN_STEP_HISTORY_SIZE, F_TOKEN_STM32X_OPTERASE, F_TOKEN_STR91X_BOOTBASE, F_TOKEN_STR91X_CSX_MAPPING, F_TOKEN_STR91X_FLASH_PROTECT, F_TOKEN_STR91X_NONBOOTBASE, F_TOKEN_STR91X_OTP_LOCK, F_TOKEN_SYMBOL, F_TOKEN_SYSINFO, F_TOKEN_TEMP_MAIN_BREAK, F_TOKEN_VERBOSE, F_TOKEN_VERIFY_FL, F_TOKEN_XML_VFLASH_MEMMAP, findMemMapOfAddr(), symbolTableHead::firstEntry, memMapHead::firstMapEntry, memMap::MemBufferType::Flash, FLASH_ALGORITHEM_NOSUPPORT, breakpointContainer::force_hardware_breakpoint, gdb_invalidate_Ram_Buffer(), gdb_invalidate_Rom_Buffer(), gdb_rcmd_console_output(), gdb_read_mem(), gdb_restart(), gdb_stepHist_clean(), gdb_stepHist_getSize(), gdb_stepHist_setSize(), gdb_write_mem(), gdb_writeback_Ram(), gdb_writeback_RamWorkspace(), getWorkSpace(), help_assign_message, help_assign_str91x_message, help_AutoStep_message, help_CheckFlash_message, help_ClearSymbols_message, help_Cmd_message, help_CmdSequence_internal_message, help_CmdSequence_message, help_DbgMask_message, help_debugComActivSymbol_message, help_debugComChan_message, help_debugComInOutSize_message, help_debugComInOutSymbol_message, help_Delay_message, help_EnableDebugComGdbFRead_message, help_EnableProgramFlashOnGo_message, help_EnableStepEmulation_message, help_EnableXMLvFlash_message, help_EraseFlash_message, help_FakeContinue_message, help_FlashState_message, help_ForceCheckInvalidSector_message, help_forceHWBreak_message, help_forceTempHWBreakAtMain_message, help_function_message, help_HighVector_message, help_info_message, help_Interrupt_message, help_InvalFlashWhileEraseing_message, help_LPCfrequence_message, help_LpcGenVectorCheckSum_message, help_mainSymbol_message, help_memmap_message, help_modeFLASH_message, help_modeMCLK_message, help_modeWorkspace_message, help_NoMemMap_message, help_ProgramFlash_message, help_Register_message, help_Restart_message, help_SAM7ClearGpnvmBit_message, help_SAM7frequence_message, help_SAM7SetGpnvmBit_message, help_StepHistorySize_message, help_Stm32xOptErase_message, help_Str91xBootBaseAddr_message, help_Str91xNonBootBaseAddr_message, help_Symbol_message, help_SysInfo_message, help_UseMemMap_message, help_variables_message, help_variables_str91x_message, help_verbose_message, help_VerifyFlash_message, help_VirtualMemory_message, INFO_VERBOSE, inQueueCmdCallbackEntry(), SymbolInfo::isThumb, jtag_arm_DumpCPUregs(), jtag_arm_mmu_check_high_vectors(), jtag_arm_mmu_disable_high_vectors(), jtag_arm_mmu_enable_high_vectors(), jtag_arm_ReadCpuRegs(), flashCBContext::lastSectorId, LESS_VERBOSE, memMapCBContext::max_MapEntry_number, memMapCBContext::max_MemMap_number, memMapCBContext::max_secCnt, memMap::memBufferType, MMAP_T_APPLICATION_FLASH, MMAP_T_CACHE, MMAP_T_FLASH, MMAP_T_IO, MMAP_T_RAM, MMAP_T_REREAD_ROM, MMAP_T_ROM, MMAP_T_SFA, MMAP_T_UNREAL, MMAP_T_UNUSED, MMAP_T_WORKSPACE, MORE_VERBOSE, symbolTableEntry::nextSymbol, memMapHead::numberOfEntrys, memMap::MemBufferType::Flash::numberOfSectors, symbolTableHead::numberOfSymbols, printmemMapCB_info(), programFlashCB_write_sector(), flashCBContext::quiet_cnt, reg_set::Regs::r, readaddrCmdSequence(), readStringBindingCmdSequence(), readStringCmdSequence(), readvalCmdSequence(), reg_set::regs, RemoveBreakpoint(), searchCmdSequenceHead(), searchMemMapHead(), fTokenListElement::sizeOfVarString, aTokenListElement::sizeOfVarString, SymbolInfo::state, stm32FlashErase(), symbolTableEntry::stringLen, symbolTableEntry::stringName, SYM_PRESENT, symbolMain, symbolTable, symbolTableEntry_defaultMain, TOKEN_AUTO_STEP, TOKEN_CMDSEQ, TOKEN_CMDSEQ_BIND, TOKEN_DBG_MASK, TOKEN_DEBUG_COM_ACTIV_SYMBOL, TOKEN_DEBUG_COM_CHAN, TOKEN_DEBUG_COM_FREAD_ENABLE, TOKEN_DEBUG_COM_IN_SIZE, TOKEN_DEBUG_COM_IN_SYMBOL, TOKEN_DEBUG_COM_OUT_SIZE, TOKEN_DEBUG_COM_OUT_SYMBOL, TOKEN_ENABLE_VIRT_2_PHYS, TOKEN_FAKE_CONTINUE, TOKEN_FORCE_CHECKEVENINVALSEC, TOKEN_FORCE_HW_BREAK, TOKEN_FORCE_INVAL_FLASH, TOKEN_HIGH_VECTOR, TOKEN_INTERRUPT, TOKEN_INVAL, TOKEN_LPC_FREQUENCE, TOKEN_MAINSYMBOL, TOKEN_MEMMAP, TOKEN_MODE_FLASH, TOKEN_MODE_MCLK, TOKEN_MODE_WORKSPACE, TOKEN_PROGRAM_FLASH_ON_GO, TOKEN_REGISTER, TOKEN_SAM7_FREQUENCE, TOKEN_STEP_EMULATION, TOKEN_STEP_HISTORY_SIZE, TOKEN_STR91X_BOOTBASE, TOKEN_STR91X_NONBOOTBASE, TOKEN_SYMBOL, TOKEN_TEMP_MAIN_BREAK, TOKEN_VERBOSE, TOKEN_XML_VFLASH_MEMMAP, memMap::type, updateCmdSequence(), updateMemMap(), symbolTableEntry::usage, reg_set::RegExt::v7m, symbolTableEntry::valid, fTokenListElement::varString, aTokenListElement::varString, flashCBContext::verbose, verbose, verifyFlashCB_read_sector(), flashCBContext::whichMemMap, and reg_set::RegExt::RegV7mExt::xPSR.
Referenced by gdb_load_configfile(), gdb_query_rcmd(), and parseParameter().
struct aTokenListElement aTokenList[] |
struct aTokenListElement aTokenListStr91xFlash[] |
struct fTokenListElement fTokenList[] |
struct fTokenListElement fTokenListStr91xFlash[] |