Skip to content

Auto-fill the instruction text when adding a TTD bookmark (Fixes #1108) - #1151

Open
xusheng6 wants to merge 1 commit into
devfrom
test_1108_autofill_bookmark_instruction
Open

Auto-fill the instruction text when adding a TTD bookmark (Fixes #1108)#1151
xusheng6 wants to merge 1 commit into
devfrom
test_1108_autofill_bookmark_instruction

Conversation

@xusheng6

@xusheng6 xusheng6 commented Jul 24, 2026

Copy link
Copy Markdown
Member

Prefill the disassembly text of the current instruction as notes when adding a TTD bookmark

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@xusheng6
xusheng6 requested a review from plafosse July 30, 2026 21:20

@fuzyll fuzyll left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Genuinely not sure if I should approve or not. If you go through these and none of them are applicable, let me know and I'll approve. But, I do think there probably need to be some changes, even if they're small.

Comment thread ui/ttdbookmarkwidget.cpp
m_noteEdit->setMinimumWidth(400);
layout->addRow("Note:", m_noteEdit);

// Pre-fill the note with the instruction at the view address, so the bookmark is meaningful without the user

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the logic here correct? I haven't built this and ran it, but if m_noteEdited is !note.isEmpty (above, line 140), doesn't that mean that deleting a note and leaving it empty will cause it to auto-fill?

If this is intentional/desired, awesome, I just didn't understand that from the comment here. Seemed like an edge-case that wasn't addressed instead.

Comment thread ui/ttdcallswidget.cpp
@@ -216,7 +216,7 @@ void TTDCallsQueryWidget::setupUIActions()
defaultNote = funcItem->text();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re: Earlier comment about auto-fill, it looks like this will prevent that. Again, if that's desired, awesome. Just stuck out as a difference.

Comment thread ui/ttdeventswidget.cpp
QString posStr = posItem->text();

TTDBookmarkEditDialog dialog(this, posStr, "", "");
TTDBookmarkEditDialog dialog(this, posStr, "", "", m_controller);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also ran an LLM review on this PR as I had some questions on how certain things worked in the debugger after finishing my review. When I did, it said there is a problem here. I asked it for more information, and it said:

Exception bookmarks omit the available program counter. The dialog receives an empty view address even though exception rows contain a PC, so these bookmarks neither autofill the instruction nor retain the relevant navigation address.

The bookmark dialog can only generate instruction text when it receives a View Address:
uint64_t address = ParseHexAddress(m_viewAddressEdit->text());
if (!data || (address == 0))
return "";
In TTDEventsQueryWidget, exception rows already display the exception’s program counter. For example, ui/ttdeventswidget.cpp:731 populates the Program Counter column from event.exception->programCounter.
However, the bookmark action always constructs the dialog with an empty view address:
TTDBookmarkEditDialog dialog(this, posStr, "", "", m_controller);
That third empty string means:

  1. The dialog cannot disassemble the instruction at the exception PC.
  2. The generated note remains empty.
  3. The saved bookmark’s viewAddress remains zero.
  4. Navigating to that bookmark later changes the TTD position but cannot return the UI to the exception instruction.
    For example, an exception at position 123:4 with PC 0x140001234 creates a bookmark for 123:4, but discards 0x140001234.

Looking over this, I think its logic holds?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants