如何增加外部调试器可视化程序可以显示的字符串的大小? [英] How can I increase the size of the string that an external debugger visualizer can display?

查看:154
本文介绍了如何增加外部调试器可视化程序可以显示的字符串的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我再次写了一个外部调试器可视化器,并且正在跑到墙上。调试器可视化程序可以返回的字符串的大小似乎有限制。



Delphi 2010附带的TStrings调试器可视化器的限制为4K。在回应Embarcadero新闻组发布的问题时,Ewe Schuster 回覆你可以增加缓冲区一点点,但是AFAIR的实际限制是在IOTAThread.Evaluate中限制了大约12k个字符。



我的调试器可视化器基于TStrings调试器可视化器的代码,我可以看到,TFrame的Evaluate方法的实现包括以下声明ResultStr,用于返回从IOTAThread.Evaluate调用返回的字符串:

  ResultStr:数组[0..4095]的Char; 

我曾经希望增加这个缓冲区的大小会有所帮助,但没有运气。



如果有任何事情增加外部调试器可视化程序可以显示的字符串的大小,该怎么办?

解决方案

我对这个限制有同样的有限的耐心...
所以我做了一个调试可视化工具,主要通过在调试过程中创建一个MemoryStream来保存字符串结果的表达式,然后使用类似

  CurProcess.ReadProcessMemory(StrToInt(SrcMemoryAddr),DstMemStream.Size,DstMemStream.Memory ^) ; 

将其复制到可视化的MemoryStream中。那么你可以做任何你想要显示的东西(例如,如果是像CLientDataSet.XMLData这样的XML字符串,将其格式化为人类阅读)。



如果表达式是一个常量字符串,一个var或需要评估等...



我的FGStringVisualizer不是100%令人满意,这就是为什么我还没有发表但是在我的博客上,但是因为它需要99%的时间,所以我没有时间去清理它,甚至按原样发布。但是如果有需要,我可以一切所需要的免责声明...



更新:
与我用于FGStringListVisualizer的想法是一样的我在最后的DelphiLive中提出。顺便说一下,自从我做了一些改进之后,这个也可能值得放在我的博客上。


I am once again writing an external debugger visualizer, and am running into a wall. There appears to be a limit to the size of the string that the debugger visualizer can return.

The TStrings debugger visualizer that shipped with Delphi 2010 had a limit of 4K. In a response to a question posted on Embarcadero's newsgroups, Ewe Schuster replied that "You can increase the buffer a little bit, but AFAIR the actual limitation is in IOTAThread.Evaluate with a limit of about 12k chars."

My debugger visualizer is based on the code of the TStrings debugger visualizer, and I can see that the implementation of the TFrame's Evaluate method includes the following declaration of ResultStr, which is used to return the string returned from the IOTAThread.Evaluate call:

  ResultStr: array[0..4095] of Char;

I had hoped that increasing the size of this buffer would help, but no luck.

What can I do, if anything, to increase the size of the string that my external debugger visualizer can display?

解决方案

I had the same limited patience for that limit... So I made a debug visualizer that work around the limitation mostly by creating a MemoryStream in the debugged process to hold the string result of the Expression, then use something like

CurProcess.ReadProcessMemory(StrToInt(SrcMemoryAddr), DstMemStream.Size, DstMemStream.Memory^);

to copy it into a visualizer's MemoryStream. Then you can do whatever you want to display it (for instance formatting it for human reading if it's an XML string like a CLientDataSet.XMLData).

There are few tricks depending if the Expression is a const string, a var, or needs evaluation etc...

My FGStringVisualizer is not 100% satisfying, which is why I haven't published it yet on my blog, but as it does 99% of what I need, I didn't take the time to clean it a bit and publish it even "as-is". But if there is a need I can certainly do it with all needed disclaimers...

Update: It's the same idea that I used for my FGStringListVisualizer that I presented at the last DelphiLive. By the way, this one also might be worth putting on my blog as I made a few improvements since.

这篇关于如何增加外部调试器可视化程序可以显示的字符串的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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