#include "config.h"
#endif
-#include "gdb_server.h"
+#include "breakpoints.h"
#include "target_request.h"
#include "register.h"
#include "server.h"
#include "flash.h"
+#include "gdb_server.h"
#include "image.h"
#include "jtag.h"
return retval;
}
-int gdb_output(struct command_context_s *context, const char* line)
+int gdb_output(struct command_context *context, const char* line)
{
/* this will be dumped to the log and also sent as an O packet if possible */
LOG_USER_N("%s", line);
uint8_t *buf;
int buf_len;
buf = reg->value;
- buf_len = CEIL(reg->size, 8);
+ buf_len = DIV_ROUND_UP(reg->size, 8);
for (i = 0; i < buf_len; i++)
{
reg_packet_size += reg_list[i]->size;
}
- reg_packet = malloc(CEIL(reg_packet_size, 8) * 2);
+ reg_packet = malloc(DIV_ROUND_UP(reg_packet_size, 8) * 2);
reg_packet_p = reg_packet;
for (i = 0; i < reg_list_size; i++)
{
gdb_str_to_target(target, reg_packet_p, reg_list[i]);
- reg_packet_p += CEIL(reg_list[i]->size, 8) * 2;
+ reg_packet_p += DIV_ROUND_UP(reg_list[i]->size, 8) * 2;
}
#ifdef _DEBUG_GDB_IO_
{
char *reg_packet_p;
- reg_packet_p = strndup(reg_packet, CEIL(reg_packet_size, 8) * 2);
+ reg_packet_p = strndup(reg_packet, DIV_ROUND_UP(reg_packet_size, 8) * 2);
LOG_DEBUG("reg_packet: %s", reg_packet_p);
free(reg_packet_p);
}
#endif
- gdb_put_packet(connection, reg_packet, CEIL(reg_packet_size, 8) * 2);
+ gdb_put_packet(connection, reg_packet, DIV_ROUND_UP(reg_packet_size, 8) * 2);
free(reg_packet);
free(reg_list);
for (i = 0; i < reg_list_size; i++)
{
uint8_t *bin_buf;
- int chars = (CEIL(reg_list[i]->size, 8) * 2);
+ int chars = (DIV_ROUND_UP(reg_list[i]->size, 8) * 2);
if (packet_p + chars > packet + packet_size)
{
}
struct reg_arch_type *arch_type;
- bin_buf = malloc(CEIL(reg_list[i]->size, 8));
+ bin_buf = malloc(DIV_ROUND_UP(reg_list[i]->size, 8));
gdb_target_to_reg(target, packet_p, chars, bin_buf);
/* get register arch_type, and call set method */
exit(-1);
}
- reg_packet = malloc(CEIL(reg_list[reg_num]->size, 8) * 2);
+ reg_packet = malloc(DIV_ROUND_UP(reg_list[reg_num]->size, 8) * 2);
gdb_str_to_target(target, reg_packet, reg_list[reg_num]);
- gdb_put_packet(connection, reg_packet, CEIL(reg_list[reg_num]->size, 8) * 2);
+ gdb_put_packet(connection, reg_packet, DIV_ROUND_UP(reg_list[reg_num]->size, 8) * 2);
free(reg_list);
free(reg_packet);
}
/* convert from GDB-string (target-endian) to hex-string (big-endian) */
- bin_buf = malloc(CEIL(reg_list[reg_num]->size, 8));
- int chars = (CEIL(reg_list[reg_num]->size, 8) * 2);
+ bin_buf = malloc(DIV_ROUND_UP(reg_list[reg_num]->size, 8));
+ int chars = (DIV_ROUND_UP(reg_list[reg_num]->size, 8) * 2);
/* fix!!! add some sanity checks on packet size here */
return 0;
}
-int gdb_calc_blocksize(flash_bank_t *bank)
+int gdb_calc_blocksize(struct flash_bank *bank)
{
uint32_t i;
uint32_t block_size = 0xffffffff;
static int compare_bank (const void * a, const void * b)
{
- flash_bank_t *b1, *b2;
- b1=*((flash_bank_t **)a);
- b2=*((flash_bank_t **)b);
+ struct flash_bank *b1, *b2;
+ b1=*((struct flash_bank **)a);
+ b2=*((struct flash_bank **)b);
if (b1->base == b2->base)
{
int gdb_query_packet(struct connection *connection, struct target *target, char *packet, int packet_size)
{
- command_context_t *cmd_ctx = connection->cmd_ctx;
+ struct command_context *cmd_ctx = connection->cmd_ctx;
struct gdb_connection *gdb_connection = connection->priv;
if (strstr(packet, "qRcmd,"))
* Normally we only execute this code once, but no big deal if we
* have to regenerate it a couple of times. */
- flash_bank_t *p;
+ struct flash_bank *p;
char *xml = NULL;
int size = 0;
int pos = 0;
read/write) by default for GDB.
GDB does not have a concept of non-cacheable read/write memory.
*/
- flash_bank_t **banks = malloc(sizeof(flash_bank_t *)*flash_get_bank_count());
+ struct flash_bank **banks = malloc(sizeof(struct flash_bank *)*flash_get_bank_count());
int i;
for (i = 0; i < flash_get_bank_count(); i++)
banks[i]=p;
}
- qsort(banks, flash_get_bank_count(), sizeof(flash_bank_t *), compare_bank);
+ qsort(banks, flash_get_bank_count(), sizeof(struct flash_bank *), compare_bank);
uint32_t ram_start = 0;
for (i = 0; i < flash_get_bank_count(); i++)
return ERROR_OK;
}
-int gdb_register_commands(command_context_t *command_context)
+int gdb_register_commands(struct command_context *command_context)
{
register_command(command_context, NULL, "gdb_sync",
handle_gdb_sync_command, COMMAND_ANY,