Skip to content

Commit 842469e

Browse files
committed
DBG: automatic comments will have a '\1' character as prefix.
1 parent bc4149b commit 842469e

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

x64_dbg_dbg/_exports.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ extern "C" DLL_EXPORT bool _dbg_addrinfoget(duint addr, SEGMENTREG segment, ADDR
163163
len--;
164164
if(len)
165165
len++;
166-
sprintf(addrinfo->comment, "%s:%u", filename + len, line.LineNumber);
166+
sprintf_s(addrinfo->comment, "\1%s:%u", filename + len, line.LineNumber);
167167
retval = true;
168168
}
169169
else if(!bOnlyCipAutoComments || addr == GetContextDataEx(hActiveThread, UE_CIP)) //no line number
@@ -273,8 +273,10 @@ extern "C" DLL_EXPORT bool _dbg_addrinfoget(duint addr, SEGMENTREG segment, ADDR
273273
retval = true;
274274
}
275275
}
276-
comment.resize(MAX_COMMENT_SIZE - 1);
277-
strcpy_s(addrinfo->comment, comment.c_str());
276+
comment.resize(MAX_COMMENT_SIZE - 2);
277+
String fullComment = "\1";
278+
fullComment += comment;
279+
strcpy_s(addrinfo->comment, fullComment.c_str());
278280
}
279281
}
280282
}

x64_dbg_dbg/addrinfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ bool apienumexports(uint base, EXPORTENUMCALLBACK cbEnum)
380380
///comment functions
381381
bool commentset(uint addr, const char* text, bool manual)
382382
{
383-
if(!DbgIsDebugging() or !memisvalidreadptr(fdProcessInfo->hProcess, addr) or !text or strlen(text) >= MAX_COMMENT_SIZE - 1)
383+
if(!DbgIsDebugging() or !memisvalidreadptr(fdProcessInfo->hProcess, addr) or !text or text[0] == '\1' or strlen(text) >= MAX_COMMENT_SIZE - 1)
384384
return false;
385385
if(!*text) //NOTE: delete when there is no text
386386
{

0 commit comments

Comments
 (0)