Query file add UI indicator (but need something better ...), fix remedy
This commit is contained in:
@@ -2108,6 +2108,31 @@ bool RDBG_InitConnection(mco_coro *co, bool create_session = true) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String file = "";
|
||||||
|
if (create_session) {
|
||||||
|
if (BinaryUnderDebug.len) {
|
||||||
|
Window *window = GetWindow(PrimaryWindowID);
|
||||||
|
ResolvedOpen res = ResolveOpen(CoCurr->arena, window, BinaryUnderDebug, ResolveOpenMeta_DontError | ResolveOpenMeta_DontExec);
|
||||||
|
if (res.kind == OpenKind_Goto) {
|
||||||
|
file = Intern(&GlobalInternTable, res.path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (file.len == 0) {
|
||||||
|
Scratch scratch;
|
||||||
|
for (FileIter it = IterateFiles(scratch, ProjectDirectory); IsValid(it); Advance(&it)) {
|
||||||
|
if (EndsWith(it.filename, ".rdbg")) {
|
||||||
|
file = Intern(&GlobalInternTable, it.absolute_path);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (file.len == 0) {
|
||||||
|
file = QueryUserFile(co);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String session_name = Format(CoCurr->arena, "te%llu", GetTimeNanos());
|
String session_name = Format(CoCurr->arena, "te%llu", GetTimeNanos());
|
||||||
String remedy_string = Format(CoCurr->arena, "%S --servername %S", RemedyBGPath, session_name);
|
String remedy_string = Format(CoCurr->arena, "%S --servername %S", RemedyBGPath, session_name);
|
||||||
ReportConsolef("Remedybg: %S", remedy_string);
|
ReportConsolef("Remedybg: %S", remedy_string);
|
||||||
@@ -2137,32 +2162,7 @@ bool RDBG_InitConnection(mco_coro *co, bool create_session = true) {
|
|||||||
}
|
}
|
||||||
MemoryZero(RDBG_Ctx.last_error, sizeof(RDBG_Ctx.last_error));
|
MemoryZero(RDBG_Ctx.last_error, sizeof(RDBG_Ctx.last_error));
|
||||||
|
|
||||||
if (create_session == false) {
|
if (create_session) {
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
String file = "";
|
|
||||||
if (BinaryUnderDebug.len) {
|
|
||||||
Window *window = GetWindow(PrimaryWindowID);
|
|
||||||
ResolvedOpen res = ResolveOpen(CoCurr->arena, window, BinaryUnderDebug, ResolveOpenMeta_DontError | ResolveOpenMeta_DontExec);
|
|
||||||
if (res.kind == OpenKind_Goto) {
|
|
||||||
file = Intern(&GlobalInternTable, res.path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (file.len == 0) {
|
|
||||||
Scratch scratch;
|
|
||||||
for (FileIter it = IterateFiles(scratch, ProjectDirectory); IsValid(it); Advance(&it)) {
|
|
||||||
if (EndsWith(it.filename, ".rdbg")) {
|
|
||||||
file = Intern(&GlobalInternTable, it.absolute_path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (file.len == 0) {
|
|
||||||
file = QueryUserFile(co);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (EndsWith(file, ".rdbg")) {
|
if (EndsWith(file, ".rdbg")) {
|
||||||
ReportConsolef("Remedybg: OpenSession %S", file);
|
ReportConsolef("Remedybg: OpenSession %S", file);
|
||||||
OpenSession(&RDBG_Ctx, file.data, &res);
|
OpenSession(&RDBG_Ctx, file.data, &res);
|
||||||
@@ -2187,6 +2187,8 @@ bool RDBG_InitConnection(mco_coro *co, bool create_session = true) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -152,6 +152,9 @@ String QueryUserFile(mco_coro *co) {
|
|||||||
Window *window = GetWindow(PrimaryWindowID);
|
Window *window = GetWindow(PrimaryWindowID);
|
||||||
ViewID original_view = window->active_view;
|
ViewID original_view = window->active_view;
|
||||||
Open(GetPrimaryDirectory());
|
Open(GetPrimaryDirectory());
|
||||||
|
BSet set = GetBSet(window);
|
||||||
|
RawReplaceText(set.buffer, {}, u"Point at a file you want to open!");
|
||||||
|
SelectRange(set.view, GetLineRangeWithoutNL(set.buffer, 0));
|
||||||
window->after_resolve_open_hook = DetectUserFileCallback;
|
window->after_resolve_open_hook = DetectUserFileCallback;
|
||||||
String filename = "";
|
String filename = "";
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|||||||
Reference in New Issue
Block a user