Author Topic: [solved]debugger, printing huge struct hangs debugger  (Read 3887 times)

Offline visir

  • Multiple posting newcomer
  • *
  • Posts: 76
[solved]debugger, printing huge struct hangs debugger
« on: July 13, 2017, 11:34:02 am »
Looks like gdb expands all fields and subfields in any structure I'm printing. One of those is so big, it hangs debugger. Any gdb option to disable here?

It's more like a gdb question though.
« Last Edit: July 21, 2017, 04:50:17 pm by visir »

Offline visir

  • Multiple posting newcomer
  • *
  • Posts: 76
Re: debugger, printing huge struct hangs debugger
« Reply #1 on: July 13, 2017, 12:53:24 pm »
This link just tells me to update to the lastest gdb. Can't really update, this issue probably wasn't solved yet. In short, downgraded to a very old version of gdb because codeblocks and recent gdb had problems with "two commands at once".

This can wait, don't hurry. Actually, watch this when you're bored. You guys are awesome.

Offline visir

  • Multiple posting newcomer
  • *
  • Posts: 76
Re: debugger, printing huge struct hangs debugger
« Reply #2 on: July 13, 2017, 03:04:51 pm »
Actually, adding it to watches helped.

Actually no, it still hangs.
« Last Edit: July 13, 2017, 03:33:06 pm by visir »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: debugger, printing huge struct hangs debugger
« Reply #3 on: July 13, 2017, 03:27:50 pm »
With the current debugger plugin this problem cannot be solved. In the future it will probably work, but I don't know when.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline visir

  • Multiple posting newcomer
  • *
  • Posts: 76
Re: debugger, printing huge struct hangs debugger
« Reply #4 on: July 13, 2017, 03:35:54 pm »
Well, I got what I paid for.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5913
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: debugger, printing huge struct hangs debugger
« Reply #5 on: July 14, 2017, 04:44:00 am »
If I remember correctly, GDB has some option to "disable" expanding the sub-fields of a struct.
Another way of solving this problem is write a simple Pretty printer for the struct(in the pretty printer, you can print any thing you want), see GDB's document for more informations. Writing pretty printer is not hard.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline visir

  • Multiple posting newcomer
  • *
  • Posts: 76
Re: debugger, printing huge struct hangs debugger
« Reply #6 on: July 21, 2017, 04:49:29 pm »
set print elements 3

It was set to unlimited before. Now it works.

https://sourceware.org/gdb/current/onlinedocs/gdb/Print-Settings.html#Print-Settings