Skip to content

Commit

Permalink
Debug LLDB test
Browse files Browse the repository at this point in the history
  • Loading branch information
plemarquand committed Nov 22, 2024
1 parent 3753c12 commit a328da3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
8 changes: 7 additions & 1 deletion src/debugger/lldb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,24 +133,30 @@ export async function getLldbProcess(
ctx: WorkspaceContext
): Promise<Array<{ pid: number; label: string }> | undefined> {
try {
console.log(">>> Get LLDB 1");
// use LLDB to get list of processes
const lldb = await ctx.toolchain.getLLDB();
console.log(">>> Get LLDB 2", lldb);
const { stdout } = await execFile(lldb, [
"--batch",
"--no-lldbinit",
"--one-line",
"platform process list --show-args --all-users",
]);
console.log(">>> Get LLDB 3", stdout);
const entries = stdout.split("\n");
return entries.flatMap(line => {
const processes = entries.flatMap(line => {
const match = /^(\d+)\s+\d+\s+\S+\s+\S+\s+(.+)$/.exec(line);
if (match) {
return [{ pid: parseInt(match[1]), label: `${match[1]}: ${match[2]}` }];
} else {
return [];
}
});
console.log(">>> Get LLDB 4", processes);
return processes;
} catch (error) {
console.log(">>> Get LLDB error", error);
const errorMessage = `Failed to run LLDB: ${getErrorDescription(error)}`;
ctx.outputChannel.log(errorMessage);
vscode.window.showErrorMessage(errorMessage);
Expand Down
9 changes: 2 additions & 7 deletions src/ui/SwiftOutputChannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,10 @@ export class SwiftOutputChannel implements vscode.OutputChannel {
}

logDiagnostic(message: string, label?: string) {
if (!configuration.diagnostics) {
if (!configuration.diagnostics && process.env["CI"] !== "1") {
return;
}
let fullMessage: string;
if (label !== undefined) {
fullMessage = `${label}: ${message}`;
} else {
fullMessage = message;
}
const fullMessage = label !== undefined ? `${label}: ${message}` : message;
this.appendLine(`${this.nowFormatted}: ${fullMessage}`);
}

Expand Down
4 changes: 3 additions & 1 deletion test/integration-tests/debugger/lldb.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { getLLDBLibPath, getLldbProcess } from "../../../src/debugger/lldb";
import { WorkspaceContext } from "../../../src/WorkspaceContext";
import { activateExtensionForSuite } from "../utilities/testutilities";

suite("lldb contract test suite", () => {
suite.only("lldb contract test suite", () => {
let workspaceContext: WorkspaceContext;

activateExtensionForSuite({
Expand All @@ -27,6 +27,7 @@ suite("lldb contract test suite", () => {
});

test("getLldbProcess Contract Test, make sure the command returns", async () => {
console.log(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> start 30");
const result = await getLldbProcess(workspaceContext);

// Assumption: machine will always return some process
Expand All @@ -40,6 +41,7 @@ suite("lldb contract test suite", () => {
});

test("getLLDBLibPath Contract Test, make sure we can find lib LLDB", async () => {
console.log(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> start 44");
const libPath = await getLLDBLibPath(workspaceContext.toolchain);

// Check the result for various platforms
Expand Down

0 comments on commit a328da3

Please sign in to comment.