aboutsummaryrefslogtreecommitdiff
path: root/src/server/gdb_server.c
AgeCommit message (Collapse)Author
2012-10-28gdb: use strncmp rather than strstrSpencer Oliver
All the packets received will be at start of the packet buffer, so use more efficient strncmp. Change-Id: Ib9c45d8f53425367006b1f880c1bde27f03a6cf9 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/932 Tested-by: jenkins Reviewed-by: Matthias Blaicher <matthias@blaicher.com> Reviewed-by: Peter Stuge <peter@stuge.se>
2012-10-24Revert "gdb_server : 'R' command replied by OK"Spencer Oliver
This reverts commit 1e7e59445287c3389b52903a7cacdb5635248f32. For some reason the above commit added a reply to the restart command - this is not required as per the gdb docs. Newer versions of gdb (7.0 and above) will complain about this reply. Change-Id: Ieeae3dcf44d798a91dfc6f7348da982c2ce1be31 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/910 Tested-by: jenkins Reviewed-by: Joel Bodenmann <joel@unormal.org>
2012-10-17gdb: fix extended-remote restartSpencer Oliver
Seems versions of gdb > 6.8 require an W stop reply after receiving a kill packet. Without this we receive the following error from gdb: gdb/thread.c:72: internal-error: inferior_thread: Assertion `tp' failed. Change-Id: I86765a321f0429c9b517fe13ded0ee2dbd4b2f87 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/911 Tested-by: jenkins Reviewed-by: Joel Bodenmann <joel@unormal.org> Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-10-02gdbserver: code cleanupSpencer Oliver
Change-Id: Iab2966be8dd145f33f41902e2d55afe03d0f5856 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/857 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-08-24build: fix memory leaksSpencer Oliver
Fix the memory leaks found by clang-3.1 Change-Id: Iaae68627ef599c324c9c9ee5737c22e92512862d Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/775 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-05-21target: remove legacy target eventsSpencer Oliver
These events have been deprecated for a number of years, update any remaining scripts to the new events. Change-Id: Ic31ff388545ac8b3a500045699ca92c541b13f12 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/634 Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com> Tested-by: jenkins Reviewed-by: Bill Traynor <wmat@alphatroop.com>
2012-03-19gdb_server: Simple close the connection and not exit openocd.Mathias K
This patch let openocd running and only close the gdb connection on error. Change-Id: Ifb88e16834b51207cc4c82210eab904ed8d30b71 Signed-off-by: Mathias K <kesmtp@freenet.de> Reviewed-on: http://openocd.zylin.com/523 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-03-19gdb_server: Fix wrong index/length compare.Mathias K
This patch fix the compare for the list size and the register index. Change-Id: I36d5e078f57d2a9f7823cfdf0d537762e00f6929 Signed-off-by: Mathias K <kesmtp@freenet.de> Reviewed-on: http://openocd.zylin.com/516 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-03-14gdb_server: sanity check the gdb register sizeMathias K
This patch checks the received register length with the local configured register length and disconnect on a length missmatch. Change-Id: I6b112c6b55a9ffb4526f582a384ffa91dc8b792f Signed-off-by: Mathias K <kesmtp@freenet.de> Reviewed-on: http://openocd.zylin.com/517 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-02-06build: cleanup src/server directorySpencer Oliver
Change-Id: I6410df28c5999f5cbee2d3bcaa02469a29ea4c15 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/412 Tested-by: jenkins
2012-01-18cmd: add missing usage varsSpencer Oliver
we should have caught them all - hopefully. Change-Id: I35435317fccaf5ad0216244d69f76db6857bb582 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/381 Tested-by: jenkins Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2012-01-15rtos : receive reset infoMichel JAOUEN
Change-Id: I03c64f50eed9bec43303bf47ac1f226a0e8dbd53 Signed-off-by: Michel JAOUEN <michel.jaouen@stericsson.com> Reviewed-on: http://openocd.zylin.com/346 Tested-by: jenkins Reviewed-by: Evan Hunter <evan@ozhiker.com> Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2012-01-15rtos : smp supportMichel JAOUEN
Change-Id: I583cddf5e62ed77f108786a085569ab8699ad50d Signed-off-by: Michel JAOUEN <michel.jaouen@stericsson.com> Reviewed-on: http://openocd.zylin.com/344 Tested-by: jenkins Reviewed-by: Evan Hunter <evan@ozhiker.com> Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2012-01-15rtos : remove unused parameterMichel JAOUEN
Change-Id: I98c9f28a0085bd4713b694181ab544777091eac6 Signed-off-by: Michel JAOUEN <michel.jaouen@stericsson.com> Reviewed-on: http://openocd.zylin.com/341 Tested-by: jenkins Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2012-01-09rtos: fix bug in error handlingØyvind Harboe
checking for != ERROR_FAIL is broken. Change-Id: Id7085afac653bb9c38d08928227a9ea402d8e6e9 Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com> Reviewed-on: http://openocd.zylin.com/351 Tested-by: jenkins Reviewed-by: Michel JAOUEN <michel.jaouen@stericsson.com> Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2011-12-02gdb_server: use strndup to allocate debug messagesSpencer Oliver
Lets be consistent and use strndup to allocate the debug buffer. Change-Id: I535ad270ebfeae6e09d28372ab3749c822971223 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/245 Tested-by: jenkins Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com> Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2011-12-01Fix compile error when _DEBUG_GDB_IO_ is setJames Zhao
Compile error is encountered when _DEBUG_GDB_IO_ is set, due to duplicate variables. Fixed by renaming the variable. Change-Id: I729c06e317fdb899142c9ceaf543b7f580088807 Signed-off-by: James Zhao <jamzhao@gmail.com> Reviewed-on: http://openocd.zylin.com/243 Tested-by: jenkins Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2011-11-17gdb: Potential rounding error in reg_packet_size gdb_get_registers_packetPhilip Nye
The calculation for reg_packet_size in gdb_get_registers_packet() could generate a wrong result in the case of multiple registers whose size is not a multiple of 8. The current calculation sums the sizes for all registers then rounds the result up to the next multiple of 8. Instead it should round each register size up individually and sum the results for all registers. Change-Id: Idfb5e5eeee0e69a6889dbe9769c0bf17feacb63b Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/200 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2011-11-17gdb: fix multi core gdb issuePhilip Nye
gdb_memory_map() correctly calculates the target specific number of flash banks, but then uses the total number (all targets) instead of the target specific number to construct its GDB response, causing a crash. Change-Id: I3f8639b3e90303a59753ebe140ce4fff96fd5db0 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/199 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2011-11-03gdb_server: assert to avoid malloc(0)Øyvind Harboe
Change-Id: I6ae3e007f4aa768f8bc64de78351750138f12e53 Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com> Reviewed-on: http://openocd.zylin.com/135 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2011-08-24remove target argument from gdb packet handling functionsJie Zhang
2011-06-04Fix "unused variable" warnings (errors) detected with GCC 4.7.0 - trivial fixesFreddie Chopin
2011-05-18Get register value if it's invalid in cache.Jie Zhang
2011-04-28gdb_server : 'R' command replied by OKMichel Jaouen
2011-04-28smp : infra for smp minimum supportMichel Jaouen
2011-04-15RTOS Thread awareness support wipBroadcom Corporation (Evan Hunter)
- works on Cortex-M3 with ThreadX and FreeRTOS Compared to original patch a few nits were fixed: - remove stricmp usage - unsigned compare fix - printf formatting fixes - fixed a bug with overrunning a memory buffer allocated with malloc.
2010-11-15gdb: fix occasional crash when flash probe failedØyvind Harboe
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-11-11gdb: improve error message when gdb connect failsØyvind Harboe
gdb connect can fail when the flash has not been probed. During gdb connect, the flash layout is reported, but this can not be automatically detected for a target that is powered up and OpenOCD supports connecting to gdb server even if the target is powered down. The solution is to turn of the gdb_memory_map feature. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-10-05build: remove warn_unused_result errorsSpencer Oliver
Remove any build errors for strtol when building release version of openocd. Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-10-04gdbserver: fix gdb_port memory leakSpencer Oliver
Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-10-01pipes: add documentation for pipesØyvind Harboe
Stick with the name "gdb_port" even if this command can be used for other things(disable, named pipes, anonymous stdin/out pipe). "port" is correct for probably more than 90% of use cases, if not more. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-10-01server: add support for pipesØyvind Harboe
-p/--pipe is now deprecated. Use '-c "gdb_port pipe;log_output openocd.log"' instead. Warning logged. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-10-01server: specify port as a stringØyvind Harboe
This will allow switching to using named pipes. Split this out as a seperate commit to make changes easier to follow. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-10-01server: read/write now goes through connection fn'sØyvind Harboe
depending on whether the connection is over a socket or pipe, the read is done differently. pipes can return -1 when writing 0 bytes, make 0 byte writes a successful no-op. 0 byte writes falls out naturally of tcl server code. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-10-01server: split file descriptors in in/out fd'sØyvind Harboe
pipes have different fd's for in/out. This makes the code more orthogonal and prepares for adding pipes. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-09-26gdb: fix blank line at topØyvind Harboe
snuck in at some point... Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-07-05gdbserver: incorrect memory map for multiple targets (bug #24)sb-sf
The gdb server incorrectly reports the memory map if we have multiple targets with multiple flash banks. Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-06-17gdb-server: fix -Wshadow warningOyvind Harboe
This warning was only reproducable with Cygwin. Cygwin now builds without warnings for the basic case. Signed-off-by: Oyvind Harboe <oyvind.harboe@zylin.com>
2010-06-16gdb: -Wshadow warning fixesØyvind Harboe
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-06-16gdb: clean up error handling in step/continueØyvind Harboe
if step/continue fails, then the error should be reported to the calling fn. The calling fn decides if the connection has to be aborted or if packet processing can continue. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-06-08gdb-server: fix error reporting bugsØyvind Harboe
GDB and OpenOCD has two different error number spaces and no mapping exists between them. If a specific error number is to be reported to GDB then this has to be done at the calling site, rather than as a generic routine that tries to map "retval" to GDB error number speak. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-05-17gdbserver: gdb cmds returning failure on successSpencer Oliver
The gdb_memory_map cmd for example fell through and returned ERROR_COMMAND_SYNTAX_ERROR on success - behaviour is now as expected. Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-05-14missing pointer's declaration when enable macro -D_DEBUG_GDB_IO_.Jun Ma
reproducable when "./configure --enable-maintainer-mode CFLAGS=-D_DEBUG_GDB_IO_" Signed-off-by: Jun Ma <sync.jma@gmail.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-05-05gdb: connect will now fail if flash autoprobe failsØyvind Harboe
This stops GDB from launching with an empty memory map, making gdb load w/flashing fail for no obvious reason. The error message points in the direction of the gdb-attach event that can be set up to issue a halt or "reset init" which will put GDB in a well defined stated upon attach and thus have a robust flash autoprobe. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-17gdb_server: improved gdb load performanceØyvind Harboe
by ack'ing memory writes immediately and reporting either at next memory write or stepi/continue time. GDB will then send off a new packet that is ready by the time the previous packet has been written to target memory. On faster adapters this can be as much as 10% improvement. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-01-21gdb_server: handle stepi/continue packet while target is running with more graceØyvind Harboe
Rather than issuing a halt and then stepi/resume, just wait for target to halt. Issue a sterner warning via gdb console that any gdb register changes will be ignored in this case. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-01-20gdb_server: correctly report flash sector sizesDavid Brownell
Report each region of same-size sectors separately, instead of incorrectly reporting that every sector has the same size. This is a longstanding bug on NOR flash chips with non-uniform sector sizes. It was largely hidden by other bugs in flash handling. When some of those were recently fixed, this one was exposed as a regression on str710. [oyvind.harboe@zylin.com: update the loop to behave on str7 ] Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-01-19gdb_server -- subroutinize memory map logicDavid Brownell
Put the memory map logic into its own subroutine. This will make it a bit easier to package bugfixes, and simplifies the query packet handling. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-01-19gdb_server -- symbol cleanupDavid Brownell
Make most methods static; net minor object code shrink. Likewise various data symbols; no net change. Shrink some overlong lines. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-01-14GDB: change gdb_breakpoint_override to COMMAND_ANYSpencer Oliver
- enable gdb_breakpoint_override to be used within config script. Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>