Compare commits
2 Commits
9a64fd8e01
...
ba6de21396
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ba6de21396 | ||
|
|
b75e0a8a55 |
@@ -13,6 +13,7 @@ void InsertDirectoryNavigation(Buffer *buffer) {
|
|||||||
Scratch scratch;
|
Scratch scratch;
|
||||||
ResetBuffer(buffer);
|
ResetBuffer(buffer);
|
||||||
RawAppendf(buffer, "\n");
|
RawAppendf(buffer, "\n");
|
||||||
|
RawAppendf(buffer, "..\n");
|
||||||
for (FileIter it = IterateFiles(scratch, buffer->name); IsValid(it); Advance(&it)) {
|
for (FileIter it = IterateFiles(scratch, buffer->name); IsValid(it); Advance(&it)) {
|
||||||
RawAppendf(buffer, "%S\n", it.filename);
|
RawAppendf(buffer, "%S\n", it.filename);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,56 +2162,33 @@ 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;
|
if (EndsWith(file, ".rdbg")) {
|
||||||
}
|
ReportConsolef("Remedybg: OpenSession %S", file);
|
||||||
|
OpenSession(&RDBG_Ctx, file.data, &res);
|
||||||
|
} else {
|
||||||
|
ReportConsolef("Remedybg: CreateSession %S", file);
|
||||||
|
rdbg_Id cfg_id;
|
||||||
|
char *exe = file.data;
|
||||||
|
char *args = NULL;
|
||||||
|
char *work_dir = ProjectDirectory.data;
|
||||||
|
char *env = NULL;
|
||||||
|
AddSessionConfig(&RDBG_Ctx, exe, args, work_dir, env, true, true, &res, &cfg_id);
|
||||||
|
if (ContextHadError(&RDBG_Ctx)) {
|
||||||
|
ReportErrorf("Remedy error: %s", RDBG_Ctx.last_error);
|
||||||
|
MemoryZero(RDBG_Ctx.last_error, sizeof(RDBG_Ctx.last_error));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
String file = "";
|
SetActiveSessionConfig(&RDBG_Ctx, cfg_id, &res);
|
||||||
if (BinaryUnderDebug.len) {
|
if (ContextHadError(&RDBG_Ctx)) {
|
||||||
Window *window = GetWindow(PrimaryWindowID);
|
ReportErrorf("Remedy error: %s", RDBG_Ctx.last_error);
|
||||||
ResolvedOpen res = ResolveOpen(CoCurr->arena, window, BinaryUnderDebug, ResolveOpenMeta_DontError | ResolveOpenMeta_DontExec);
|
MemoryZero(RDBG_Ctx.last_error, sizeof(RDBG_Ctx.last_error));
|
||||||
if (res.kind == OpenKind_Goto) {
|
return true;
|
||||||
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")) {
|
|
||||||
ReportConsolef("Remedybg: OpenSession %S", file);
|
|
||||||
OpenSession(&RDBG_Ctx, file.data, &res);
|
|
||||||
} else {
|
|
||||||
ReportConsolef("Remedybg: CreateSession %S", file);
|
|
||||||
rdbg_Id cfg_id;
|
|
||||||
char *exe = file.data;
|
|
||||||
char *args = NULL;
|
|
||||||
char *work_dir = ProjectDirectory.data;
|
|
||||||
char *env = NULL;
|
|
||||||
AddSessionConfig(&RDBG_Ctx, exe, args, work_dir, env, true, true, &res, &cfg_id);
|
|
||||||
if (ContextHadError(&RDBG_Ctx)) {
|
|
||||||
ReportErrorf("Remedy error: %s", RDBG_Ctx.last_error);
|
|
||||||
MemoryZero(RDBG_Ctx.last_error, sizeof(RDBG_Ctx.last_error));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
SetActiveSessionConfig(&RDBG_Ctx, cfg_id, &res);
|
|
||||||
if (ContextHadError(&RDBG_Ctx)) {
|
|
||||||
ReportErrorf("Remedy error: %s", RDBG_Ctx.last_error);
|
|
||||||
MemoryZero(RDBG_Ctx.last_error, sizeof(RDBG_Ctx.last_error));
|
|
||||||
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