This is what is expected I guess. With "echo g > /proc/sysrq-trigger"
you are triggering a kernel panic. You should have connected the
target to gdb before a kernel panic. Try connecting the target to gdb
and then trigger kernel panic.
Hope this helps,
PrasannaKumar