modularml / mojo

The Mojo Programming Language
https://docs.modular.com/mojo/manual/
Other
22.9k stars 2.58k forks source link

[BUG]: Could not debug code #1466

Closed AlaDeli7 closed 8 months ago

AlaDeli7 commented 9 months ago

Issue description

I tried to debug the following example provided by the Mojo documentaion, but i got this error:

`

Running initCommands: (lldb) settings set target.show-hex-variable-values-with-leading-zeroes false (lldb) plugin load '/home/deli/.modular/pkg/packages.modular.com_mojo/lib/libMojoLLDB.so.18git' (lldb) command script import /home/deli/.modular/pkg/packages.modular.com_mojo/lib/lldb-visualizers/lldbDataFormatters.py error: module importing failed: This script interpreter does not support importing modules. (lldb) command script import /home/deli/.modular/pkg/packages.modular.com_mojo/lib/lldb-visualizers/mlirDataFormatters.py error: module importing failed: This script interpreter does not support importing modules. End! `

Steps to reproduce

trait Movable: fn moveinit(inout self, owned existing: Self): ...

trait MassProducible(DefaultConstructible, Movable): pass

fn factory[T: MassProducible]() -> T: return T()

struct Thing(MassProducible): var id: Int

fn __init__(inout self):
    self.id = 0

fn __moveinit__(inout self, owned existing: Self):
    self.id = existing.id

fn main():

let thing = factory[Thing]()  # Break point goes here
print("End!")

`

River707 commented 8 months ago

Thanks for the report! We haven't yet fully released the Mojo debugger, so some configurations aren't yet setup correctly (issue here is that we aren't shipping the debugger with scripting support, so some visualizers fail to load, FYI; @walter-erquinigo). Closing this for now, but the fully experience we'll be released somewhere in the next few releases!

walter-erquinigo commented 8 months ago

issue here is that we aren't shipping the debugger with scripting support, so some visualizers fail to load

I'll removing these lines if lldb doesn't have scripting support.

walter-erquinigo commented 8 months ago

The next version of the SDK will only enable these visualizers if python scripting support is enabled. Eventually we'll ship LLDB with such support, but no timeline is defined yet.