[PATCH] Support getting process maps for sanitizers needs on FreeBSD in 32-bit mode
Viktor Kutuzov
vkutuzov at accesssoftek.com
Thu Aug 7 23:30:22 PDT 2014
Closed by commit rL215185 (authored by vkutuzov).
REPOSITORY
rL LLVM
http://reviews.llvm.org/D4807
Files:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_freebsd.h
compiler-rt/trunk/lib/sanitizer_common/sanitizer_procmaps_freebsd.cc
Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_freebsd.h
===================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_freebsd.h
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_freebsd.h
@@ -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 @@
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;
Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_procmaps_freebsd.cc
===================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_procmaps_freebsd.cc
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_procmaps_freebsd.cc
@@ -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) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4807.12299.patch
Type: text/x-patch
Size: 1892 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140808/57e055db/attachment.bin>
More information about the llvm-commits
mailing list