conditional-breakpoint

Watch a memory location/install 'data breakpoint' from code?

旧街凉风 提交于 2019-11-28 08:38:00
问题 We have a memory overwrite problem. At some point, during the course of our program, a memory location is being overwritten and causing our program to crash. the problem happens only in release mode. when in debug, all is well. that is a classic C/C++ bug, and a very hard one to locate. I wondered if there's a way to add some 'debugging code' that will watch this memory location and will call a callback once its changed. This is basically what a debugger could do in debug mode (a 'data

how can I put a breakpoint on “something is printed to the terminal” in gdb?

蓝咒 提交于 2019-11-28 06:49:51
I would like to know from where inside a huge application a certain message is printed. The application is so big and old that it uses all conceivable ways of printing text to the terminal; for example printf(), fprintf(stdout, ...) etc. I write to put a breakpoint on the write() system call but then I'm flooded with too many breakpoint stops because of various file I/O operations that use write() as well. So basically I want gdb to stop whenever the program prints something to the terminal but at the same time I don't want gdb to stop when the program writes something to a file. Use a

how to create conditional breakpoint with std::string

孤街醉人 提交于 2019-11-28 03:38:38
Suppose I have this function: std::string Func1(std::string myString) { //do some string processing std::string newString = Func2(myString) return newString; } how do I set a conditional break when newString has a specific value ? (without changing the source) setting a condition newString == "my value" didn't work the breakpoints got disabled with an error "overloaded operator not found" Some searching has failed to turn up any way to do this. Suggested alternatives are to put the test in your code and add a standard breakpoint: if (myStr == "xyz") { // Set breakpoint here } Or to build up

Can I set a breakpoint when variable is getting a specific value in .NET?

 ̄綄美尐妖づ 提交于 2019-11-27 18:43:25
I am using Visual Studio 2010, and I know this feature is available in C++. I need to debug some code, that changes a variable to several values. I want to debug the code in a specific case, when the variable getting a specific value. I know I can add if(var == value) , but is there any elegant way to do it? Another question, can I set a breakpoint when a variable is changed in general? JaredPar It is certainly possible to set a condition like a variable receiving a certain value. This is known as a breakpoint condition. To create one, do the following. Set a break point at the point the

How do I set a conditional breakpoint in gdb, when char* x points to a string whose value equals “hello”?

无人久伴 提交于 2019-11-27 16:42:43
Can I specify that I want gdb to break at line x when char* x points to a string whose value equals "hello" ? If yes, how? Nathan Fellman You can use strcmp : break x:20 if strcmp(y, "hello") == 0 20 is line number, x can be any filename and y can be any variable. Tobias Domhan break x if ((int)strcmp(y, "hello")) == 0 On some implementations gdb might not know the return type of strcmp. That means you would have to cast, otherwise it would always evaluate to true! Since GDB 7.5 you can use these handy Convenience Functions : $_memeq(buf1, buf2, length)` $_streq(str1, str2) $_strlen(str) $

Error when using a conditional breakpoint on System.Type

删除回忆录丶 提交于 2019-11-27 13:27:46
This is the function: public void Init(System.Type Type) { this.Type = Type; BuildFieldAttributes(); BuildDataColumns(FieldAttributes); } I've set a breakpoint on the first line ( this.Type = Type ) and I want to break when Type.FullName == "Malt.Organisation" so that's what I've entered in as the condition. However the following error is displayed when the line is hit: The condition for a breakpoint failed to execute. The condition was 'Type.FullName == "Malt.Organisation"'. The error returned was 'Inspecting the state of an object in the debuggee of type System.Type is not supported in this

how to create conditional breakpoint with std::string

纵饮孤独 提交于 2019-11-27 05:10:22
问题 Suppose I have this function: std::string Func1(std::string myString) { //do some string processing std::string newString = Func2(myString) return newString; } how do I set a conditional break when newString has a specific value ? (without changing the source) setting a condition newString == "my value" didn't work the breakpoints got disabled with an error "overloaded operator not found" 回答1: Some searching has failed to turn up any way to do this. Suggested alternatives are to put the test

how can I put a breakpoint on “something is printed to the terminal” in gdb?

耗尽温柔 提交于 2019-11-27 01:31:18
问题 I would like to know from where inside a huge application a certain message is printed. The application is so big and old that it uses all conceivable ways of printing text to the terminal; for example printf(), fprintf(stdout, ...) etc. I write to put a breakpoint on the write() system call but then I'm flooded with too many breakpoint stops because of various file I/O operations that use write() as well. So basically I want gdb to stop whenever the program prints something to the terminal

Can I set a breakpoint when variable is getting a specific value in .NET?

瘦欲@ 提交于 2019-11-26 22:42:55
问题 I am using Visual Studio 2010, and I know this feature is available in C++. I need to debug some code, that changes a variable to several values. I want to debug the code in a specific case, when the variable getting a specific value. I know I can add if(var == value) , but is there any elegant way to do it? Another question, can I set a breakpoint when a variable is changed in general? 回答1: It is certainly possible to set a condition like a variable receiving a certain value. This is known

How do I set a conditional breakpoint in gdb, when char* x points to a string whose value equals “hello”?

China☆狼群 提交于 2019-11-26 18:44:04
问题 Can I specify that I want gdb to break at line x when char* x points to a string whose value equals "hello" ? If yes, how? 回答1: You can use strcmp : break x:20 if strcmp(y, "hello") == 0 20 is line number, x can be any filename and y can be any variable. 回答2: break x if ((int)strcmp(y, "hello")) == 0 On some implementations gdb might not know the return type of strcmp. That means you would have to cast, otherwise it would always evaluate to true! 回答3: Since GDB 7.5 you can use these handy