diff options
author | Saem Ghani <saemghani+github@gmail.com> | 2021-04-05 02:37:28 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-05 11:37:28 +0200 |
commit | 526157917598bc603f5e2296f86946b1ba7f2e65 (patch) | |
tree | ba3604eb65b0a2b3f3dad2fc83f813333511552f /tests/untestable/gdb | |
parent | b9c94f22aa6f3b43962f1a1f2a9b27e9cba42069 (diff) | |
download | Nim-526157917598bc603f5e2296f86946b1ba7f2e65.tar.gz |
[nim-gdb] Fixed enums and flag output [ci skip] (#17634)
Debugger works for enums again. Additionally, flags work better than before. Reworked object printer as well, but the approach needs much more work or has to be replaced all together. This is mostly to save the work and myself or someone else can revisit it.
Diffstat (limited to 'tests/untestable/gdb')
-rw-r--r-- | tests/untestable/gdb/gdb_pretty_printer_test.py | 5 | ||||
-rw-r--r-- | tests/untestable/gdb/gdb_pretty_printer_test_program.nim | 34 |
2 files changed, 36 insertions, 3 deletions
diff --git a/tests/untestable/gdb/gdb_pretty_printer_test.py b/tests/untestable/gdb/gdb_pretty_printer_test.py index 5b34bcb3d..8f0f88e85 100644 --- a/tests/untestable/gdb/gdb_pretty_printer_test.py +++ b/tests/untestable/gdb/gdb_pretty_printer_test.py @@ -25,6 +25,7 @@ outputs = [ 'seq(3, 3) = {"one", "two", "three"}', 'Table(3, 64) = {[4] = "four", [5] = "five", [6] = "six"}', 'Table(3, 8) = {["two"] = 2, ["three"] = 3, ["one"] = 1}', + '{a = 1, b = "some string"}' ] for i, expected in enumerate(outputs): @@ -32,7 +33,7 @@ for i, expected in enumerate(outputs): gdb.flush() functionSymbol = gdb.selected_frame().block().function - assert functionSymbol.line == 21 + assert functionSymbol.line == 41, str(functionSymbol.line) if i == 6: # myArray is passed as pointer to int to myDebug. I look up myArray up in the stack @@ -47,6 +48,6 @@ for i, expected in enumerate(outputs): output = str(raw) - assert output == expected, output + " != " + expected + assert output == expected, "{0} : output: ({1}) != expected: ({2})".format(i, output, expected) gdb.write(f"passed\n", gdb.STDLOG) gdb.execute("continue") diff --git a/tests/untestable/gdb/gdb_pretty_printer_test_program.nim b/tests/untestable/gdb/gdb_pretty_printer_test_program.nim index c376ef89a..d2acdd282 100644 --- a/tests/untestable/gdb/gdb_pretty_printer_test_program.nim +++ b/tests/untestable/gdb/gdb_pretty_printer_test_program.nim @@ -14,7 +14,27 @@ type moTwo, moThree, moFoure, - + + MyObj = object + a*: int + b*: string + + # MyVariant = ref object + # id*: int + # case kind*: MyEnum + # of meOne: mInt*: int + # of meTwo, meThree: discard + # of meFour: + # moInt*: int + # babies*: seq[MyVariant] + # after: float + + # MyIntVariant = ref object + # stuff*: int + # case myKind*: range[0..32766] + # of 0: mFloat*: float + # of 2: mString*: string + # else: mBabies*: seq[MyIntVariant] var counter = 0 @@ -74,6 +94,18 @@ proc testProc(): void = var myOtherTable = {"one": 1, "two": 2, "three": 3}.toTable myDebug(myOtherTable) #14 + var obj = MyObj(a: 1, b: "some string") + myDebug(obj) #15 + + # var varObj = MyVariant(id: 13, kind: meFour, moInt: 94, + # babies: @[MyVariant(id: 18, kind: meOne, mInt: 7, after: 1.0), + # MyVariant(id: 21, kind: meThree, after: 2.0)], + # after: 3.0) + # myDebug(varObj) #16 + + # var varObjInt = MyIntVariant(stuff: 5, myKind: 2, mString: "this is my sweet string") + # myDebug(varObjInt) #17 + echo(counter) |