I am debugging a large application and I would like to break before a certain string is written to std::cerr. I there a way to do this?
There are many places in the code where this string is written.
The string is not always of the form
std::cerr << "some error code";
It might be of other forms such as
std::cerr << write_error_code();
Also note that there are many things being written to std::cerr so I can’t just break on std::cerr.
I also have the same question but for std::cout but I will post another question if the answer does not apply to that as well.
This is a С++ example I have made on Linux. The example has been built with gcc 4.3.
I took a look at disassemble and saw that
std::cerr << ""is a function with the symbol name_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.The function has 2 args:
__outand__s.So I created a
.gdbinitfile:And here I test my program: