So I am trying to gdb a huge running process. I want to know the exact place where a certain file xyz gets edited by it. Is there a way I can add a breakpoint at the exact line where file write (just for that particular file) happens ?
Asked
Active
Viewed 82 times
0
-
Do you mean that a file is being opened and edited by `open(2)`, `write(2)` in the program that you are inspecting? – Ehtesh Choudhury Oct 10 '13 at 04:59
-
This may be related: http://stackoverflow.com/questions/5863115/gdb-break-when-program-opens-specific-file – Simon Oct 10 '13 at 05:00
-
@Shurane I don't know for sure. – Proteen Oct 10 '13 at 05:16
-
Wow, that is an awesome Q&A combination there, @Simon. – Ehtesh Choudhury Oct 10 '13 at 05:18
-
@Simon I guess that's what I need eventually, but it won't serve my purpose, thanks anyways – Proteen Oct 10 '13 at 05:18
-
1if you are on linux you could find the FD via /proc/
/fd/ and then set a conditional breakpoint in on the write() function to let it break on the exact file. not sure if this matches your purpose? – tristan Oct 10 '13 at 14:30