Author: markj
Date: Sat Jul 30 03:09:57 2016
New Revision: 303534
URL: https://svnweb.freebsd.org/changeset/base/303534

Log:
  libdtrace: Don't hard-code the native data model.
  
  MFC after:    1 month

Modified:
  head/cddl/contrib/opensolaris/lib/libdtrace/arm/dt_isadep.c
  head/cddl/contrib/opensolaris/lib/libdtrace/i386/dt_isadep.c

Modified: head/cddl/contrib/opensolaris/lib/libdtrace/arm/dt_isadep.c
==============================================================================
--- head/cddl/contrib/opensolaris/lib/libdtrace/arm/dt_isadep.c Sat Jul 30 
03:09:23 2016        (r303533)
+++ head/cddl/contrib/opensolaris/lib/libdtrace/arm/dt_isadep.c Sat Jul 30 
03:09:57 2016        (r303534)
@@ -38,9 +38,7 @@
 #include <dt_impl.h>
 #include <dt_pid.h>
 
-#if !defined(sun)
-#define PR_MODEL_ILP32 1
-#define PR_MODEL_LP64  2
+#ifdef __FreeBSD__
 #include <libproc_compat.h>
 #endif
 

Modified: head/cddl/contrib/opensolaris/lib/libdtrace/i386/dt_isadep.c
==============================================================================
--- head/cddl/contrib/opensolaris/lib/libdtrace/i386/dt_isadep.c        Sat Jul 
30 03:09:23 2016        (r303533)
+++ head/cddl/contrib/opensolaris/lib/libdtrace/i386/dt_isadep.c        Sat Jul 
30 03:09:57 2016        (r303534)
@@ -39,9 +39,8 @@
 
 #include <dis_tables.h>
 
-#ifndef illumos
-#define PR_MODEL_ILP32 1
-#define PR_MODEL_LP64  2
+#ifdef __FreeBSD__
+#include <libproc.h>
 #include <libproc_compat.h>
 #endif
 
@@ -93,11 +92,7 @@ dt_pid_has_jump_table(struct ps_prochand
        char dmodel = Pstatus(P)->pr_dmodel;
 #else
        pid_t pid = proc_getpid(P);
-#if __i386__
-       char dmodel = PR_MODEL_ILP32;
-#elif __amd64__
-       char dmodel = PR_MODEL_LP64;
-#endif
+       char dmodel = proc_getmodel(P);
 #endif
 
        /*
@@ -149,11 +144,7 @@ dt_pid_create_return_probe(struct ps_pro
        char dmodel = Pstatus(P)->pr_dmodel;
 #else
        pid_t pid = proc_getpid(P);
-#if __i386__
-       char dmodel = PR_MODEL_ILP32;
-#elif __amd64__
-       char dmodel = PR_MODEL_LP64;
-#endif
+       char dmodel = proc_getmodel(P);
 #endif
 
        /*
@@ -310,11 +301,7 @@ dt_pid_create_offset_probe(struct ps_pro
                char dmodel = Pstatus(P)->pr_dmodel;
 #else
                pid_t pid = proc_getpid(P);
-#if __i386__
-               char dmodel = PR_MODEL_ILP32;
-#elif __amd64__
-               char dmodel = PR_MODEL_LP64;
-#endif
+               char dmodel = proc_getmodel(P);
 #endif
 
                if ((text = malloc(symp->st_size)) == NULL) {
@@ -393,11 +380,7 @@ dt_pid_create_glob_offset_probes(struct 
        char dmodel = Pstatus(P)->pr_dmodel;
 #else
        pid_t pid = proc_getpid(P);
-#if __i386__
-       char dmodel = PR_MODEL_ILP32;
-#elif __amd64__
-       char dmodel = PR_MODEL_LP64;
-#endif
+       char dmodel = proc_getmodel(P);
 #endif
 
        ftp->ftps_type = DTFTP_OFFSETS;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to