如何添加表达式以使用 Eclipse 中的监视窗口查看内存范围?

发布于 2024-11-11 03:26:18 字数 460 浏览 1 评论 0原文

mysql有如下代码:
table->file->ha_write_row(table->record[0]))

其中 table->record[0] 是一个缓冲区,其大小由另一个变量 reclength 确定。现在我知道了reclength,看到它是203。我想查看值(table->record[0])[0..202],这意味着从第一个字节到最后一个字节。如果我只是将 (table->record[0]) 放入手表中,它只会显示几个字符,因为 table->record[0] 中有很多 0,比如“xxx\\0\\” 0\\0yyy...”,在这种情况下,eclipse只在监视窗口中显示“xxx”,因为它认为“xxx\0”是以“\\0”结尾的完整字符串,但实际上我想看到更多缓冲值。所以我在手表中使用了 (table->record[0])[i],i 是 0 , 1, 2 ..,但这很无聊,有什么好方法可以看到所有这些吗?

The mysql has the following code:
table->file->ha_write_row(table->record[0]))

where table->record[0] is a buffer whose size is determined by another variable reclength. Now I know the reclength, see it's 203. And I want to see the value (table->record[0])[0..202], which means from the first byte to the last byte. If I just put (table->record[0]) in the watch, it only display several chars as there are many 0 inside table->record[0], say it could be like "xxx\\0\\0\\0yyy...", In this case, eclipse only show "xxx" in the watch window as it thinks "xxx\0" is the complete string terminated by "\\0", but actually I want to see more buffer value. So I used (table->record[0])[i] in the watch, i is 0 , 1, 2 .., but that's boring, is there any good way to see all of them?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

莳間冲淡了誓言ζ 2024-11-18 03:26:18

使用 gdb 语法打印数组值,对于第一个元素由指针 p 指向的数组,使用:

p@100

要查看前 100 个元素。在您的情况下,编辑您的监视表达式(左键单击 -> 编辑监视表达式):

table->record@100

您没有提到表->记录的类型 ---我假设它保存指针(而不是指针到指针)。

顺便说一句,您可以将指针转换为任何数据类型,就像在 gdb 控制台中一样。

Use the gdb syntax for printing array values, for array whose first element is pointed to by pointer p, use:

p@100

To see first 100 elements. In your case, edit your watch expression (left click -> Edit Watch Expression) to:

table->record@100

You didn't mention the type of table->record --- I am assuming it holds the pointer (and not the pointer-to-pointer).

And btw, you can cast your pointer to any data type, exactly as in a gdb console.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文