Author: Jonas Devlieghere Date: 2022-08-11T12:36:54-07:00 New Revision: 181c0373d2832afbb62ca50c6c59d9759d17edf7
URL: https://github.com/llvm/llvm-project/commit/181c0373d2832afbb62ca50c6c59d9759d17edf7 DIFF: https://github.com/llvm/llvm-project/commit/181c0373d2832afbb62ca50c6c59d9759d17edf7.diff LOG: [lldb] Simplify TestExec's source code Simplify the test's source code, remove unnecessary headers, and convert it from C++ to C. Added: Modified: lldb/test/API/functionalities/exec/Makefile lldb/test/API/functionalities/exec/main.cpp Removed: ################################################################################ diff --git a/lldb/test/API/functionalities/exec/Makefile b/lldb/test/API/functionalities/exec/Makefile index afc520010ee29..8b9148ea8a355 100644 --- a/lldb/test/API/functionalities/exec/Makefile +++ b/lldb/test/API/functionalities/exec/Makefile @@ -1,4 +1,4 @@ -CXX_SOURCES := main.cpp +C_SOURCES := main.c all: secondprog diff --git a/lldb/test/API/functionalities/exec/main.cpp b/lldb/test/API/functionalities/exec/main.cpp index 51c67d5f232dc..cd4d5f1068fa2 100644 --- a/lldb/test/API/functionalities/exec/main.cpp +++ b/lldb/test/API/functionalities/exec/main.cpp @@ -1,19 +1,10 @@ -#define _POSIX_C_SOURCE 200809L - -#include <cstdio> -#include <cstdlib> -#include <cstring> -#include <libgen.h> -#include <string> +#include <stdio.h> +#include <stdlib.h> #include <unistd.h> int main(int argc, char const **argv) { - char *buf = strdup(argv[0]); // Set breakpoint 1 here - std::string directory_name(::dirname(buf)); - - std::string other_program = directory_name + "/secondprog"; - argv[0] = other_program.c_str(); - execv(argv[0], const_cast<char *const *>(argv)); + // Set breakpoint 1 here + execl("secondprog", "secondprog", NULL); perror("execve"); abort(); } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits