#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <errno.h>
#include <string.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <ctype.h>
#include <unistd.h>
#include "dbg_msg.h"
#include "jt_arm.h"
#include "jt_flash.h"
#include "arm_gdbstub.h"
#include "arm_memory_mmap.h"
#include "arm_gdbstub_break.h"
#define insertCachedWordAddr | ( | address, | |||
value | ) | insertCachedAddr(&lookupCacheContainer.wordCache, address, value) |
Referenced by gdbLookupArmInstr().
#define insertCachedHalfwordAddr | ( | address, | |||
value | ) | insertCachedAddr(&lookupCacheContainer.halfWordCache, address, value) |
Referenced by gdbLookupThumbInstr().
#define findCachedWordAddr | ( | address, | |||
value | ) | findCachedAddr(lookupCacheContainer.wordCache, address, value) |
Referenced by gdbLookupArmInstr().
#define findCachedHalfwordAddr | ( | address, | |||
value | ) | findCachedAddr(lookupCacheContainer.halfWordCache, address, value) |
Referenced by gdbLookupThumbInstr().
static void insertCachedAddr | ( | struct lookupCache ** | cache, | |
uint32_t | address, | |||
uint32_t | value | |||
) | [static] |
insert address and its value into a given lookup cache
cache | ||
address | ||
value |
References lookupCache::address, lookupCache::next, and lookupCache::value.
static int findCachedAddr | ( | struct lookupCache * | cache, | |
uint32_t | address, | |||
uint32_t * | value | |||
) | [static] |
search for address at given lookup cache
cache | ||
address | ||
value | Pointer to hold data value at address |
1 | if found | |
0 | if not found |
References lookupCache::address, lookupCache::next, and lookupCache::value.
static void clearGivenLookupCache | ( | struct lookupCache ** | cache | ) | [static] |
clear given lookup cache
cache |
References lookupCache::next.
Referenced by gdb_clearLookupCache().
void gdb_read_memory_block | ( | uint32_t | addr, | |
uint32_t | word_len, | |||
uint32_t * | buf | |||
) |
Read out a length of memory at the target, starting a target address (addr).
This memory contents is copied to a buffer (buf).
If possible try to put a target READ program into our target workspace.
And transfer the Read-data via DCC.
If this is not possible read the memory via JTAG.
addr | start word address of target memory | |
word_len | number of 32-Bit words to read | |
buf | pointer to destination buffer |
References memMap::baseAddr, DBG_LEVEL_GDB_ARM_INFO, getWorkSpace(), ICERT_REG_DCC_CONTROL, ICERT_REG_DCC_DATA, IF_DBG, jtag_arm_IceRT_RegRead(), jtag_arm_IceRT_RegRead_Once(), jtag_arm_IceRT_RegWrite(), jtag_arm_Mointor2DebugMode(), jtag_arm_PollDbgState(), jtag_arm_ReadWordMemory(), jtag_arm_RunProgram(), memMap::memBufferType, memMap::MemBufferType::Workspace::offset, useWorkspace(), memMap::MemBufferType::Workspace, and WORKSPACE_ALGO_READ.
Referenced by gdb_read_mem(), and verifyFlashCB_read_sector().
int* gdb_read_mem | ( | int | addr, | |
int | length | |||
) |
Read out memory from target into local buffer if not already done.
Return a pointer to the local copy.
The local buffer itself is defined by our Memory Map.
addr | start byte address of target memory | |
length | in bytes |
NULL | => if no buffer exists (to store the cache data) | |
Pointer | to local cache buffer |
References memMap::baseAddr, bit_set, bit_test, memMap::MemBuffer::Byte, DBG_LEVEL_GDB_ARM_ERROR, DBG_LEVEL_GDB_ARM_WARN, dbgPrintf(), findMemMapOfAddr(), memMap::MemBufferType::Flash, gdb_read_memory_block(), memMap::length, memMap::memBuffer, 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, memMap::MemBufferType::Flash::numberOfSectors, memMap::MemBufferType::Ram, RAM_PAGE_SIZE, memMap::MemBufferType::Ram::readPageBitmap, SECTOR_FLAG_DIRTY, SECTOR_FLAG_ERASED, SECTOR_FLAG_HAS_DATA, SECTOR_FLAG_RW, SECTOR_INVALID, SECTOR_READ_ERASED_VALID, SECTOR_READ_VALID, SECTOR_WRITE, SECTOR_WRITE_DIRTY, SECTOR_WRITE_DIRTY_ERASED, memMap::MemBufferType::Flash::sectorList, sector::size, memMap::type, memMap::MemBufferType::Ram::writeByteBitmap, and memMap::MemBufferType::Flash::writeByteBitmap.
Referenced by armOsabiAllocTargetStringBuffer(), gdb_handle_exception(), and gdb_monitor_Rcmd().
uint32_t gdbLookupThumbInstr | ( | uint32_t | addr | ) |
read THUMB instuction value at given address
addr | thumb addess |
References memMap::baseAddr, bit_test, breakpointList, DBG_LEVEL_GDB_ARM_INFO_LOW, DBG_LEVEL_GDB_ARM_WARN, dbgPrintf(), findCachedHalfwordAddr, findMemMapOfAddr(), breakpointContainer::firstSWBkptEntry, memMap::MemBufferType::Flash, memMap::MemBuffer::HalfWord, insertCachedHalfwordAddr, breakpointEntry::instr, jtag_arm_ReadHalfword(), memMap::memBuffer, memMap::memBufferType, MMAP_T_APPLICATION_FLASH, MMAP_T_FLASH, MMAP_T_RAM, MMAP_T_REREAD_ROM, MMAP_T_ROM, breakpointEntry::nextBkptEntry, memMap::MemBufferType::Flash::numberOfSectors, breakpointContainer::numberOfSWBkptEntrys, breakpointEntry::phys_addr, memMap::MemBufferType::Ram, RAM_PAGE_SIZE, memMap::MemBufferType::Ram::readPageBitmap, SECTOR_READ_ERASED_VALID, SECTOR_READ_VALID, SECTOR_WRITE_DIRTY, SECTOR_WRITE_DIRTY_ERASED, memMap::MemBufferType::Flash::sectorList, sector::size, memMap::type, and memMap::MemBufferType::Ram::writeByteBitmap.
Referenced by gdb_action_step(), and gdb_handle_exception().
uint32_t gdbLookupArmInstr | ( | uint32_t | addr | ) |
read ARM instuction value at given address
addr | arm addess |
References memMap::baseAddr, bit_test, breakpointList, DBG_LEVEL_GDB_ARM_INFO_LOW, DBG_LEVEL_GDB_ARM_WARN, dbgPrintf(), findCachedWordAddr, findMemMapOfAddr(), breakpointContainer::firstSWBkptEntry, memMap::MemBufferType::Flash, insertCachedWordAddr, breakpointEntry::instr, jtag_arm_ReadWord(), memMap::memBuffer, memMap::memBufferType, MMAP_T_APPLICATION_FLASH, MMAP_T_FLASH, MMAP_T_RAM, MMAP_T_REREAD_ROM, MMAP_T_ROM, breakpointEntry::nextBkptEntry, memMap::MemBufferType::Flash::numberOfSectors, breakpointContainer::numberOfSWBkptEntrys, breakpointEntry::phys_addr, memMap::MemBufferType::Ram, RAM_PAGE_SIZE, memMap::MemBufferType::Ram::readPageBitmap, SECTOR_READ_ERASED_VALID, SECTOR_READ_VALID, SECTOR_WRITE_DIRTY, SECTOR_WRITE_DIRTY_ERASED, memMap::MemBufferType::Flash::sectorList, sector::size, memMap::type, memMap::MemBuffer::Word, and memMap::MemBufferType::Ram::writeByteBitmap.
Referenced by armOsabiMultiThreading(), gdb_action_step(), and gdb_handle_exception().
void gdb_clearLookupCache | ( | void | ) |
clear temporary caches that might be used by gdbLookupArmInstr and gdbLookupThumbInstr
References clearGivenLookupCache(), lookupCacheContainer::halfWordCache, and lookupCacheContainer::wordCache.
Referenced by gdb_action_continue(), and gdb_action_step().
struct lookupCacheContainer lookupCacheContainer = {NULL, NULL} [static] |