I'm working on an algorithm which uses a big map. I'm trying to follow the algorithm along with GDB while doing it on paper to see where it goes wrong. But as the map gets big, GDB abbreviates it and stop showing the next values, which I need:
(gdb) p R
$1 = std::map with 140 elements = {[0] = "", [1] = "e", [2] = "", [3] = "", [4] = "", [5] = "", [6] = "", [7] = "", [8] = "a", [9] = "a", [10] = "", [11] = "", [12] = "", [13] = "", [14] = "",
[15] = "", [16] = "a", [17] = "b", [18] = "", [19] = "", [20] = "", [21] = "", [22] = "b", [23] = "", [24] = "", [25] = "a", [26] = "", [27] = "", [28] = "", [29] = "", [30] = "", [31] = "b",
[32] = "", [33] = "a", [34] = "", [35] = "", [36] = "", [37] = "", [38] = "", [39] = "", [40] = "(b|a)", [41] = "e", [42] = "", [43] = "", [44] = "", [45] = "", [46] = "", [47] = "", [48] = "",
[49] = "", [50] = "", [51] = "a*.a", [52] = "", [53] = "", [54] = "", [55] = "", [56] = "", [57] = "", [58] = "", [59] = "", [60] = "", [61] = "", [62] = "", [63] = "", [64] = "", [65] = "a",
[66] = "b", [67] = "", [68] = "", [69] = "", [70] = "", [71] = "", [72] = "b.a*.a", [73] = "", [74] = "a", [75] = "", [76] = "", [77] = "", [78] = "", [79] = "", [80] = "b", [81] = "", [82] = "a",
[83] = "", [84] = "", [85] = "", [86] = "", [87] = "", [88] = "", [89] = "(b|a)", [90] = "e", [91] = "", [92] = "", [93] = "", [94] = "", [95] = "", [96] = "", [97] = "", [98] = "", [99] = ""...}
I've tried to access elements with p R[100] but GDB doesn't understand this syntax:
(gdb) p R[100]
Attempt to take address of value not located in memory.
I've heard that GDB uses pretty-printers which are python scripts to make a pretty display with the command print, but I'm not sure which pretty-printer exactly when I print my std::map and I'm not sure how to modify it. Also I don't really know how memory is handled (I didn't study allocators and stuff yet) in STL containers so I'm not sure I want to go into that code.
Do you know any simpler way to print everything? Or must I modify pretty-printers? (if so can you give me a hint on which file to modify and which commands to register the changes please?).