#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <stdint.h>
#include <errno.h>
#include <unistd.h>
#include "dbg_msg.h"
#include "jt_arm.h"
#include "jt_flash.h"
#include "arm_gdbstub.h"
#include "arm_gdbstub_callback.h"
#include "arm_memory_mmap.h"
struct cmdCallbackEntry* allocateCmdCallbackEntry | ( | int | byteSizeOfExtraContext | ) | [read] |
__________________ | cmdCallbackEntry | +------------------+ +----------------+ | context | ---> | context buffer | +------------------+ +----------------+
(we are using callback stuff instead of multi threading) Allocate memory at HEAP Space for new callback entry. Also allocate space for its context (if required).
byteSizeOfExtraContext | size for additional context (in bytes) |
References cmdCallbackEntry::context.
Referenced by activateMemCleanUp(), checkFlashCB_read_sector(), eraseFlashCB_sector(), ftdiBlink(), ftdiBlinkStopCB(), gdb_flash_auto_programming(), gdb_monitor_Rcmd(), memCleanUpCB(), printmemMapCB_info(), programFlashCB_write_sector(), and verifyFlashCB_read_sector().
void freeCmdCallbackEntry | ( | struct cmdCallbackEntry * | cb | ) |
Free previous allocated callback entry and its context buffer.
cb | pointer to callback entry. |
References cmdCallbackEntry::context.
Referenced by doCallback(), and removeAllCallbacks().
void inQueueCmdCallbackEntry | ( | struct cmdCallbackEntry * | entry, | |
int(*)(int arg, int cnt, struct context *context) | fntCB, | |||
int | argSrc, | |||
int | cntSrc, | |||
struct context * | contextSrc, | |||
int | contextSize | |||
) |
Append a callback entry at the end of a list.
Also update a copy of all entry elements needed for later callback.
(if a context exist, then allocate a new buffer and copy all elements to it)
entry | pointer to callback entry | |
fntCB | function that should be called | |
argSrc | first functions argument | |
cntSrc | second functions argument | |
contextSrc | last functions argument (pointer to more data) | |
contextSize | size of additional context data |
References cmdCallbackEntry::arg, cmdCallbackEntry::cnt, cmdCallbackEntry::context, cmdCallbackEntry::fntCB, cmdCallbackEntry::nextCBentry, and cmdCallbackEntry::prevCBentry.
Referenced by activateMemCleanUp(), checkFlashCB_read_sector(), eraseFlashCB_sector(), ftdiBlink(), ftdiBlinkStopCB(), gdb_flash_auto_programming(), gdb_monitor_Rcmd(), memCleanUpCB(), printmemMapCB_info(), programFlashCB_write_sector(), and verifyFlashCB_read_sector().
struct cmdCallbackEntry* deQueueCmdCallbackEntry | ( | void | ) | [read] |
collect first entry from list and remove it from the list.
- |
References cmdCallbackEntry::nextCBentry, and cmdCallbackEntry::prevCBentry.
Referenced by doCallback(), and removeAllCallbacks().
int doCallback | ( | void | ) |
Call the oldest function with its arguments from the callback list.
(free also unneeded memory space)
- |
0 | OK | |
>=0 | function return value | |
<0 | ERROR |
References cmdCallbackEntry::arg, cmdCallbackEntry::cnt, cmdCallbackEntry::context, deQueueCmdCallbackEntry(), cmdCallbackEntry::fntCB, and freeCmdCallbackEntry().
Referenced by gdb_main_loop(), gdb_write_data_to_console(), getDebugChar(), jtag_test(), putDebugChar(), and putpacket().
void removeAllCallbacks | ( | void | ) |
remove all existing callback entries
- |
References deQueueCmdCallbackEntry(), and freeCmdCallbackEntry().
Referenced by gdb_handle_exception(), and gdb_write_data_to_console().
struct gdbSprintfBuf* allocateGdbSprintfBuf | ( | int | size_of_string | ) | [read] |
_______________ | gdbSprintfBuf | +---------------+ +---------------+ | string | ---> | string buffer | +---------------+ +---------------+ Allocate string message buffer space.
size_of_string |
References BUFMAX, gdbSprintfBuf::len, gdbSprintfBuf::next, and gdbSprintfBuf::string.
Referenced by checkActionNext(), checkFlashCB_read_sector(), eraseFlashCB_sector(), gdb_flash_auto_programming(), gdb_handle_console_io(), gdb_main_loop(), InsertBreakpoint(), printmemMapCB_info(), programFlashCB_write_sector(), and verifyFlashCB_read_sector().
void freeGdbSprintfBuf | ( | struct gdbSprintfBuf * | buf | ) |
free gdbSprintfBuf entry and its string buffer.
buf | pointer to gdbSprintfBuf message entry |
References gdbSprintfBuf::string.
Referenced by gdb_write_data_to_console(), and packGdbSprintBuf().
void inQueueGdbSprintfBuf | ( | struct gdbSprintfBuf * | buf | ) |
place message buffer entry at the tail of the queue
buf | pointer to gdbSprintfBuf message entry |
References gdbSprintfBufContainer::first, gdbSprintfBufContainer::last, and gdbSprintfBuf::next.
Referenced by checkFlashCB_read_sector(), eraseFlashCB_sector(), gdb_handle_console_io(), gdbPrintf(), printmemMapCB_info(), programFlashCB_write_sector(), and verifyFlashCB_read_sector().
struct gdbSprintfBuf* deQueueGdbSprintfBuf | ( | void | ) | [read] |
collect head of queue and remove head from queue
References gdbSprintfBufContainer::first, gdbSprintfBufContainer::last, and gdbSprintfBuf::next.
Referenced by gdb_write_data_to_console().
void packGdbSprintBuf | ( | void | ) |
pack string buffer together
- |
References BUFMAX, gdbSprintfBufContainer::first, freeGdbSprintfBuf(), gdbSprintfBufContainer::last, gdbSprintfBuf::len, gdbSprintfBuf::next, and gdbSprintfBuf::string.
Referenced by gdb_write_data_to_console().
void gdbPrintf | ( | int | set_pending_action, | |
int | doInQueue, | |||
struct gdbSprintfBuf * | msg_buf, | |||
const char * | format, | |||
... | ||||
) |
Printf wrapper
set_pending_action | side effect set memMapContainer.memStat.pending | |
doInQueue | !=0 inQueue; ==0 don't inQueue | |
msg_buf | pointer to gdbSprintfBuf message entry | |
format,... | printf alike format |
References BUFMAX, CB_ACTION_NON, CB_ACTION_TERMINATE, DBG_LEVEL_GDB_ARM_INFO, IF_DBG, inQueueGdbSprintfBuf(), gdbSprintfBuf::len, and gdbSprintfBuf::string.
Referenced by checkActionNext(), checkFlashCB_read_sector(), eraseFlashCB_sector(), gdb_flash_auto_programming(), gdb_handle_console_io(), gdb_main_loop(), InsertBreakpoint(), printmemMapCB_info(), programFlashCB_write_sector(), and verifyFlashCB_read_sector().
struct gdbSprintfBufContainer gdbSprintfBufContainer = {NULL,NULL} |