Compare commits
2 Commits
1171fe28e7
...
d254d5cfd0
| Author | SHA1 | Date | |
|---|---|---|---|
| d254d5cfd0 | |||
| 7e02e8ec6d |
@@ -17,7 +17,7 @@ class PyBugBridgeDebugger(bdb.Bdb):
|
|||||||
return json.loads(sys.stdin.readline())
|
return json.loads(sys.stdin.readline())
|
||||||
|
|
||||||
def user_line(self, frame: FrameType):
|
def user_line(self, frame: FrameType):
|
||||||
# print("TRACE:", frame.f_code.co_filename, frame.f_lineno)
|
print("TRACE:", frame.f_code.co_filename, frame.f_lineno)
|
||||||
self.send(
|
self.send(
|
||||||
{
|
{
|
||||||
"event": "stopped",
|
"event": "stopped",
|
||||||
@@ -30,7 +30,9 @@ class PyBugBridgeDebugger(bdb.Bdb):
|
|||||||
|
|
||||||
def interaction_loop(self, frame: FrameType):
|
def interaction_loop(self, frame: FrameType):
|
||||||
while True:
|
while True:
|
||||||
|
print("DEBUG: waiting for command", file=sys.stderr, flush=True)
|
||||||
cmd = self.recv()
|
cmd = self.recv()
|
||||||
|
print(f"DEBUG: received command {cmd}", file=sys.stderr, flush=True)
|
||||||
|
|
||||||
match cmd["cmd"]:
|
match cmd["cmd"]:
|
||||||
case "continue":
|
case "continue":
|
||||||
@@ -44,7 +46,11 @@ class PyBugBridgeDebugger(bdb.Bdb):
|
|||||||
{
|
{
|
||||||
"request_id": cmd["request_id"],
|
"request_id": cmd["request_id"],
|
||||||
"event": "locals",
|
"event": "locals",
|
||||||
"vars": {k: repr(v) for k, v in frame.f_locals.items()},
|
"vars": {
|
||||||
|
k: repr(v)
|
||||||
|
for k, v in frame.f_locals.items()
|
||||||
|
if k not in frame.f_globals.keys()
|
||||||
|
},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
case "eval":
|
case "eval":
|
||||||
@@ -107,7 +113,7 @@ def main():
|
|||||||
}
|
}
|
||||||
|
|
||||||
dbg.set_step()
|
dbg.set_step()
|
||||||
dbg.run(code, globals_dict, {})
|
dbg.run(code, globals_dict, globals_dict)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
1
test.py
1
test.py
@@ -64,7 +64,6 @@ def generate_company(name: str, num_employees: int) -> Company:
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
my_company = generate_company("TechCorp", 5)
|
my_company = generate_company("TechCorp", 5)
|
||||||
|
|
||||||
print("All employees:")
|
print("All employees:")
|
||||||
for emp in my_company.employees:
|
for emp in my_company.employees:
|
||||||
print(emp)
|
print(emp)
|
||||||
|
|||||||
Reference in New Issue
Block a user