71GA
71GA

Reputation: 1391

Weird binary signs when using pipe

I am using this script to compile my program and to debug it on my embedded board:

#!/bin/bash

# Recompile:
make clean
make

# Erase memmory and upload the program:
{ echo 'connect';
  echo '';
  echo '';
  echo '';
  echo '';
  echo 'erase';
  echo 'loadbin program.bin , 0x0';
  echo 'r';
  echo 'q'; } | JLinkExe

# Kill any JLinkExeGDBServer:
killall JLinkGDBServer

# Set up the GDB server and connect with GDB:
JLinkGDBServer -device LPC4088 & sleep 2s && \
{ echo 'dashboard -layout source';
  echo 'dashboard source -style context 14';
  echo 'file program.elf';
  echo 'target remote :2331';
  echo 'monitor reset';
  cat; } | arm-none-eabi-gdb

After I run this script all of the commands are executed just fine, but there are some kind of binary signs in GDB (screenshot) and it looks like autocomplete in GDB isn't working at all. Furthermore, some of the GDB commands are totaly broken. If I use only arm-none-eabi-gdb without supplying it the commands through a pipe | GDB again works fine.

But I need to pass those commands...

I am using ~/.gdbinit from GDB Dashboard but even if I remove it problem persists.

enter image description here

Upvotes: 0

Views: 58

Answers (1)

Pat Gunn
Pat Gunn

Reputation: 36

When you invoke gdb this way, it's not directly connected to your terminal. You probably should instead look into starting gdb using a commandfile instead - if you put those commands into a file called, say, "myscript" and then invoke gdb with --command=myscript

that should get the setup you want done in the right way.

Upvotes: 2

Related Questions