VirtualBox

Changeset 53974 in vbox for trunk/src/VBox/ExtPacks


Ignore:
Timestamp:
Jan 27, 2015 5:50:17 PM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
97876
Message:

VBoxDTrace: Morphing it into an extension pack, adding a wrapper binary, VBoxDTrace, that calls dtrace or the extension pack depending on what it finds. Build fixes for recent linux.

Location:
trunk/src/VBox/ExtPacks/VBoxDTrace
Files:
2 added
1 deleted
3 edited
2 copied
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ExtPacks/VBoxDTrace/Makefile.kmk

    r53972 r53974  
    11# $Id$
    22## @file
    3 # Sub-makefile for VBoxDTraceR0.
     3# Sub-makefile for VBoxDTrace.
    44#
    55# Contributed by: bird
     
    1818#
    1919
    20 SUB_DEPTH = ../../../../../
     20SUB_DEPTH = ../../../../
    2121include $(KBUILD_PATH)/subheader.kmk
    2222
     23
     24#
     25# The generic wrapper that selects native or extpack dtrace cmd and adds our
     26# library path to the command line.
     27#
     28# Note! This is not installed as part of the extension pack, but always shipped
     29#       with the base VBox installation.
     30#
    2331PROGRAMS += VBoxDTrace
    24 VBoxDTrace_TEMPLATE = VBOXR3NPEXE
    25 VBoxDTrace_DEFS = RTMEM_WRAP_TO_EF_APIS
    26 #VBoxDTrace_DEFS += YYDEBUG
    27 VBoxDTrace_SDKS = VBOX_ZLIB
     32VBoxDTrace_TEMPLATE := VBOXR3EXE
     33VBoxDTrace_SOURCES := VBoxDTraceWrapper.cpp
     34VBoxDTrace_LIBS = $(LIB_RUNTIME)
     35
     36
     37#
     38# Install the description.
     39#
     40INSTALLS += VBoxDTraceIns
     41VBoxDTraceIns_TEMPLATE = VBoxInsExtPackDTrace
     42VBoxDTraceIns_SOURCES = \
     43        $(VBoxDTraceIns_0_OUTDIR)/ExtPack.xml \
     44        COPYING=>ExtPack-SourceCodeLicense.txt
     45$(call VBOX_EDIT_VERSION_RULE_FN,VBoxDTraceIns,ExtPack.xml)
     46
     47
     48#
     49# The ring-3 VBoxDTrace command implementation (library).
     50#
     51DLLS += VBoxDTraceCmd
     52VBoxDTraceCmd_TEMPLATE = VBoxR3ExtPackDTrace
     53VBoxDTraceCmd_DEFS = RTMEM_WRAP_TO_EF_APIS
     54#VBoxDTraceCmd_DEFS += YYDEBUG
     55VBoxDTraceCmd_SDKS = VBOX_ZLIB
    2856ifn1of ($(KBUILD_TARGET), win)
    29  VBoxDTrace_CFLAGS = -Wno-format
     57 VBoxDTraceCmd_CFLAGS = -Wno-format -Wno-overlength-strings -Wno-sign-compare -Wno-strict-prototypes -Wno-missing-prototypes -Wno-missing-declarations -Wno-shadow
    3058endif
    31 VBoxDTrace_INCS = \
    32         ../include \
     59VBoxDTraceCmd_INCS = \
     60        include \
    3361        $(VBOXDT_PATH_UTS)/common \
    3462        $(VBOXDT_PATH_LIBCTF)/common \
    3563        $(VBOXDT_PATH_LIBDTRACE)/common \
    3664        $(VBOXDT_PATH_CMN_CTF)
    37 VBoxDTrace_SOURCES = \
     65VBoxDTraceCmd_SOURCES = \
    3866        $(VBOXDT_PATH_CMD)/dtrace/dtrace.c \
    3967        \
     
    7098        $(VBOXDT_PATH_LIBDTRACE)/common/dt_xlator.c \
    7199        \
    72         $(VBoxDTrace_0_OUTDIR)/dt_errtags.c \
    73         $(VBoxDTrace_0_OUTDIR)/dt_names.c \
     100        $(VBoxDTraceCmd_0_OUTDIR)/dt_errtags.c \
     101        $(VBoxDTraceCmd_0_OUTDIR)/dt_names.c \
    74102        \
    75103        $(VBOXDT_PATH_CMN_CTF)/ctf_create.c \
     
    87115
    88116if 1
    89  USES                += yacc
    90  VBoxDTrace_USES     += yacc
    91  VBoxDTrace_YACCTOOL  = BISON
    92  VBoxDTrace_YACCFLAGS = -d -y
    93  VBoxDTrace_SOURCES  += \
     117 USES                   += yacc
     118 VBoxDTraceCmd_USES     += yacc
     119 VBoxDTraceCmd_YACCTOOL  = BISON
     120 VBoxDTraceCmd_YACCFLAGS = -d -y
     121 VBoxDTraceCmd_SOURCES  += \
    94122        $(VBOXDT_PATH_LIBDTRACE)/common/dt_grammar.y
    95  VBoxDTrace_INCS     += $(VBoxDTrace_0_OUTDIR)/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common
     123 VBoxDTraceCmd_INCS     += $(VBoxDTraceCmd_0_OUTDIR)/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common
    96124else
    97125 # TODO: generate these.
     
    99127
    100128if 1
    101  USES                += lex
    102  VBoxDTrace_USES     += lex
    103  VBoxDTrace_LEXTOOL   = FLEX
    104  VBoxDTrace_LEXFLAGS  = -l -B #-d -T
    105  VBoxDTrace_DEFS     += USING_FLEX
    106  VBoxDTrace_SOURCES  += \
     129 USES                   += lex
     130 VBoxDTraceCmd_USES     += lex
     131 VBoxDTraceCmd_LEXTOOL   = FLEX
     132 VBoxDTraceCmd_LEXFLAGS  = -l -B #-d -T
     133 VBoxDTraceCmd_DEFS     += USING_FLEX
     134 VBoxDTraceCmd_SOURCES  += \
    107135        $(VBOXDT_PATH_LIBDTRACE)/common/dt_lex.l
    108136else
     
    110138endif
    111139
    112 VBoxDTrace_LIBS = \
     140VBoxDTraceCmd_LIBS = \
    113141        $(LIB_RUNTIME)
    114142
    115143
    116144# Generate sources
    117 $$(VBoxDTrace_0_OUTDIR)/dt_errtags.c: \
     145$$(VBoxDTraceCmd_0_OUTDIR)/dt_errtags.c: \
    118146                $(VBOXDT_PATH_LIBDTRACE)/common/dt_errtags.h \
    119147                $(VBOXDT_PATH_LIBDTRACE)/common/mkerrtags.sed \
    120148                | $$(dir $$@)
    121         $(MSG_GENERATE,VBoxDTrace,$@,$<)
     149        $(MSG_GENERATE,VBoxDTraceCmd,$@,$<)
    122150        $(SED) -n -f $(VBOXDT_PATH_LIBDTRACE)/common/mkerrtags.sed --output $@ $<
    123151
    124 $$(VBoxDTrace_0_OUTDIR)/dt_names.c: \
     152$$(VBoxDTraceCmd_0_OUTDIR)/dt_names.c: \
    125153                $(VBOXDT_PATH_UTS)/common/sys/dtrace.h \
    126154                $(VBOXDT_PATH_LIBDTRACE)/common/mknames.sed \
    127155                | $$(dir $$@)
    128         $(MSG_GENERATE,VBoxDTrace,$@,$<)
     156        $(MSG_GENERATE,VBoxDTraceCmd,$@,$<)
    129157        $(SED) -n -f $(VBOXDT_PATH_LIBDTRACE)/common/mknames.sed --output $@ $<
    130158
    131159
    132160#
    133 # Sournce not used or wanted: \
     161# Source not used or wanted: \
    134162#       $(VBOXDT_PATH_LIBDTRACE)/common/dt_link.c
    135163#       $(VBOXDT_PATH_LIBDTRACE)/common/dt_pid.c
    136164#
    137165
     166
     167#
     168# The ring-0 part of VBoxDTrace.
     169#
     170SYSMODS += VBoxDTraceR0
     171VBoxDTraceR0_TEMPLATE = VBoxR0ExtPackDTrace
     172VBoxDTraceR0_DEFS = IN_VBOXDTRACE_R0 IN_RT_R0
     173ifeq ($(VBOX_LDR_FMT),elf)
     174 VBoxDTraceR0_LDFLAGS = -e ModuleInit
     175endif
     176VBoxDTraceR0_INCS = \
     177        include \
     178        $(VBOXDT_PATH_UTS)/common
     179VBoxDTraceR0_SOURCES = \
     180        VBoxDTraceR0.cpp \
     181        VBoxDTraceR0A.asm \
     182        $(VBOXDT_PATH_UTS)/common/dtrace/dtrace.c
     183VBoxDTraceR0_LIBS = \
     184        $(PATH_STAGE_LIB)/RuntimeR0$(VBOX_SUFF_LIB)
     185ifneq ($(filter pe lx,$(VBOX_LDR_FMT)),)
     186 VBoxDTraceR0_LIBS += \
     187        $(PATH_STAGE_LIB)/SUPR0$(VBOX_SUFF_LIB)
     188endif
     189
     190
    138191include $(FILE_KBUILD_SUB_FOOTER)
    139192
  • trunk/src/VBox/ExtPacks/VBoxDTrace/include/VBoxDTraceLibCWrappers.h

    r53716 r53974  
    2929#else
    3030# include <sys/types.h>
     31# include <limits.h>        /* Workaround for syslimit.h bug in gcc 4.8.3 on gentoo. */
    3132# include <syslimits.h>     /* PATH_MAX */
    3233# include <libgen.h>        /* basename */
  • trunk/src/VBox/ExtPacks/VBoxDTrace/include/VBoxDTraceTypes.h

    r53716 r53974  
    2424#include <iprt/types.h>
    2525#include <iprt/stdarg.h>
     26#include <iprt/assert.h>
    2627#include <iprt/param.h>
    2728#include <iprt/errno.h>
     
    3233# include <sys/types.h>
    3334# include <limits.h>
     35# ifdef RT_OS_LINUX
     36#  include <sys/ucontext.h> /* avoid greg_t trouble */
     37# endif
    3438# if defined(_MSC_VER)
    3539#  include <stdio.h>
     
    4852typedef uint64_t                    u_longlong_t;
    4953typedef uint64_t                    hrtime_t;
     54#if !defined(NGREG) || !defined(RT_OS_LINUX)
    5055typedef RTCCINTREG                  greg_t;
     56#else
     57AssertCompileSize(greg_t, sizeof(RTCCINTREG));
     58#endif
    5159typedef uintptr_t                   pc_t;
    5260typedef uint32_t                    id_t;
  • trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/dtrace.c

    r53716 r53974  
    12361236}
    12371237
     1238#ifdef VBOX
     1239DECLEXPORT(int) RTCALL VBoxDTraceMain(int argc, char **argv)
     1240#else
    12381241int
    12391242main(int argc, char *argv[])
     1243#endif
    12401244{
    12411245        dtrace_bufdesc_t buf;
     
    12531257        struct ps_prochandle *P;
    12541258        pid_t pid;
     1259
     1260        g_pname = basename(argv[0]);
    12551261#else
    12561262        int c;
     
    12591265        RTGETOPTSTATE GetState;
    12601266
    1261         err = RTR3InitExe(argc, &argv, RTR3INIT_FLAGS_SUPLIB);
     1267        err = RTR3InitDll(0);
    12621268        if (RT_FAILURE(err))
    12631269                return RTMsgInitFailure(err);
     
    12651271
    12661272        g_ofp = stdout;
    1267 #endif
    1268         g_pname = basename(argv[0]);
     1273        g_pname = RTProcShortName();
     1274#endif
    12691275
    12701276        if (argc == 1)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette