Reputation: 24160
Is there any GDB command to get executable file path? Currently it shows
Core was generated by ./a.bin
But I don't want to grep the result. Is there a way to get generated path using GDB command.
Upvotes: 2
Views: 1644
Reputation: 213859
Core was generated by ./a.bin
Please note that most OSes have a rather short limit on the length of the executable path that can be recorded in the NT_PRPSINFO
ELF note (on Linux, this is limited to 16 characters).
Is there a way to get generated path using GDB command.
I don't believe so.
It is quite simple to write a program to find PT_NOTE
segment in the core
, then decode (variable sized) ELF notes, until you find the NT_PRPSINFO
note, and then you can print the pf_fname
member of struct prpsinfo
.
But given that the info there may be truncated, it's not clear why you'd want to write such a program.
Upvotes: 3