AnsweredAssumed Answered

Can openocd read call stack and local variable correct on i.mx6?Help

Question asked by jesse stone on Jan 8, 2016
Latest reply on Feb 23, 2016 by jesse stone

//debug source section

static void pl2303_gpio_set(struct gpio_chip *chip, unsigned offset, int value)


  struct pl2303_gpio *gpio = to_pl2303_gpio(chip);

  struct pl2303_gpio_desc *desc;



  desc = gpio->descs + offset;

  if (value) //--->break here

  gpio->data[desc->value_offset] |= desc->value_mask;


  gpio->data[desc->value_offset] &= ~desc->value_mask;


  pl2303_vendor_write(desc->value_ctrl, gpio->data[desc->value_offset], gpio->serial);







(gdb) target remote localhost:3333

(gdb) symbol-file /root/project_board/free_imx/out/matrix_io/kernel/vmlinux

(gdb) mon halt

(gdb) break /root/project_board/free_imx/myandroid/kernel_imx/drivers/usb/serial/pl2303.c:297

(gdb) continue

Breakpoint 1, pl2303_gpio_set (chip=0x800719bc, offset=3159793204, value=-2114730436)

  at /root/project_board/free_imx/myandroid/kernel_imx/drivers/usb/serial/pl2303.c:297

297 if (value)

(gdb) p value

$7 = -2114730436


Breakpoint 1, pl2303_vendor_write (value=65535, index=65535, serial=0x0)

  at /root/project_board/free_imx/myandroid/kernel_imx/drivers/usb/serial/pl2303.c:218

218 return res;

(gdb) p &index

$1 = (__u16 *) 0xbccb9d9c

(gdb) p &value

$2 = (__u16 *) 0xbccb9d9e

(gdb) p &res

$3 = (int *) 0xbccb9dac



Picasa Web Albums - Jesse Stone - i.mx6 -A


(gdb) target remote /dev/ttyUSB0

Remote debugging using /dev/ttyUSB0

kgdb_breakpoint ()

  at /root/project_board/free_imx/myandroid/kernel_imx/kernel/debug/debug_core.c:1025

1025 arch_kgdb_breakpoint();

(gdb) break /root/project_board/free_imx/myandroid/kernel_imx/drivers/usb/serial/pl2303.c:297

Breakpoint 1 at 0x8075bfd0: file /root/project_board/free_imx/myandroid/kernel_imx/drivers/usb/serial/pl2303.c, line 297.

(gdb) continue


Breakpoint 1, pl2303_gpio_set (chip=0xbc5e99e4, offset=0, value=0)

  at /root/project_board/free_imx/myandroid/kernel_imx/drivers/usb/serial/pl2303.c:297

(gdb) p value

$1 = 0


Breakpoint 1, pl2303_vendor_write (value=1, index=48, serial=0xbc5d7980)

  at /root/project_board/free_imx/myandroid/kernel_imx/drivers/usb/serial/pl2303.c:218

218 return res;

(gdb) p &index

$10 = (__u16 *) 0xbccb9d9c

(gdb) p &value

$11 = (__u16 *) 0xbccb9d9e

(gdb) p &res

$12 = (int *) 0xbccb9dac
Picasa Web Albums - Jesse Stone - i.mx6  -B

value = 0 is correct on kgdb

openocd and kgdb symbol address are the same


openocd global variable is good, only local variable is wrong. can fixed it?


and call stack jsut can see 2 or 3 layer.

kgdb can read all struct variable and call stacks

can make openocd like kgdb?


bug similar as this but not sure~~~how to fix openocd


here is a way debug openocd with eclipse

c/c++ application: /root/openocd-0.9.0/src/openocd

arguments: -f /opt/openocd/share/openocd/scripts/interface/ftdi/dp_busblaster.cfg -f /opt/openocd/share/openocd/scripts/target/imx6.cfg

Picasa Web Albums - Jesse Stone - i.mx6- C

i compare global and local variable in openocd

static int gdb_read_memory_packet(struct connection *connection, char const *packet, int packet_size)






into cortex_a_read_phys_memory


get value is wrong on local variable


any idea for me?