Skip to content

[GDB] MatchLog enum kind raises TypeError when printed #726

Open
@Robertorosmaninho

Description

@Robertorosmaninho

When debugging the MatchLog, it is desirable that every field be correctly printed without errors to the users/developers.

To reproduce this issue:

K Definition:

module TEST
  imports INT

  syntax Foo ::= foo(Int) | bar()
  rule [test]: foo(I) => bar() requires I ==Int 0
endmodule

kompile and krun:

kompile test.k --enable-llvm-debug && krun -cPGM='foo(1)' --debugger

On GDB:

(gdb) k start

...

(gdb)  python print(gdb.lookup_global_symbol('TEST.test.match').value()(gdb.parse_and_eval('subject')))
void

(gdb) python print(gdb.lookup_global_symbol("getMatchLog").value()()[0])
Python Exception <class 'TypeError'>: 'NoneType' object is not subscriptable

{kind = MatchLog::FUNCTION, function = 0x2f6560 <str_lit_side_condition_133> "side_condition_133", debugName = 0x2f6546 <str_lit_TEST.test.sc> "TEST.test.sc", result = 0x7ffff5500048, args = std::vector of length 1, capacity 1 = {0x7ffff5400088}, pattern = 0x0, subject = 0x0, sort = 0x0}

(gdb) python  print(gdb.lookup_global_symbol("getMatchLog").value()()[0]['kind'])
Python Exception <class 'TypeError'>: 'NoneType' object is not subscriptable
MatchLog::FUNCTION

Simple solutions: Work with Int or String
Harder solution: Workaround to pretty print the enum

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdebugger

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions