arm_gdbstub_break.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <ctype.h>
#include <unistd.h>
#include "dbg_msg.h"
#include "jt_arm.h"
#include "jt_cortex.h"
#include "jt_flash.h"
#include "jt_mmu.h"
#include "arm_gdbstub.h"
#include "arm_memory_mmap.h"
#include "arm_gdbstub_break.h"

Functions

Variables


Detailed Description


Function Documentation

int InsertBreakpoint ( uint32_t  addr,
int  len,
int  watchORbreak 
)
 support function to insert a new Addr to the Breakpoint List
 Since ICE-RT supports only two watchpoints
 we can have one of the three solutions:
              2 HWBkpt and nither SWBkpt nor Watch
 alternative	2 Watch and nither HWBkpt nor SWBkpt
 alternative  unlimited SWBkpt and either one HWBkpt or one SWBkpt
 
Parameters:
watchORbreak tells us if it is a watchpoint (=1) or a breakpoint (=0)
len tells us if it is an ARM (=4) or a Thumb (=2) instruction to break on
addr is the addess to break on
Return values:
0 on success
1 on Failure
-1 if requeset not supported

References breakpointEntry::access, SymbolInfo::addr, allocateGdbSprintfBuf(), memMap::baseAddr, bit_test, breakpointContainer::bl_return_address, breakpointContainer::bl_return_len, SymbolInfo::breakIsActive, CB_ACTION_NON, DBG_LEVEL_GDB_ARM_INFO, DBG_LEVEL_GDB_ARM_WARN, dbgPrintf(), DONT_HAVE_BL_RETURN, error_exit_code, findMemMapOfAddr(), breakpointContainer::firstHWBkptEntry, breakpointContainer::firstSWBkptEntry, breakpointContainer::firstWatchEntry, breakpointContainer::force_hardware_breakpoint, gdbPrintf(), memMap::MemBuffer::HalfWord, breakpointContainer::have_possible_bl_return_address, IF_DBG, breakpointEntry::instr, jtag_arm_mmu_virt2phys(), jtag_arm_ReadHalfword(), jtag_arm_ReadWord(), jtag_cortex_dwt_get_maxWatchpoints(), jtag_cortex_fpb_get_maxBreakpoints(), breakpointEntry::len, MAYBE_BL_RETURN, memMap::memBuffer, memMap::memBufferType, MMAP_T_APPLICATION_FLASH, MMAP_T_FLASH, MMAP_T_RAM, MMAP_T_REREAD_ROM, MMAP_T_ROM, breakpointEntry::nextBkptEntry, breakpointContainer::numberOfHWBkptEntrys, breakpointContainer::numberOfSWBkptEntrys, breakpointContainer::numberOfWatchEntrys, breakpointEntry::phys_addr, memMap::MemBufferType::Ram, RAM_PAGE_SIZE, RCMDPKTSIZE, memMap::MemBufferType::Ram::readPageBitmap, SymbolInfo::state, SYM_PRESENT, symbolMain, memMap::type, VALID_BL_RETURN, breakpointEntry::virt_addr, memMap::MemBuffer::Word, and memMap::MemBufferType::Ram::writeByteBitmap.

Referenced by checkActionNext(), and gdb_handle_exception().

int RemoveBreakpoint ( uint32_t  addr,
int  len,
int  watchORbreak 
)
 support function to remove a watch or breakpoint if it is on its List
 If a SW Break will be removed, its original instruction will be also restored back to RAM
 
Parameters:
watchORbreak tells us if it is a watchpoint (=1) or a breakpoint (=0)
len tells ARM (=4) or Thumb (=2) - still ignored
addr is the addess of the watch or break
Returns:
0 on success or -1 if nothig happened

References breakpointContainer::bl_return_address, DBG_LEVEL_GDB_ARM_INFO, DBG_LEVEL_GDB_ARM_WARN, dbgPrintf(), DONT_HAVE_BL_RETURN, DONT_HAVE_BL_UNDO, breakpointContainer::firstHWBkptEntry, breakpointContainer::firstSWBkptEntry, breakpointContainer::firstWatchEntry, gdb_write_mem(), breakpointContainer::have_bl_undo_address, breakpointContainer::have_possible_bl_return_address, breakpointEntry::instr, breakpointEntry::len, breakpointEntry::nextBkptEntry, breakpointContainer::numberOfHWBkptEntrys, breakpointContainer::numberOfSWBkptEntrys, breakpointContainer::numberOfWatchEntrys, breakpointEntry::phys_addr, VALID_BL_RETURN, and breakpointEntry::virt_addr.

Referenced by gdb_handle_exception(), gdb_main_loop(), and gdb_monitor_Rcmd().

int RemoveAllBreakpoints ( void   ) 
int isBreakpointListEmpty ( void   ) 
int isAddrOnBreakpointList ( uint32_t  addr  ) 
int gdbSetupJtagTarget_Breakpoint ( void   ) 
int gdbWriteSoftwareBreakToRAM ( void   ) 
int checkActionNext ( void   ) 

support function to check if we have seen a special breakpoint of the GDB "next" instruction. If so, and if we are still having free breakpoint resources; Insert this breakpoint, now. If there are not enouth resources; Return True, to emulte this by doing a lot of Step intruction.

Parameters:
- 
Return values:
1 try emulateing NEXT by doing autoStep
0 do not emulate NEXT

References allocateGdbSprintfBuf(), breakpointContainer::bl_return_address, breakpointContainer::bl_return_len, BUFMAX, CB_ACTION_NON, DBG_LEVEL_GDB_ARM_INFO, dbgPrintf(), DONT_HAVE_BL_RETURN, DONT_HAVE_BL_UNDO, gdbPrintf(), breakpointContainer::have_bl_undo_address, breakpointContainer::have_possible_bl_return_address, InsertBreakpoint(), jtag_cortex_fpb_get_maxBreakpoints(), breakpointContainer::numberOfHWBkptEntrys, breakpointContainer::numberOfSWBkptEntrys, breakpointContainer::numberOfWatchEntrys, and VALID_BL_RETURN.

Referenced by gdb_action_continue().

void preparePossibleActionNext ( uint32_t  return_addr,
uint32_t  undo_addr,
enum HaveBlUndoAddr  undo_is_valid 
)
 if we have seen a valid ARM (or Thumb) branch and link instruction
 add it (for a possible GDB "next") 
 if this "next" will be issued after a "step"
 add the address of the bl itself, too (so we can do an undo if setting breakpoints fails)
 also we keep the Mode of the "step" in mind, as
 undo_is_valid == 1 was ARM
 undo_is_valid == 2 was THUMB
 
Parameters:
return_addr 
undo_addr 
undo_is_valid 
Returns:
-

References breakpointContainer::allow_auto_step, breakpointContainer::bl_return_address, breakpointContainer::bl_undo_address, DONT_HAVE_BL_RETURN, DONT_HAVE_BL_UNDO, breakpointContainer::have_bl_undo_address, breakpointContainer::have_possible_bl_return_address, MAYBE_BL_RETURN, and VALID_BL_RETURN.

Referenced by gdb_action_step(), and gdb_handle_exception().

void cancelActionNext ( void   ) 

if not currently having a breakpoint used by active AutoStep delete the old (and now known to be wrong) return addess

Parameters:
- 
Returns:
-

References DONT_HAVE_BL_RETURN, DONT_HAVE_BL_UNDO, breakpointContainer::have_bl_undo_address, breakpointContainer::have_possible_bl_return_address, and VALID_BL_RETURN.

Referenced by gdb_action_step().

void undoAfterBlStep ( struct reg_set raw_regs  ) 

perform an undo after an branch and link instruction (if no step has been taken PC is still equal to bl_undo_address and nothing is realy changed)

Parameters:
raw_regs set of all currend CPU reisters
Returns:
-

References CAN_BL_UNDO_ARM, CAN_BL_UNDO_THUMB, reg_set::CPSR, DONT_HAVE_BL_UNDO, breakpointContainer::have_bl_undo_address, breakpointContainer::have_possible_bl_return_address, reg_set::Regs::r, reg_set::regs, and VALID_BL_RETURN.

Referenced by gdb_main_loop().


Variable Documentation


This file is part of the documentation for JTAG-GDB Server for ARM .

Generated on Mon Feb 15 21:23:21 2010 by doxygen 1.6.2.