Skip to content

Commit

Permalink
prompt input
Browse files Browse the repository at this point in the history
  • Loading branch information
khlevin committed Apr 22, 2024
1 parent 49fc96f commit b85ab02
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
16 changes: 14 additions & 2 deletions src/chatdbg/chatdbg_gdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,21 @@ def _initial_prompt_command_line(self):

return executable_path + " " + args

# TODO:
def _initial_prompt_input(self):
pass
prefix = "Argument list to give program being debugged when it is started is "
args = gdb.execute("show args", to_string=True).strip()
if args.startswith(prefix):
args = args[len(prefix):].strip('."')

input_pipe = args.find('<')
if input_pipe != -1:
input_file = args[input_pipe + 1:].strip()

try:
content = open(input_file, 'r').read()
return content
except Exception:
self.fail(f"The detected input file {input_file} could not be read.")

def _prompt_stack(self):
"""
Expand Down
2 changes: 0 additions & 2 deletions src/chatdbg/native_util/dbg_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ def __init__(self, prompt) -> None:
def query_and_print(self, assistant, user_text, is_followup):
prompt = self.build_prompt(user_text, is_followup)

print("Prompt from Dialog: ", prompt)

self._history.clear()
print(assistant.query(prompt, user_text)["message"])

Expand Down

0 comments on commit b85ab02

Please sign in to comment.