Re: [Openocd-development] segfault when gdb connects, but target is not connected

2010-11-15 Thread Øyvind Harboe
On Mon, Nov 15, 2010 at 8:37 AM, Domen Puncer domen.pun...@visionect.si wrote:
 On Sat, Nov 13, 2010 at 13:08, Øyvind Harboe oyvind.har...@zylin.com wrote:
 Does the attached patch fix the problem?

 Jup, did the trick.

Merged.

Thanks for testing  excellent reporting!



-- 
Øyvind Harboe

Can Zylin Consulting help on your project?

US toll free 1-866-980-3434 / International +47 51 63 25 00

http://www.zylin.com/zy1000.html
ARM7 ARM9 ARM11 XScale Cortex
JTAG debugger and flash programmer
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] segfault when gdb connects, but target is not connected

2010-11-14 Thread Domen Puncer
On Sat, Nov 13, 2010 at 13:08, Øyvind Harboe oyvind.har...@zylin.com wrote:
 Does the attached patch fix the problem?

Jup, did the trick.
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] segfault when gdb connects, but target is not connected

2010-11-13 Thread Øyvind Harboe
Does the attached patch fix the problem?



-- 
Øyvind Harboe

Can Zylin Consulting help on your project?

US toll free 1-866-980-3434 / International +47 51 63 25 00

http://www.zylin.com/zy1000.html
ARM7 ARM9 ARM11 XScale Cortex
JTAG debugger and flash programmer
From f41192ab7ff1da1d9b6ac7908987de8478a35db4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=98yvind=20Harboe?= oyvind.har...@zylin.com
Date: Sat, 13 Nov 2010 13:03:29 +0100
Subject: [PATCH] gdb: fix occasional crash when flash probe failed
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Øyvind Harboe oyvind.har...@zylin.com
---
 src/server/gdb_server.c |   10 +++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c
index 9503a13..77142df 100644
--- a/src/server/gdb_server.c
+++ b/src/server/gdb_server.c
@@ -833,9 +833,6 @@ static int gdb_new_connection(struct connection *connection)
 	breakpoint_clear_target(gdb_service-target);
 	watchpoint_clear_target(gdb_service-target);
 
-	/* register callback to be informed about target events */
-	target_register_event_callback(gdb_target_callback_event_handler, connection);
-
 	/* remove the initial ACK from the incoming buffer */
 	if ((retval = gdb_get_char(connection, initial_ack)) != ERROR_OK)
 		return retval;
@@ -873,6 +870,13 @@ static int gdb_new_connection(struct connection *connection)
 		  target_name(gdb_service-target),
 		  target_state_name(gdb_service-target));
 
+	/* DANGER! If we fail subsequently, we must remove this handler,
+	 * otherwise we occasionally see crashes as the timer can invoke the
+	 * callback fn.
+	 *
+	 * register callback to be informed about target events */
+	target_register_event_callback(gdb_target_callback_event_handler, connection);
+
 	return ERROR_OK;
 }
 
-- 
1.7.0.4

___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] segfault when gdb connects, but target is not connected

2010-11-11 Thread Domen Puncer
On Thu, Nov 11, 2010 at 08:48, Øyvind Harboe oyvind.har...@zylin.com wrote:
 Try:

 openocd -c interface dummy -c gdb_memory_map disable -f target/stm32.cfg


No segfault in this case.

-- 
    Domen
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


[Openocd-development] segfault when gdb connects, but target is not connected

2010-11-10 Thread Domen Puncer
Hello,

I can reproduce this one easily, amontec tiny dongle, stm32 target,
which isn't connected. Fire up gdb to connect to openocd, and this
happens:

(gdb) r
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /home/domen/tmp/openocd.git/src/openocd
Open On-Chip Debugger 0.5.0-dev-00583-ge7b2958 (2010-11-10-09:09)
Licensed under GNU GPL v2
For bug reports, read
       http://openocd.berlios.de/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'jtag'
1000 kHz
adapter_nsrst_delay: 100
jtag_ntrst_delay: 100
100 kHz
Info : clock speed 100 kHz
Error: JTAG scan chain interrogation failed: all ones
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway...
Error: stm32.cpu: IR capture error; saw 0x0f not 0x01
Warn : Bypassing JTAG setup events due to errors
Warn : Invalid ACK 0x7 in JTAG-DP transaction
Polling target failed, GDB will be halted. Polling again in 100ms
Polling target failed, GDB will be halted. Polling again in 300ms
Polling target failed, GDB will be halted. Polling again in 700ms
Polling target failed, GDB will be halted. Polling again in 1500ms
Polling target failed, GDB will be halted. Polling again in 3100ms
Info : accepting 'gdb' connection from 
Error: Target not examined yet
Error: auto_probe failed -4

Error: Connect failed. Consider setting up a gdb-attach event for the
target to prepare target for GDB connect.
Error: attempted 'gdb' connection rejected
Polling target failed, GDB will be halted. Polling again in 6300ms

Program received signal SIGSEGV, Segmentation fault.
gdb_frontend_halted (target=0x7717f0, connection=0x7612b0) at gdb_server.c:749
749             if (gdb_connection-frontend_state == TARGET_RUNNING)
(gdb) bt
#0  gdb_frontend_halted (target=0x7717f0, connection=0x7612b0) at
gdb_server.c:749
#1  0x00427dbb in gdb_target_callback_event_handler
(target=0x7717f0, event=TARGET_EVENT_GDB_HALT, priv=0x7612b0) at
gdb_server.c:783
#2  0x00424ecf in target_call_event_callbacks
(target=0x7717f0, event=TARGET_EVENT_GDB_HALT) at target.c:1031
#3  0x00425cb6 in handle_target (priv=value optimized out)
at target.c:1909
#4  0x00423ce3 in target_call_timer_callback (checktime=1) at
target.c:1056
#5  target_call_timer_callbacks_check_time (checktime=1) at target.c:1085
#6  0x004261ff in server_loop (command_context=value
optimized out) at server.c:433
#7  0x00404a29 in openocd_main (argc=value optimized out,
argv=0x7fffdf38) at openocd.c:356
#8  0x77464c4d in __libc_start_main (main=value optimized
out, argc=value optimized out, ubp_av=value optimized out,
init=value optimized out, fini=value optimized out,
rtld_fini=value optimized out, stack_end=0x7fffdf28) at
libc-start.c:226
#9  0x004046d9 in _start ()
(gdb) p gdb_connection
$1 = (struct gdb_connection *) 0x6e6961676120676e
(gdb) i lo
gdb_connection = 0x6e6961676120676e
(gdb) i registers
rax            0x0      0
rbx            0x6e6961676120676e       7955997313365731182
rcx            0x7751e500   140737342727424
rdx            0x7612b0 7738032
rsi            0x7612b0 7738032
rdi            0x7717f0 7804912
rbp            0x7612b0 0x7612b0
rsp            0x7fffdc30   0x7fffdc30
r8             0x7612a0 7738016
r9             0x4cd949 5036361
r10            0x30303336206e6920       3472331620268009760
r11            0x246    582
r12            0x7717f0 7804912
r13            0x0      0
r14            0x7fffdd60   140737488346464
r15            0x7fffdde0   140737488346592
rip            0x427cbd 0x427cbd gdb_frontend_halted+29
eflags         0x10206  [ PF IF RF ]
cs             0x33     51
ss             0x2b     43
ds             0x0      0
es             0x0      0
fs             0x0      0
gs             0x0      0
(gdb)




And a longer output with --debug=3
$ gdb --args ~/tmp/openocd.git/src/openocd --debug=3
GNU gdb (GDB) 7.1-ubuntu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type show copying
and show warranty for details.
This GDB was configured as x86_64-linux-gnu.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/...
Reading symbols from /home/domen/tmp/openocd.git/src/openocd...done.
(gdb) r
Starting program: /home/domen/tmp/openocd.git/src/openocd --debug=3
Open On-Chip Debugger 0.5.0-dev-00583-ge7b2958 (2010-11-10-09:09)
Licensed under GNU GPL v2
For bug reports, read
       http://openocd.berlios.de/doc/doxygen/bugs.html
User : 11 1 command.c:566 command_print(): debug_level: 3
Debug: 12 1 configuration.c:45 add_script_search_dir(): adding
/home/domen/.openocd
Debug: 13 1 configuration.c:45 add_script_search_dir(): adding
/usr/local/share/openocd/site
Debug: 14 1 

Re: [Openocd-development] segfault when gdb connects, but target is not connected

2010-11-10 Thread Øyvind Harboe
Could you try reproducing this problem using the dummy driver?

openocd -c interface dummy -f yourconfig.cfg


-- 
Øyvind Harboe

Can Zylin Consulting help on your project?

US toll free 1-866-980-3434 / International +47 51 63 25 00

http://www.zylin.com/zy1000.html
ARM7 ARM9 ARM11 XScale Cortex
JTAG debugger and flash programmer
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] segfault when gdb connects, but target is not connected

2010-11-10 Thread Domen Puncer
On Wed, Nov 10, 2010 at 22:59, Øyvind Harboe oyvind.har...@zylin.com wrote:
 Could you try reproducing this problem using the dummy driver?

 openocd -c interface dummy -f yourconfig.cfg

Gdb can't connect to openocd when using a dummy driver.

My config, in case it matters:

interface ft2232
ft2232_layout jtagkey
ft2232_vid_pid 0x0403 0xcff8

source [find target/stm32.cfg]

jtag_khz 100


-- 
    Domen
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] segfault when gdb connects, but target is not connected

2010-11-10 Thread Øyvind Harboe
Try:

openocd -c interface dummy -c gdb_memory_map disable -f target/stm32.cfg




-- 
Øyvind Harboe

Can Zylin Consulting help on your project?

US toll free 1-866-980-3434 / International +47 51 63 25 00

http://www.zylin.com/zy1000.html
ARM7 ARM9 ARM11 XScale Cortex
JTAG debugger and flash programmer
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development