runtimeverification / runtimeverification/llvm-backend

[GDB] MatchLog enum kind raises `TypeError` when printed

Open
#726 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug debugger
Dominant language
C++
Stars
43
Forks
22
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the MatchLog enum and the GDB Python access shown in the reproduction, especially the kind field returned by getMatchLog. Reproduce the NoneType exception with the provided K definition and debugger commands, then verify that printing the enum no longer raises a TypeError and that ['kind'] remains accessible.

Written by the indexing model from the issue text.

Assessment

Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.