Erwan
Erwan

Reputation: 61

how to export all the files path from the debug symbols

I'm using GCC -g to compile.

In GDB, I use "info sources" to list all the files path (c, cpp, h, etc..)

Now I want to export this result to a file.

One solution was to turn on GDB logging with "set logging on" but it's not exactly what I want:

Edit

One solution could be:

#!/bin/sh
gdb -batch -ex "info sources" the_executable > /tmp/list_sources.txt
sed -i -e 's/, /\r\n/g' /tmp/list_sources.txt
grep -e '^\/' /tmp/list_sources.txt > list_sources.txt

Upvotes: 0

Views: 308

Answers (1)

David Ranieri
David Ranieri

Reputation: 41017

You can run gdb in batch mode:

gdb -batch -ex "info sources" your_program > info_sources.txt

Upvotes: 1

Related Questions