ilg-archived / openocd

The GNU MCU Eclipse OpenOCD
http://gnuarmeclipse.github.io/openocd/
GNU General Public License v2.0
234 stars 62 forks source link

double free or corruption with ST-LINK/V2 #27

Closed j123b567 closed 5 years ago

j123b567 commented 6 years ago

Description

I have board without hardware reset and when I accidentaly configure reset_config srst_only, openocd failes with "double free or corruption".

I can connect with ST-LINK/V2-1 without problem. (ST-LINK/V2-1 is reported as STLINK v2 JTAG v30 API v2 SWIM v20 VID 0x0483 PID 0x374B)

After connecting with ST-LINK/V2, OpenOCD fails with backtrace and double free or corruption message. (ST-LINK/V2 is reported as STLINK v2 JTAG v30 API v2 SWIM v7 VID 0x0483 PID 0x3748)

I have tried all versions of gnu-mcu-eclipse/openocd and the problem was not in version v0.10.0-2-20170622-1535-dev and it first occures in v0.10.0-3-20170826-1813-dev all later versions are affected, at least v0.10.0-7-20180123 v0.10.0-5-20171110

Steps to Reproduce

  1. Connect ST-Link/V2 (not V2-1) to target MCU using just GND, TVCC, SWDIO, SWCLK
  2. Run OpenOCD with this configuration (I'm using STM32F030RC). It is wrong configuration, because SRST is not connected, so it should just tell "timed out while waiting for target halted".
source [find interface/stlink-v2.cfg ]
reset_config srst_only
set CHIPNAME STM32F030xC
set WORKAREASIZE 0x00008000
source [find target/stm32f0x.cfg ]
tcl_port disabled
telnet_port disabled
gdb_port disabled
init
reset halt
sleep 300
flash write_image erase "app.elf"
sleep 300
reset run
sleep 1000
shutdown

Expected behaviour: [What you expected to happen]

Error: timed out while waiting for target halted
TARGET: STM32F030xC.cpu - Not halted

Actual behaviour: [What actually happened]

GNU MCU Eclipse 64-bits Open On-Chip Debugger 0.10.0+dev-00404-g20463c28 (2018-01-23-12:24)
...
Error: timed out while waiting for target halted
Error in `/path_to/bin/openocd': double free or corruption (fasttop): 0x000000000287e2c0 
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7f05389e97e5]
/lib/x86_64-linux-gnu/libc.so.6(+0x8037a)[0x7f05389f237a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7f05389f653c]
/opt/scide/cnd/tools/Linux-x86_64/openocd/0.10.0-7-20180123-1217/bin/openocd[0x5df57f]

Versions

ilg-ul commented 6 years ago

thank you for reporting this, but I don't maintain openocd, I just pack it and distribute for user convenience.

I suggest you try the latest openocd version built from the main repository, and, if the problem is still there, report it to the maintainers.

j123b567 commented 6 years ago

You are producing heavily patched version of OpenOCD. I can't reproduce this with upstream OpenOCD. Upstream version 0.10.0 works Upstream version from 20180117 (commit edb67962865d5d3cc4a8ec1790b4c8c5327e98fd) works Upstream version head (commit 2b47ded8dee5ba52d47ce7cbc8b643ae4a3663ae) works

ilg-ul commented 6 years ago

Oops! It might be possible that some of the RISC-V patches to interfere with ST-LINK.

The RISC-V guys are cleaning their code and contributing upstream.

I'll try to make a new release, hopefully it'll be less problematic.

ilg-ul commented 6 years ago

I just released 0.10.0-8, with the latest commits. There are many cleanups in the RISC-V code.

Could you check if the problem was solved?

faisal-shah commented 6 years ago

I'm still getting a similar problem ... I ran OpenOCD in gdb, and also printed out the backtrace. Hope that helps .. This was done with an stm32 Nucleo 144 board.

[Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Open On-Chip Debugger 0.10.0+dev-dirty (2018-06-01-19:51) Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD adapter speed: 500 kHz adapter_nsrst_delay: 100 none separate srst_only separate srst_nogate srst_open_drain connect_deassert_srst Info : Listening on port 6666 for tcl connections Info : Listening on port 4444 for telnet connections Info : Unable to match requested speed 500 kHz, using 480 kHz Info : Unable to match requested speed 500 kHz, using 480 kHz Info : clock speed 480 kHz [New Thread 0x7ffff6ec2700 (LWP 3558)] Info : STLINK v2 JTAG v28 API v2 SWIM v18 VID 0x0483 PID 0x374B Info : using stlink api v2 Info : Target voltage: 3.225000 Info : stm32l4x.cpu: hardware has 6 breakpoints, 4 watchpoints Info : Listening on port 3333 for gdb connections Info : accepting 'gdb' connection on tcp/3333 target halted due to debug-request, current mode: Handler External Interrupt(86) xPSR: 0x21000066 pc: 0x08004a40 msp: 0x200003f0 Info : device id = 0x20006461 Info : flash size = 1024kbytes Info : Unable to match requested speed 500 kHz, using 480 kHz Info : Unable to match requested speed 500 kHz, using 480 kHz adapter speed: 480 kHz Error: timed out while waiting for target halted Error in `/usr/local/bin/openocd': double free or corruption (fasttop): 0x0000000000967490 ======= Backtrace: ========= /lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7ffff735f7e5] /lib/x86_64-linux-gnu/libc.so.6(+0x8037a)[0x7ffff736837a] /lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7ffff736c53c] /usr/local/bin/openocd[0x556416] ======= Memory map: ======== 00400000-00667000 r-xp 00000000 fd:00 263489 /usr/local/bin/openocd 00867000-00868000 r--p 00267000 fd:00 263489 /usr/local/bin/openocd 00868000-00872000 rw-p 00268000 fd:00 263489 /usr/local/bin/openocd 00872000-00b01000 rw-p 00000000 00:00 0 [heap] 7ffff0000000-7ffff0021000 rw-p 00000000 00:00 0 7ffff0021000-7ffff4000000 ---p 00000000 00:00 0 7ffff64ac000-7ffff64c2000 r-xp 00000000 fd:00 787560 /lib/x86_64-linux-gnu/libgcc_s.so.1 7ffff64c2000-7ffff66c1000 ---p 00016000 fd:00 787560 /lib/x86_64-linux-gnu/libgcc_s.so.1 7ffff66c1000-7ffff66c2000 rw-p 00015000 fd:00 787560 /lib/x86_64-linux-gnu/libgcc_s.so.1 7ffff66c2000-7ffff66c3000 ---p 00000000 00:00 0 7ffff66c3000-7ffff6ec3000 rw-p 00000000 00:00 0 7ffff6ec3000-7ffff6eca000 r-xp 00000000 fd:00 827899 /lib/x86_64-linux-gnu/librt-2.23.so 7ffff6eca000-7ffff70c9000 ---p 00007000 fd:00 827899 /lib/x86_64-linux-gnu/librt-2.23.so 7ffff70c9000-7ffff70ca000 r--p 00006000 fd:00 827899 /lib/x86_64-linux-gnu/librt-2.23.so 7ffff70ca000-7ffff70cb000 rw-p 00007000 fd:00 827899 /lib/x86_64-linux-gnu/librt-2.23.so 7ffff70cb000-7ffff70e3000 r-xp 00000000 fd:00 817470 /lib/x86_64-linux-gnu/libpthread-2.23.so 7ffff70e3000-7ffff72e2000 ---p 00018000 fd:00 817470 /lib/x86_64-linux-gnu/libpthread-2.23.so 7ffff72e2000-7ffff72e3000 r--p 00017000 fd:00 817470 /lib/x86_64-linux-gnu/libpthread-2.23.so 7ffff72e3000-7ffff72e4000 rw-p 00018000 fd:00 817470 /lib/x86_64-linux-gnu/libpthread-2.23.so 7ffff72e4000-7ffff72e8000 rw-p 00000000 00:00 0 7ffff72e8000-7ffff74a8000 r-xp 00000000 fd:00 817662 /lib/x86_64-linux-gnu/libc-2.23.so 7ffff74a8000-7ffff76a8000 ---p 001c0000 fd:00 817662 /lib/x86_64-linux-gnu/libc-2.23.so 7ffff76a8000-7ffff76ac000 r--p 001c0000 fd:00 817662 /lib/x86_64-linux-gnu/libc-2.23.so 7ffff76ac000-7ffff76ae000 rw-p 001c4000 fd:00 817662 /lib/x86_64-linux-gnu/libc-2.23.so 7ffff76ae000-7ffff76b2000 rw-p 00000000 00:00 0 7ffff76b2000-7ffff76b5000 r-xp 00000000 fd:00 817836 /lib/x86_64-linux-gnu/libdl-2.23.so 7ffff76b5000-7ffff78b4000 ---p 00003000 fd:00 817836 /lib/x86_64-linux-gnu/libdl-2.23.so 7ffff78b4000-7ffff78b5000 r--p 00002000 fd:00 817836 /lib/x86_64-linux-gnu/libdl-2.23.so 7ffff78b5000-7ffff78b6000 rw-p 00003000 fd:00 817836 /lib/x86_64-linux-gnu/libdl-2.23.so 7ffff78b6000-7ffff79be000 r-xp 00000000 fd:00 782001 /lib/x86_64-linux-gnu/libm-2.23.so 7ffff79be000-7ffff7bbd000 ---p 00108000 fd:00 782001 /lib/x86_64-linux-gnu/libm-2.23.so 7ffff7bbd000-7ffff7bbe000 r--p 00107000 fd:00 782001 /lib/x86_64-linux-gnu/libm-2.23.so 7ffff7bbe000-7ffff7bbf000 rw-p 00108000 fd:00 782001 /lib/x86_64-linux-gnu/libm-2.23.so 7ffff7bbf000-7ffff7bd6000 r-xp 00000000 fd:00 787702 /lib/x86_64-linux-gnu/libusb-1.0.so.0.1.0 7ffff7bd6000-7ffff7dd5000 ---p 00017000 fd:00 787702 /lib/x86_64-linux-gnu/libusb-1.0.so.0.1.0 7ffff7dd5000-7ffff7dd6000 r--p 00016000 fd:00 787702 /lib/x86_64-linux-gnu/libusb-1.0.so.0.1.0 7ffff7dd6000-7ffff7dd7000 rw-p 00017000 fd:00 787702 /lib/x86_64-linux-gnu/libusb-1.0.so.0.1.0 7ffff7dd7000-7ffff7dfd000 r-xp 00000000 fd:00 817247 /lib/x86_64-linux-gnu/ld-2.23.so 7ffff7fb5000-7ffff7fb9000 rw-p 00000000 00:00 0 7ffff7fb9000-7ffff7fd7000 r-xp 00000000 fd:00 787085 /lib/x86_64-linux-gnu/libudev.so.1.6.4 7ffff7fd7000-7ffff7fd8000 r--p 0001d000 fd:00 787085 /lib/x86_64-linux-gnu/libudev.so.1.6.4 7ffff7fd8000-7ffff7fd9000 rw-p 0001e000 fd:00 787085 /lib/x86_64-linux-gnu/libudev.so.1.6.4 7ffff7fd9000-7ffff7fdb000 rw-p 00000000 00:00 0 7ffff7ff7000-7ffff7ff8000 rw-p 00000000 00:00 0 7ffff7ff8000-7ffff7ffa000 r--p 00000000 00:00 0 [vvar] 7ffff7ffa000-7ffff7ffc000 r-xp 00000000 00:00 0 [vdso] 7ffff7ffc000-7ffff7ffd000 r--p 00025000 fd:00 817247 /lib/x86_64-linux-gnu/ld-2.23.so 7ffff7ffd000-7ffff7ffe000 rw-p 00026000 fd:00 817247 /lib/x86_64-linux-gnu/ld-2.23.so 7ffff7ffe000-7ffff7fff000 rw-p 00000000 00:00 0 7ffffffde000-7ffffffff000 rw-p 00000000 00:00 0 [stack] ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]

Thread 1 "openocd" received signal SIGABRT, Aborted. 0x00007ffff731d428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54 54 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory. (gdb) bt

0 0x00007ffff731d428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54

1 0x00007ffff731f02a in __GI_abort () at abort.c:89

2 0x00007ffff735f7ea in __libc_message (do_abort=do_abort@entry=2, fmt=fmt@entry=0x7ffff7478ed8 " Error in `%s': %s: 0x%s \n") at ../sysdeps/posix/libc_fatal.c:175

3 0x00007ffff736837a in malloc_printerr (ar_ptr=, ptr=, str=0x7ffff7478fa0 "double free or corruption (fasttop)", action=3) at malloc.c:5006

4 _int_free (av=, p=, have_lock=0) at malloc.c:3867

5 0x00007ffff736c53c in __GI___libc_free (mem=) at malloc.c:2968

6 0x0000000000556416 in Jim_Free (ptr=) at jim.c:653

7 Jim_FreeObj (interp=interp@entry=0x8e6050, objPtr=0x968980) at jim.c:2194

8 0x0000000000442120 in jim_target_wait_state (interp=0x8e6050, argc=, argv=) at src/target/target.c:5336

9 0x0000000000457b12 in command_unknown (interp=0x8e6050, argc=, argv=) at src/helper/command.c:1030

10 0x000000000055fec8 in JimInvokeCommand (interp=interp@entry=0x8e6050, objc=4, objv=objv@entry=0x7fffffffb9f0) at jim.c:10114

11 0x0000000000560a2c in Jim_EvalObj (interp=interp@entry=0x8e6050, scriptObjPtr=0x968b10) at jim.c:10565

12 0x0000000000565695 in Jim_EvalCoreCommand (interp=0x8e6050, argc=, argv=) at jim.c:12828

13 0x000000000055fec8 in JimInvokeCommand (interp=interp@entry=0x8e6050, objc=3, objv=objv@entry=0x7fffffffbb00) at jim.c:10114

14 0x0000000000560a2c in Jim_EvalObj (interp=interp@entry=0x8e6050, scriptObjPtr=0x926140) at jim.c:10565

15 0x0000000000560a8f in Jim_EvalObj (interp=interp@entry=0x8e6050, scriptObjPtr=0x9166c0) at jim.c:10498

16 0x000000000056bed8 in Jim_IfCoreCommand (interp=0x8e6050, argc=5, argv=0x7fffffffbd20) at jim.c:11978

17 0x000000000055fec8 in JimInvokeCommand (interp=interp@entry=0x8e6050, objc=5, objv=objv@entry=0x7fffffffbd20) at jim.c:10114

18 0x0000000000560a2c in Jim_EvalObj (interp=interp@entry=0x8e6050, scriptObjPtr=0x904d40) at jim.c:10565

19 0x000000000055fbbc in JimCallProcedure (interp=0x8e6050, cmd=0x914eb0, argc=5, argv=0x7fffffffbe90) at jim.c:10809

20 0x000000000055ff11 in JimInvokeCommand (interp=interp@entry=0x8e6050, objc=5, objv=objv@entry=0x7fffffffbe90) at jim.c:10110

21 0x0000000000560a2c in Jim_EvalObj (interp=interp@entry=0x8e6050, scriptObjPtr=0x9680c0) at jim.c:10565

22 0x0000000000565695 in Jim_EvalCoreCommand (interp=0x8e6050, argc=, argv=) at jim.c:12828

23 0x000000000055fec8 in JimInvokeCommand (interp=interp@entry=0x8e6050, objc=4, objv=objv@entry=0x7fffffffbfa0) at jim.c:10114

24 0x0000000000560a2c in Jim_EvalObj (interp=interp@entry=0x8e6050, scriptObjPtr=0x93f070) at jim.c:10565

25 0x000000000055fbbc in JimCallProcedure (interp=0x8e6050, cmd=0x9417d0, argc=4, argv=0x7fffffffc110) at jim.c:10809

26 0x000000000055ff11 in JimInvokeCommand (interp=interp@entry=0x8e6050, objc=4, objv=objv@entry=0x7fffffffc110) at jim.c:10110

27 0x0000000000560a2c in Jim_EvalObj (interp=interp@entry=0x8e6050, scriptObjPtr=0x966e10) at jim.c:10565

28 0x0000000000564cbd in Jim_CatchCoreCommand (interp=0x8e6050, argc=1, argv=0x7fffffffc288) at jim.c:13821

29 0x000000000055fec8 in JimInvokeCommand (interp=interp@entry=0x8e6050, objc=2, objv=objv@entry=0x7fffffffc280) at jim.c:10114

30 0x0000000000560a2c in Jim_EvalObj (interp=interp@entry=0x8e6050, scriptObjPtr=scriptObjPtr@entry=0x9cf720) at jim.c:10565

31 0x00000000005664b4 in JimForeachMapHelper (interp=, argc=, argv=, doMap=0) at jim.c:11886

32 0x000000000055fec8 in JimInvokeCommand (interp=interp@entry=0x8e6050, objc=4, objv=objv@entry=0x7fffffffc430) at jim.c:10114

33 0x0000000000560a2c in Jim_EvalObj (interp=interp@entry=0x8e6050, scriptObjPtr=0x976f10) at jim.c:10565

34 0x000000000056bed8 in Jim_IfCoreCommand (interp=0x8e6050, argc=3, argv=0x7fffffffc590) at jim.c:11978

35 0x000000000055fec8 in JimInvokeCommand (interp=interp@entry=0x8e6050, objc=3, objv=objv@entry=0x7fffffffc590) at jim.c:10114

36 0x0000000000560a2c in Jim_EvalObj (interp=interp@entry=0x8e6050, scriptObjPtr=0x91e7c0) at jim.c:10565

37 0x000000000055fbbc in JimCallProcedure (interp=0x8e6050, cmd=0x924350, argc=2, argv=0x7fffffffc700) at jim.c:10809

38 0x000000000055ff11 in JimInvokeCommand (interp=interp@entry=0x8e6050, objc=2, objv=objv@entry=0x7fffffffc700) at jim.c:10110

39 0x0000000000560a2c in Jim_EvalObj (interp=interp@entry=0x8e6050, scriptObjPtr=0x975560) at jim.c:10565

40 0x0000000000564cbd in Jim_CatchCoreCommand (interp=0x8e6050, argc=2, argv=0x7fffffffc878) at jim.c:13821

41 0x000000000055fec8 in JimInvokeCommand (interp=interp@entry=0x8e6050, objc=3, objv=objv@entry=0x7fffffffc870) at jim.c:10114

42 0x0000000000560a2c in Jim_EvalObj (interp=interp@entry=0x8e6050, scriptObjPtr=0x9752e0) at jim.c:10565

43 0x0000000000562398 in JimSubstOneToken (token=0x975290, token=0x975290, objPtrPtr=0x7fffffffc930, interp=0x8e6050) at jim.c:10219

44 JimInterpolateTokens (interp=interp@entry=0x8e6050, token=token@entry=0x975290, tokens=2, flags=flags@entry=0) at jim.c:10267

45 0x0000000000560b36 in Jim_EvalObj (interp=interp@entry=0x8e6050, scriptObjPtr=0x975870) at jim.c:10510

46 0x0000000000560a8f in Jim_EvalObj (interp=interp@entry=0x8e6050, scriptObjPtr=0x91e470) at jim.c:10498

47 0x000000000055fbbc in JimCallProcedure (interp=0x8e6050, cmd=0x924200, argc=2, argv=0x7fffffffcc20) at jim.c:10809

48 0x000000000055ff11 in JimInvokeCommand (interp=interp@entry=0x8e6050, objc=2, objv=objv@entry=0x7fffffffcc20) at jim.c:10110

49 0x0000000000560a2c in Jim_EvalObj (interp=0x8e6050, scriptObjPtr=0x9ca9e0) at jim.c:10565

50 0x00000000005628ca in Jim_Eval (interp=, script=script@entry=0x7fffffffccb0 "ocd_process_reset halt") at jim.c:10890

51 0x000000000043e98d in target_process_reset (cmd_ctx=0x9659e0, reset_mode=RESET_HALT) at src/target/target.c:661

52 handle_reset_command (cmd=) at src/target/target.c:3069

53 0x00000000004578ff in run_command (num_words=2, words=0x9c9ea0, c=0x945090, context=0x9659e0) at src/helper/command.c:623

54 script_command_run (interp=0x8e6050, argc=, argv=, c=0x945090, capture=) at src/helper/command.c:208

55 0x000000000055fec8 in JimInvokeCommand (interp=interp@entry=0x8e6050, objc=2, objv=objv@entry=0x7fffffffce40) at jim.c:10114

56 0x0000000000560a2c in Jim_EvalObj (interp=interp@entry=0x8e6050, scriptObjPtr=0x964f40) at jim.c:10565

57 0x0000000000565695 in Jim_EvalCoreCommand (interp=0x8e6050, argc=, argv=) at jim.c:12828

58 0x000000000055fec8 in JimInvokeCommand (interp=interp@entry=0x8e6050, objc=3, objv=objv@entry=0x7fffffffcf50) at jim.c:10114

59 0x0000000000560a2c in Jim_EvalObj (interp=interp@entry=0x8e6050, scriptObjPtr=0x917fe0) at jim.c:10565

60 0x0000000000564cbd in Jim_CatchCoreCommand (interp=0x8e6050, argc=1, argv=0x7fffffffd0c8) at jim.c:13821

61 0x000000000055fec8 in JimInvokeCommand (interp=interp@entry=0x8e6050, objc=2, objv=objv@entry=0x7fffffffd0c0) at jim.c:10114

62 0x0000000000560a2c in Jim_EvalObj (interp=interp@entry=0x8e6050, scriptObjPtr=0x917b90) at jim.c:10565

63 0x0000000000560a8f in Jim_EvalObj (interp=interp@entry=0x8e6050, scriptObjPtr=0x917120) at jim.c:10498

64 0x000000000056bed8 in Jim_IfCoreCommand (interp=0x8e6050, argc=5, argv=0x7fffffffd2e0) at jim.c:11978

65 0x000000000055fec8 in JimInvokeCommand (interp=interp@entry=0x8e6050, objc=5, objv=objv@entry=0x7fffffffd2e0) at jim.c:10114

66 0x0000000000560a2c in Jim_EvalObj (interp=interp@entry=0x8e6050, scriptObjPtr=0x9167b0) at jim.c:10565

67 0x000000000056bf2c in Jim_IfCoreCommand (interp=0x8e6050, argc=5, argv=0x7fffffffd440) at jim.c:11989

68 0x000000000055fec8 in JimInvokeCommand (interp=interp@entry=0x8e6050, objc=5, objv=objv@entry=0x7fffffffd440) at jim.c:10114

69 0x0000000000560a2c in Jim_EvalObj (interp=interp@entry=0x8e6050, scriptObjPtr=0x904d40) at jim.c:10565

70 0x000000000055fbbc in JimCallProcedure (interp=0x8e6050, cmd=0x914eb0, argc=3, argv=0x7fffffffd5b0) at jim.c:10809

71 0x000000000055ff11 in JimInvokeCommand (interp=interp@entry=0x8e6050, objc=3, objv=objv@entry=0x7fffffffd5b0) at jim.c:10110

72 0x0000000000560a2c in Jim_EvalObj (interp=interp@entry=0x8e6050, scriptObjPtr=0x9caa30) at jim.c:10565

73 0x0000000000565695 in Jim_EvalCoreCommand (interp=0x8e6050, argc=, argv=) at jim.c:12828

74 0x000000000055fec8 in JimInvokeCommand (interp=interp@entry=0x8e6050, objc=4, objv=objv@entry=0x7fffffffd6c0) at jim.c:10114

75 0x0000000000560a2c in Jim_EvalObj (interp=interp@entry=0x8e6050, scriptObjPtr=0x930ba0) at jim.c:10565

76 0x000000000055fbbc in JimCallProcedure (interp=0x8e6050, cmd=0x945490, argc=2, argv=0x7fffffffd830) at jim.c:10809

77 0x000000000055ff11 in JimInvokeCommand (interp=interp@entry=0x8e6050, objc=2, objv=objv@entry=0x7fffffffd830) at jim.c:10110

78 0x0000000000560a2c in Jim_EvalObj (interp=interp@entry=0x8e6050, scriptObjPtr=scriptObjPtr@entry=0x91beb0) at jim.c:10565

79 0x00000000005628ab in Jim_EvalSource (interp=interp@entry=0x8e6050, filename=filename@entry=0x0, lineno=lineno@entry=0, script=script@entry=0x932d50 "reset halt") at jim.c:10882

80 0x0000000000457537 in command_run_line (context=context@entry=0x9659e0, line=line@entry=0x932d50 "reset halt") at src/helper/command.c:672

81 0x000000000044d0b9 in gdb_query_packet (connection=connection@entry=0x93b3f0, packet_size=packet_size@entry=26, packet=0x89db80 "qRcmd,72657365742068616c74") at src/server/gdb_server.c:2529

82 0x000000000044e75b in gdb_input_inner (connection=) at src/server/gdb_server.c:3170

83 gdb_input (connection=) at src/server/gdb_server.c:3364

84 0x00000000004511d2 in server_loop (command_context=command_context@entry=0x8e6010) at src/server/server.c:533

85 0x0000000000405b9c in openocd_thread (cmd_ctx=0x8e6010, argv=0x7fffffffde48, argc=) at src/openocd.c:341

86 openocd_main (argc=, argv=0x7fffffffde48) at src/openocd.c:378

87 0x00007ffff7308830 in __libc_start_main (main=0x405470
, argc=5, argv=0x7fffffffde48, init=, fini=, rtld_fini=, stack_end=0x7fffffffde38) at ../csu/libc-start.c:291

88 0x0000000000405569 in _start ()

ilg-ul commented 6 years ago

Open On-Chip Debugger 0.10.0+dev-dirty (2018-06-01-19:51)

where did you get this version?

ilg-ul commented 5 years ago

could you retry with the latest release (-10)? I removed most of the risc-v code, now it should not differ from the upstream version.

j123b567 commented 5 years ago

I will try this with Linux and Windows version within few days.

bureaua commented 5 years ago

I can confirm that this issue is present by using gnu-mcu-eclipse-openocd-0.10.0-10-20181020-0522-centos64.tgz

$ /opt/openocd/bin/openocd -f /opt/openocd/scripts/interface/stlink-v2-1.cfg -c 'transport select hla_swd' -c 'hla_serial 0676FF574953867567204520' -f /opt/openocd/scripts/target/stm32f7x.cfg -c init -c 'reset halt' -c 'program application.hex verify reset' -c exit
GNU MCU Eclipse 64-bit Open On-Chip Debugger 0.10.0+dev-00352-gaa6c7e9b (2018-10-20-06:18)
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
WARNING: interface/stlink-v2-1.cfg is deprecated, please switch to interface/stlink.cfg
hla_swd
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 2000 kHz
adapter_nsrst_delay: 100
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : clock speed 1800 kHz
Info : STLINK v2 JTAG v28 API v2 SWIM v18 VID 0x0483 PID 0x374B
Info : using stlink api v2
Info : Target voltage: 3.232941
Info : stm32f7x.cpu: hardware has 8 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
Error: timed out while waiting for target halted
*** Error in `/opt/openocd/bin/openocd': double free or corruption (fasttop): 0x000000000154f980 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7fd6b0f727e5]
/lib/x86_64-linux-gnu/libc.so.6(+0x8037a)[0x7fd6b0f7b37a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7fd6b0f7f53c]
/opt/openocd/bin/openocd[0x596136]
======= Memory map: ========
003ff000-00400000 rw-p 00000000 08:09 663697                             /opt/openocd/bin/openocd
00400000-006e3000 r-xp 00001000 08:09 663697                             /opt/openocd/bin/openocd
008e2000-008e3000 r--p 002e3000 08:09 663697                             /opt/openocd/bin/openocd
008e3000-008f9000 rw-p 002e4000 08:09 663697                             /opt/openocd/bin/openocd
008f9000-0097b000 rw-p 00000000 00:00 0 
013dc000-01671000 rw-p 00000000 00:00 0                                  [heap]
7fd6ac000000-7fd6ac021000 rw-p 00000000 00:00 0 
7fd6ac021000-7fd6b0000000 ---p 00000000 00:00 0 
7fd6b04e4000-7fd6b04fa000 r-xp 00000000 08:09 529319                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7fd6b04fa000-7fd6b06f9000 ---p 00016000 08:09 529319                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7fd6b06f9000-7fd6b06fa000 rw-p 00015000 08:09 529319                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7fd6b06fa000-7fd6b06fb000 ---p 00000000 00:00 0 
7fd6b06fb000-7fd6b0efb000 rw-p 00000000 00:00 0 
7fd6b0efb000-7fd6b10bb000 r-xp 00000000 08:09 524373                     /lib/x86_64-linux-gnu/libc-2.23.so
7fd6b10bb000-7fd6b12bb000 ---p 001c0000 08:09 524373                     /lib/x86_64-linux-gnu/libc-2.23.so
7fd6b12bb000-7fd6b12bf000 r--p 001c0000 08:09 524373                     /lib/x86_64-linux-gnu/libc-2.23.so
7fd6b12bf000-7fd6b12c1000 rw-p 001c4000 08:09 524373                     /lib/x86_64-linux-gnu/libc-2.23.so
7fd6b12c1000-7fd6b12c5000 rw-p 00000000 00:00 0 
7fd6b12c5000-7fd6b12d1000 r-xp 00000000 08:09 663698                     /opt/openocd/bin/libudev.so.0.5.1
7fd6b12d1000-7fd6b14d1000 ---p 0000c000 08:09 663698                     /opt/openocd/bin/libudev.so.0.5.1
7fd6b14d1000-7fd6b14d2000 r--p 0000c000 08:09 663698                     /opt/openocd/bin/libudev.so.0.5.1
7fd6b14d2000-7fd6b14d3000 rw-p 0000d000 08:09 663698                     /opt/openocd/bin/libudev.so.0.5.1
7fd6b14d3000-7fd6b14da000 r-xp 00000000 08:09 529149                     /lib/x86_64-linux-gnu/librt-2.23.so
7fd6b14da000-7fd6b16d9000 ---p 00007000 08:09 529149                     /lib/x86_64-linux-gnu/librt-2.23.so
7fd6b16d9000-7fd6b16da000 r--p 00006000 08:09 529149                     /lib/x86_64-linux-gnu/librt-2.23.so
7fd6b16da000-7fd6b16db000 rw-p 00007000 08:09 529149                     /lib/x86_64-linux-gnu/librt-2.23.so
7fd6b16db000-7fd6b16f3000 r-xp 00000000 08:09 524372                     /lib/x86_64-linux-gnu/libpthread-2.23.so
7fd6b16f3000-7fd6b18f2000 ---p 00018000 08:09 524372                     /lib/x86_64-linux-gnu/libpthread-2.23.so
7fd6b18f2000-7fd6b18f3000 r--p 00017000 08:09 524372                     /lib/x86_64-linux-gnu/libpthread-2.23.so
7fd6b18f3000-7fd6b18f4000 rw-p 00018000 08:09 524372                     /lib/x86_64-linux-gnu/libpthread-2.23.so
7fd6b18f4000-7fd6b18f8000 rw-p 00000000 00:00 0 
7fd6b18f8000-7fd6b18fb000 r-xp 00000000 08:09 524375                     /lib/x86_64-linux-gnu/libdl-2.23.so
7fd6b18fb000-7fd6b1afa000 ---p 00003000 08:09 524375                     /lib/x86_64-linux-gnu/libdl-2.23.so
7fd6b1afa000-7fd6b1afb000 r--p 00002000 08:09 524375                     /lib/x86_64-linux-gnu/libdl-2.23.so
7fd6b1afb000-7fd6b1afc000 rw-p 00003000 08:09 524375                     /lib/x86_64-linux-gnu/libdl-2.23.so
7fd6b1afc000-7fd6b1c04000 r-xp 00000000 08:09 524303                     /lib/x86_64-linux-gnu/libm-2.23.so
7fd6b1c04000-7fd6b1e03000 ---p 00108000 08:09 524303                     /lib/x86_64-linux-gnu/libm-2.23.so
7fd6b1e03000-7fd6b1e04000 r--p 00107000 08:09 524303                     /lib/x86_64-linux-gnu/libm-2.23.so
7fd6b1e04000-7fd6b1e05000 rw-p 00108000 08:09 524303                     /lib/x86_64-linux-gnu/libm-2.23.so
7fd6b1e05000-7fd6b1e2b000 r-xp 00000000 08:09 524314                     /lib/x86_64-linux-gnu/ld-2.23.so
7fd6b2002000-7fd6b2007000 rw-p 00000000 00:00 0 
7fd6b2029000-7fd6b202a000 rw-p 00000000 00:00 0 
7fd6b202a000-7fd6b202b000 r--p 00025000 08:09 524314                     /lib/x86_64-linux-gnu/ld-2.23.so
7fd6b202b000-7fd6b202c000 rw-p 00026000 08:09 524314                     /lib/x86_64-linux-gnu/ld-2.23.so
7fd6b202c000-7fd6b202d000 rw-p 00000000 00:00 0 
7ffe48ea6000-7ffe48ec7000 rw-p 00000000 00:00 0                          [stack]
7ffe48fcf000-7ffe48fd2000 r--p 00000000 00:00 0                          [vvar]
7ffe48fd2000-7ffe48fd4000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
Aborted (core dumped)
ilg-ul commented 5 years ago

I just published a new release; I updated to the latest master and removed all RISC-V patches.

Can you test it and confirm that the problem was solved?

bureaua commented 5 years ago

I just published a new release; I updated to the latest master and removed all RISC-V patches.

Can you test it and confirm that the problem was solved?

It looks like it works now

ilg-ul commented 5 years ago

It looks like it works now

Great, thank you!

@j123b567 Jan, can you also confirm that the problem was solved, and close the ticket?

rafacouto commented 5 years ago

I am suffering this behaviour in "0.10.0+dev-00392-gbe9ef0b0", the current version provided by platformio.org.

@ilg-ul Which tag or commit have you applied the patch?

ilg-ul commented 5 years ago

Which tag or commit have you applied the patch?

in the latest release I removed all RISC-V patches, it is mostly the master repacked.

the details of the builds can be seen in:

https://github.com/gnu-mcu-eclipse/openocd-build/blob/master/scripts/container-build.sh

rafacouto commented 5 years ago

False alarm: uC is damaged and OpenOCD binary dumps, but this is another story... Ignore my comment since it is not related to this issue... Thanks anyway :-)

ilg-ul commented 5 years ago

I just released 0.10.0-12, with the latest upstream master.

Please check if the problem was solved. If not, reopen the ticket.