Using the Lazarus IDE > Debugger

Freezing debugger when stepping because of a large object

(1/3) > >>

JernejL:
At one point i'm passing an object with a lot of data over stack, here is part of the debug log to show what i mean (the whole original line is 2289340 characters long):


--- Code: ---<-stack-list-arguments 1 0 7>
^done,stack-args=[frame={level="0",args=[{name="MAP",value="{_vptr$TTOPDOWNCITYCUBEMAP = 0x0, CITYMAP = {{{{TERRAIN = 0, SIDES = {0, 0, 0, 0, 0}, WEST = 0, EAST = 0, NORTH = 0, SOUTH = 0, LID = 0} <repeats 39 times>, {TERRAIN = 0, SIDES = {0, 0, 0, 185, 0}, WEST = 0, EAST = 0, NORTH = 0, SOUTH = 185, LID = 0} <repeats 67 times>, {TERRAIN = 0, SIDES = {0, 0, 0, 0, 0}, WEST = 0, EAST = 0, NORTH = 0, SOUTH = 0, LID = 0} <repeats 51 times>, {TERRAIN = 32768, SIDES = {0, 0, 0, 0, 239}, WEST = 0, EAST = 0, NORTH = 0, SOUTH = 0, LID = 239} <repeats 99 times>}, {{TERRAIN = 0, SIDES = {0, 185, 0, 0, 0}, WEST = 0, EAST = 185, NORTH = 0, SOUTH = 0, LID = 0}, {TERRAIN = 0, SIDES = {0, 0, 0, 0, 0}, WEST = 0, EAST = 0, NORTH = 0, SOUTH = 0, LID = 0} <repeats 38 times>, {TERRAIN = 32768, SIDES = {0, 0, 0, 0, 0}, WEST = 0, EAST = 0, NORTH = 0, SOUTH = 0, LID = 0} <repeats 53 times>, {TERRAIN = 0, SIDES = {0, 0, 0, 0, 0}, WEST = 0, EAST = 0, NORTH = 0, SOUTH = 0, LID = 0} <repeats 65 times>, {TERRAIN = 32768, SIDES = {0, 0, 0, 0, 239}, WEST = 0, EAST = 0, NORTH = 0, SOUTH = 0, LID = 239} <repeats 99 times>}, {{TERRAIN = 0, SIDES = {0, 185, 0, 0, 0}, WEST = 0, EAST = 185, NORTH = 0, SOUTH = 0, LID = 0}, {TERRAIN = 0, SIDES = {0, 0, 0, 0, 0}, WEST = 0, EAST = 0, NORTH = 0, SOUTH = 0, LID = 0} <repeats 38 times>, {TERRAIN = 32768, SIDES = {0, 0, 0, 0, 0}, WEST = 0, EAST = 0, NORTH = 0, SOUTH = 0, LID = 0} <repeats 53 times>, {TERRAIN = 0, SIDES = {0, 0, 0, 0, 0}, WEST = 0, EAST = 0, NORTH = 0, SOUTH = 0, LID = 0} <repeats 65 times>, {TERRAIN = 32768, SIDES = {0, 0, 0, 0, 239}, WEST = 0, EAST = 0, NORTH = 0, SOUTH = 0, LID = 239} <repeats 99 times>}, {{TERRAIN = 0, SIDES = {0, 185, 0, 0, 0}, WEST = 0, EAST = 185, NORTH = 0, SOUTH = 0, LID = 0}, {TERRAIN = 0, SIDES = {0, 0, 0, 0, 0}, WEST = 0, EAST = 0, NORTH = 0, SOUTH = 0, LID = 0} <repeats 38 times>, {TERRAIN = 32768, SIDES = {0, 0, 0, 0, 0}, WEST = 0, EAST = 0, NORTH = 0, SOUTH = 0, LID = 0} <repeats 53 times>, {TERRAIN = 0, SIDES = {0, 0, 0, 0, 0}, WEST = 0, EAST = 0, NORTH = 0, SOUTH = 0, LID = 0} <repeats 65 times>, {TERRAIN = 32768, SIDES = {0, 0, 0, 0, 239}, WEST = 0, EAST = 0, NORTH = 0, SOUTH = 0, LID = 239} <repeats 99 times>}, {{TERRAIN = 0, SIDES = {0, 185, 0, 0, 0}, WEST = 0, EAST = 185, NORTH = 0, SOUTH = 0, LID = 0}, {TERRAIN = 0, SIDES = {0, 0, 0, 0, 0}, WEST = 0, EAST = 0, NORTH = 0, SOUTH = 0, LID = 0} <repeats 38 times>, {TERRAIN = 32768, SIDES = {0, 0, 0, 0, 0}, WEST = 0, EAST = 0, NORTH = 0, SOUTH = 0, LID = 0}

--- End code ---

Whenever the object is in parameter list, whole debugger takes long time to step thru breakpoints because of object's "citymap" property and debug output window becomes totally unresponsive.
 

--- Code: Pascal  window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- type.. Tblock = packed record = record with a few arrays and structures class object.. citymap:                                array[0..mapheight, 0..mapsize, 0..mapsize] of Tblock;     // the map (z, y, x)  
Is there a way to improve, avoid or fix this? how could i avoid this, i really do need a large 3d array in the object to hold my map data.
 

Martin_fr:
In Lazarus svn trunk you can try setting
   GdbValueMemLimit
(in the property grid, in Tools > Options > Debugger)
to a lower value.


You can also try to set the field "debugger_startup_options"
    --eval-command="set print elements 10"
(or whatever number you prefer)

marcov:
Don't allocate it on the stack, allocate it on the heap.

JernejL:

--- Quote from: marcov on May 08, 2018, 04:43:10 pm ---Don't allocate it on the stack, allocate it on the heap.

--- End quote ---

 
I'm not sure what you mean, the object is a global variable in a unit.
 
also, this would not solve problem with gdb choking lazarus ide with too much data.
 

JernejL:
I suggest we put a warning / notice into debugger log if it takes too much time to get debugger data, it would help a lot to fix these freezing if it happens to other people.

Navigation

[0] Message Index

[#] Next page

Go to full version