-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GDB] Can't print builtin types on LHS of rules in K Match
#746
Comments
Wrong debug information when pattern matching
Kompile:
krun and GDB: krun -cPGM='fooBool(false)' --debugger
(gdb) k start
...
(gdb) k match TEST.testPatternBool subject
Subject:
true # should be false
does not match pattern:
true
(gdb)
|
Can't output a
Kompile: kompile test.k --enable-llvm-debug --syntax-module TEST krun and GDB: krun -cPGM='fooFloat(1.0)' --debugger
(gdb) k start
...
(gdb) k match TEST.testPatternFloat subject
FLOAT.trueeq(1.0, 0.0) => false
Traceback (most recent call last):
File "<string>", line 794, in invoke
gdb.error: No type named .
Python Exception <class 'gdb.error'>: No type named .
Error occurred in Python: No type named . Edit: After some investigation, I found out that both the sort and the pattern are empty when trying to print the GDB code:
Output:
MatchLog entry:
|
string
and int
on LHS of rules in K Match
K Match
Can't output a
Kompile: kompile test.k --enable-llvm-debug --syntax-module TEST krun and GDB: krun -cPGM='fooPatternList(ListItem(0))' --debugger
(gdb) k start
...
(gdb)k match TEST.testPatternList subject
LIST.size_long(ListItem ( 0 )) => 0
Traceback (most recent call last):
File "<string>", line 794, in invoke
gdb.error: No type named SortMInt{Sort64{}}.
Python Exception <class 'gdb.error'>: No type named SortMInt{Sort64{}}.
Error occurred in Python: No type named SortMInt{Sort64{}}. |
Can't output a
Kompile: kompile test.k --enable-llvm-debug --syntax-module TEST krun and GDB: krun -cPGM='fooPatternMap(0|-> 0)' --debugger
(gdb) k start
...
(gdb) k match TEST.tesPatterntMap subject
MAP.size_long(0 |-> 0) => 0
Traceback (most recent call last):
File "<string>", line 794, in invoke
gdb.error: No type named SortMInt{Sort64{}}.
Python Exception <class 'gdb.error'>: No type named SortMInt{Sort64{}}.
Error occurred in Python: No type named SortMInt{Sort64{}}. |
Can't output a
Kompile: kompile test.k --enable-llvm-debug --syntax-module TEST krun and GDB: krun -cPGM='fooSet(SetItem(0))' --debugger
(gdb) k start
...
(gdb) k match TEST.testPatternSet subject
SET.size_long(SetItem ( 0 )) => 0
Traceback (most recent call last):
File "<string>", line 794, in invoke
gdb.error: No type named SortMInt{Sort64{}}.
Python Exception <class 'gdb.error'>: No type named SortMInt{Sort64{}}.
Error occurred in Python: No type named SortMInt{Sort64{}}. |
Update on this: Even though we have the correct mechanism to add |
A possible idea to solve this is to declare the possible sorts (arguments on this phi function) as global variables... |
I don't fully understand why this code is trying to print out the sort |
Of course! I can say for sure about this
|
Yes, but why specifically is the code doing anything with |
That's the final type of the subject phi function. We try to cast the subject to |
So the problem is that the match function is not setting the sort and pattern correctly on failing log entries when testing the match - is that correct? |
Yeah, I believe that is the general case, indeed! We do have a case on printing the arguments of the function in the string case:
But the fail case is the most complex error... |
Well, I guess the fix is to look at the function that populates the match log and identify why it fails to set the log entries correctly and falls through to the final case. I don't know off-hand why that's going to be, but let me know if you want a hand debugging anything. |
Yeah, I would like a hand on this, I've already tried it a lot and have yet to come up with any solutions... |
Reinvestigate now that the LLVM 16 opaque pointers change has been merged. |
GDB Types to Fix:
Given the K definition:
Kompile:
Krun and GDB with Int:
Krun and GDB with String:
The text was updated successfully, but these errors were encountered: