[compiler-rt] r215185 - Support getting process maps for sanitizers needs on FreeBSD in 32-bit mode
Viktor Kutuzov
vkutuzov at accesssoftek.com
Thu Aug 7 23:21:09 PDT 2014
Author: vkutuzov
Date: Fri Aug 8 01:21:09 2014
New Revision: 215185
URL: http://llvm.org/viewvc/llvm-project?rev=215185&view=rev
Log:
Support getting process maps for sanitizers needs on FreeBSD in 32-bit mode
Differential Revision: http://reviews.llvm.org/D4807
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_freebsd.h
compiler-rt/trunk/lib/sanitizer_common/sanitizer_procmaps_freebsd.cc
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_freebsd.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_freebsd.h?rev=215185&r1=215184&r2=215185&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_freebsd.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_freebsd.h Fri Aug 8 01:21:09 2014
@@ -23,10 +23,13 @@
# include <osreldate.h>
# if __FreeBSD_version <= 902001 // v9.2
# include <link.h>
+# include <sys/param.h>
# include <ucontext.h>
namespace __sanitizer {
+typedef unsigned long long __xuint64_t;
+
typedef __int32_t __xregister_t;
typedef struct __xmcontext {
@@ -75,6 +78,29 @@ typedef struct __xucontext {
int __spare__[4];
} xucontext_t;
+struct xkinfo_vmentry {
+ int kve_structsize;
+ int kve_type;
+ __xuint64_t kve_start;
+ __xuint64_t kve_end;
+ __xuint64_t kve_offset;
+ __xuint64_t kve_vn_fileid;
+ __uint32_t kve_vn_fsid;
+ int kve_flags;
+ int kve_resident;
+ int kve_private_resident;
+ int kve_protection;
+ int kve_ref_count;
+ int kve_shadow_count;
+ int kve_vn_type;
+ __xuint64_t kve_vn_size;
+ __uint32_t kve_vn_rdev;
+ __uint16_t kve_vn_mode;
+ __uint16_t kve_status;
+ int _kve_ispare[12];
+ char kve_path[PATH_MAX];
+};
+
typedef struct {
__uint32_t p_type;
__uint32_t p_offset;
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_procmaps_freebsd.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_procmaps_freebsd.cc?rev=215185&r1=215184&r2=215185&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_procmaps_freebsd.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_procmaps_freebsd.cc Fri Aug 8 01:21:09 2014
@@ -20,6 +20,14 @@
#include <sys/sysctl.h>
#include <sys/user.h>
+// Fix 'kinfo_vmentry' definition on FreeBSD prior v9.2 in 32-bit mode.
+#if SANITIZER_FREEBSD && (SANITIZER_WORDSIZE == 32)
+# include <osreldate.h>
+# if __FreeBSD_version <= 902001 // v9.2
+# define kinfo_vmentry xkinfo_vmentry
+# endif
+#endif
+
namespace __sanitizer {
void ReadProcMaps(ProcSelfMapsBuff *proc_maps) {
More information about the llvm-commits
mailing list