如何从 dbx 的漂亮打印函数调用 dbx 自己的打印函数
我正在尝试为Solaris 上的dbx 编写一个漂亮的打印路由,以漂亮地打印地图。现在,映射可以包含(一种)任意类型的元素。我不想知道它们是什么或处理它们。我想让 dbx 自己弄清楚如何打印它们。我只想以 [key,value] 格式迭代和打印键和值。但我不知道如何从 db_pretty_print 回调 dbx'es 打印例程。有什么想法吗?谢谢。
I am trying to write a pretty print routing for dbx on solaris to pretty print maps. Now the maps may contain elements of (one) arbitrary type. I dont want to know what they are or handle that. I want to let dbx itself figure out how to print them. I just want to iterate and print keys and values in [key,value] format. But i cant figure out how to call back dbx'es print routines from db_pretty_print. Any ideas ? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不认为你可以与 db_pretty_print 集成来做你想做的事。我建议您在程序中编写一个函数,该函数可以返回一个字符串,其中包含要打印的对象的十六进制地址。在 dbx 内部,您可以编写一个 shell 函数来调用“枚举器”函数,然后 shell 函数可以分割字符串,迭代地址,并应用 dbx 打印函数。我假设您将告诉 dbx 使用 C++ RTTI 信息来动态选择用于打印命令的正确类型。对于 C 或 Fortran 程序,我不知道如何使 dbx 动态选择正确的打印类型。
I don't think you can integrate with db_pretty_print to do what you want. I would suggest you write a function inside your program which can return a character string containing the hex addresses of the objects you want to print. Inside dbx you can write a shell function which calls your "enumerator" function, then the shell function can split the string, and iterate through the addresses, and apply the dbx print function. I'm assuming you'll tell dbx to use the C++ RTTI information to dynamically choose the right type for purposes of the print command. For a C or Fortran program, I don't know how to make dbx dynamically choose the right type for printing.