[PATCH] D46518: LLDB - Simplify GetProgramFileSpec
David CARLIER via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 9 09:09:08 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL371417: LLDB - Simplify GetProgramFileSpec (authored by devnexen, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D46518?vs=145443&id=219367#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D46518/new/
https://reviews.llvm.org/D46518
Files:
lldb/trunk/source/Host/freebsd/HostInfoFreeBSD.cpp
Index: lldb/trunk/source/Host/freebsd/HostInfoFreeBSD.cpp
===================================================================
--- lldb/trunk/source/Host/freebsd/HostInfoFreeBSD.cpp
+++ lldb/trunk/source/Host/freebsd/HostInfoFreeBSD.cpp
@@ -64,13 +64,10 @@
static FileSpec g_program_filespec;
if (!g_program_filespec) {
int exe_path_mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, getpid()};
- size_t exe_path_size;
- if (sysctl(exe_path_mib, 4, NULL, &exe_path_size, NULL, 0) == 0) {
- char *exe_path = new char[exe_path_size];
- if (sysctl(exe_path_mib, 4, exe_path, &exe_path_size, NULL, 0) == 0)
- g_program_filespec.SetFile(exe_path, FileSpec::Style::native);
- delete[] exe_path;
- }
+ char exe_path[PATH_MAX];
+ size_t exe_path_size = sizeof(exe_path);
+ if (sysctl(exe_path_mib, 4, exe_path, &exe_path_size, NULL, 0) == 0)
+ g_program_filespec.SetFile(exe_path, false);
}
return g_program_filespec;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46518.219367.patch
Type: text/x-patch
Size: 974 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190909/dd458d70/attachment.bin>
More information about the llvm-commits
mailing list