# Revision history [back]

### How to debug a gazebo model plugin with setting breaktpoints and the drcsim run_gzserver_gdb script?

Hello,

I am quite new to gazebo and I would like to debug my gazebo plugin with breakpoints.
I found a few questions here that do point out a similar problem.

Some of the answers included the run_gzserver_gdb script of the drcSim. I copied the related drcSim scripts and only changed the package to my own. I did not modify the actual gdbrun script.

When I run my project with these scripts the server just starts running and I can only interact with gdb once my project has crashed.

#!/bin/bash
#gdbrun of drcSim
extra_text=""

if [ "$1" == "--break-main" ]; then extra_text="break main" shift fi EXEC="$1"
shift

run_text="run"
for a in "$@"; do run_text="${run_text} \"$a\"" done TMPFILE=/tmp/gdbrun.$$.#.tmp cat > {TMPFILE} <<EOF {extra_text} {run_text} EOF gdb -x {TMPFILE} "{EXEC}" rm -f "{TMPFILE}"  I get that the problem is somewhere along these lines: run_text="run" for a in "@"; do run_text="{run_text} \"a\"" done TMPFILE=/tmp/gdbrun.$$.$#.tmp
cat > ${TMPFILE} <<EOF${extra_text}
\${run_text}
EOF


The problem is that the gazebo sever is run directly since the temp file will only create a run confguration:

run  (gzserver and configuration args I pass to gzserver)


If I try running this by hand and add breackpoints the server does not start properly and shuts down after 30 seconds.

• How do I have to modify the script so I can set breackpoints?
• If it is not possible to use these scripts how could I possibly debug my plugin with gdb and breakpoints?

Regards