From a92d27afb0733f6280088bd79b048cbd87a2a0c4 Mon Sep 17 00:00:00 2001 From: ntfreak Date: Mon, 18 Feb 2008 14:32:43 +0000 Subject: - Added a "User:" debug level. These are messages that are intended for the user and are part of normal operation. - Faster DEBUG/INFO() when they are disabled - target_read/write_buffer() now uses 16 and 32 bit access for single word aligned requests. Other requests are serviced as quickly as possible. - *much* faster read/write GDB packets, removing timeout problems. - GDB read/write packets w/single word aligned 32/16 bit access now use 32/16 bit word access. - working area can now be changed on the fly. Provides a way to move working area about as MMU is enabled/disabled. - cleaned up error messages for verify_image. Thanks Øyvind Harboe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://svn.berlios.de/openocd/trunk@302 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- src/server/gdb_server.c | 87 +++++-------------------------------------------- 1 file changed, 9 insertions(+), 78 deletions(-) (limited to 'src/server') diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index 99c9376d..d940bc1a 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -524,7 +524,7 @@ int gdb_output_con(connection_t *connection, char* line) int gdb_output(struct command_context_s *context, char* line) { /* this will be dumped to the log and also sent as an O packet if possible */ - ERROR(line); + USER(line); return ERROR_OK; } @@ -1056,35 +1056,18 @@ int gdb_read_memory_packet(connection_t *connection, target_t *target, char *pac DEBUG("addr: 0x%8.8x, len: 0x%8.8x", addr, len); - switch (len) - { - case 4: - if ((addr % 4) == 0) - retval = target->type->read_memory(target, addr, 4, 1, buffer); - else - retval = target->type->read_memory(target, addr, 1, len, buffer); - break; - case 2: - if ((addr % 2) == 0) - retval = target->type->read_memory(target, addr, 2, 1, buffer); - else - retval = target->type->read_memory(target, addr, 1, len, buffer); - break; - case 3: - case 1: - retval = target->type->read_memory(target, addr, 1, len, buffer); - break; - /* handle bulk reads */ - default: - retval = target_read_buffer(target, addr, len, buffer); - break; - } + retval = target_read_buffer(target, addr, len, buffer); #if 0 if (retval == ERROR_TARGET_DATA_ABORT) { /* TODO : Here we have to lie and send back all zero's lest stack traces won't work. * At some point this might be fixed in GDB, in which case this code can be removed. + * + * OpenOCD developers are acutely aware of this problem, but there is nothing + * gained by involving the user in this problem that hopefully will get resolved + * eventually + * * http://sourceware.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gdb&pr=2395 */ memset(buffer, 0, len); @@ -1159,31 +1142,7 @@ int gdb_write_memory_packet(connection_t *connection, target_t *target, char *pa buffer[i] = tmp; } - retval = ERROR_OK; - switch (len) - { - /* handle sized writes */ - case 4: - if ((addr % 4) == 0) - retval = target->type->write_memory(target, addr, 4, 1, buffer); - else - retval = target->type->write_memory(target, addr, 1, len, buffer); - break; - case 2: - if ((addr % 2) == 0) - retval = target->type->write_memory(target, addr, 2, 1, buffer); - else - retval = target->type->write_memory(target, addr, 1, len, buffer); - break; - case 3: - case 1: - retval = target->type->write_memory(target, addr, 1, len, buffer); - break; - /* handle bulk writes */ - default: - retval = target_write_buffer(target, addr, len, buffer); - break; - } + retval = target_write_buffer(target, addr, len, buffer); if (retval == ERROR_OK) { @@ -1206,7 +1165,6 @@ int gdb_write_memory_binary_packet(connection_t *connection, target_t *target, c u32 addr = 0; u32 len = 0; - u8 *buffer; int retval; /* skip command character */ @@ -1231,36 +1189,9 @@ int gdb_write_memory_binary_packet(connection_t *connection, target_t *target, c retval = ERROR_OK; if( len ) { - buffer = malloc(len); - DEBUG("addr: 0x%8.8x, len: 0x%8.8x", addr, len); - memcpy( buffer, separator, len ); - - switch (len) - { - case 4: - if ((addr % 4) == 0) - retval = target->type->write_memory(target, addr, 4, 1, buffer); - else - retval = target->type->write_memory(target, addr, 1, len, buffer); - break; - case 2: - if ((addr % 2) == 0) - retval = target->type->write_memory(target, addr, 2, 1, buffer); - else - retval = target->type->write_memory(target, addr, 1, len, buffer); - break; - case 3: - case 1: - retval = target->type->write_memory(target, addr, 1, len, buffer); - break; - default: - retval = target_write_buffer(target, addr, len, buffer); - break; - } - - free(buffer); + retval = target_write_buffer(target, addr, len, separator); } if (retval == ERROR_OK) -- cgit v1.2.3