非本地类型上具有多个条件的GDB断点 [英] GDB breakpoints with multiple conditions on non-native types

查看:52
本文介绍了非本地类型上具有多个条件的GDB断点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在调试一个C/C ++程序,我想在其中设置一个断点,条件取决于多个变量.

I'm debugging a C/C++ program where I want to set a single break point with a condition depending on multiple variables.

如果(bar == 3&& i == 5)则破坏foo.cpp:60

break foo.cpp:60 if (bar == 3 && i == 5)

这似乎不起作用,因为它在击中foo.cpp:60时就会停止,而不是在两个条件都匹配时停止(甚至不匹配其中一个条件).有没有一种简单的方法可以实现我想要实现的目标?

This doesn't seem to work, as it stops whenever it hits foo.cpp:60 instead of whenever both of the conditions match (it doesn't even match one of the conditions). Is there an easy way to do what I'm trying to achieve?

编辑:bar和i不是本机C类型,它们是强类型的.

Edit: bar and i are not native C types, they are strongly typed.

如果((A)bar == 3&&(B)i == 5)破坏foo.cpp:60

break foo.cpp:60 if ((A) bar == 3 && (B) i == 5)

推荐答案

这对我有用.

(gdb) b dump_route_info if (strncmp(route->rt_key.prefix, "192.168.0.2", 15) == 0) && route->rt_key.mask == 32

这篇关于非本地类型上具有多个条件的GDB断点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆