Getting gdb to automatically download a binary file from the main file

Can I get gdb to automatically download the binary specified in the main file?

Given the main file that I usually do now:

gdb -c corefile
GNU gdb 6.8
...
Core was generated by `/path/to/binary'

Then copy-paste and run:

gdb -c corefile /path/to/binary

This seems like an unnecessary two-step process, but I don't see an obvious way to do this based on the man page. Did I miss something?

+5
source share
2 answers

Could you just script it?

#!/bin/bash
gdb "`file "$1" | awk -F \' '{print $2}'`" "$1"
+4
source

This is what I usually do:

var=$(file corefile)
echo ${var##*from}
0
source

All Articles