Add new test program for pretty printing structures.

This commit is contained in:
Ernie Pasveer
2025-05-18 12:35:29 -05:00
parent 26b433bc65
commit 909eb4cf22
5 changed files with 80 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
helloprettyprint
*.o
+10
View File
@@ -0,0 +1,10 @@
.PHONY: all
all: helloprettyprint
helloprettyprint: helloprettyprint.cpp
g++ -g -o helloprettyprint helloprettyprint.cpp
.PHONY: clean
clean:
rm -f helloprettyprint helloprettyprint.o
+15
View File
@@ -0,0 +1,15 @@
Seer has a problem with enabling 'pretty printing' and structs have have \n characters.
https://github.com/epasveer/seer/issues/313
(gdb) set print pretty on
Without pretty print
10^done,value="{B = 1, C = 0, D = \"asd\", E = std::vector<bool> of length 1, capacity 64 = {true}}"
11^done,value="1"
With pretty print
10^done,value="{\n B = 1,\n C = 0,\n D = \"asd\",\n E = std::vector<bool> of length 1, capacity 64 = {true}\n}"
11^done,value="1"
@@ -0,0 +1,27 @@
#include <iostream>
#include <string>
#include <vector>
struct A
{
int B;
float C;
std::string D;
std::vector<bool> E;
};
struct A f(int p)
{
A a;
a.B = p;
a.D = "asd";
a.E.push_back(p > 0);
return a;
}
int main()
{
A a = f(1);
std::cout << a.E[0] << std::endl;
return 0;
}
+25
View File
@@ -0,0 +1,25 @@
{
"seerproject": {
"executable": "helloprettyprint",
"postgdbcommands": [
""
],
"pregdbcommands": [
"# Comment the next line out to disable \"pretty printing\".",
"set pretty printer on"
],
"startmode": {
"arguments": "",
"breakinfunction": false,
"breakinfunctionname": "",
"breakinmain": true,
"breakpointsfile": "",
"nobreak": false,
"nonstopmode": false,
"randomizestartaddress": false,
"showassemblytab": false
},
"symbolfile": "",
"workingdirectory": ""
}
}