/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#include <sys/sysmacros.h>
#include <strings.h>
#include <alloca.h>
#include <assert.h>
#include <stdlib.h>
#include <errno.h>
#include <limits.h>
#include <dt_impl.h>
#include <dt_strtab.h>
#include <dt_program.h>
#include <dt_provider.h>
#include <dt_xlator.h>
#include <dt_dof.h>
void
{
}
void
{
}
static int
{
return (-1); /* errno is set for us */
for (i = 0; i < nx; i++) {
}
return (0);
}
/*
* Add a loadable DOF section to the file using the specified data buffer and
* the specified DOF section attributes. DOF_SECF_LOAD must be set in flags.
* If 'data' is NULL, the caller is responsible for manipulating the ldata buf.
*/
static dof_secidx_t
{
dof_sec_t s;
s.dofs_align = align;
s.dofs_entsize = entsize;
}
/*
* Add an unloadable DOF section to the file using the specified data buffer
* and DOF section attributes. DOF_SECF_LOAD must *not* be set in flags.
* If 'data' is NULL, the caller is responsible for manipulating the udata buf.
*/
static dof_secidx_t
{
dof_sec_t s;
s.dofs_align = align;
s.dofs_entsize = entsize;
}
/*
* Add a string to the global string table associated with the DOF. The offset
* of the string is returned as an index into the string table.
*/
static dof_stridx_t
{
if (i != 0 && (s == NULL || *s == '\0'))
return (0); /* string table has \0 at offset 0 */
return (i);
}
static dof_attr_t
{
}
static dof_secidx_t
{
DOF_SECT_DIF, sizeof (dif_instr_t), 0,
}
DOF_SECT_INTTAB, sizeof (uint64_t), 0,
}
}
}
/*
* dtdo_xlmtab contains pointers to the translator members.
* The translator itself is in sect ddo_xlimport[dxp->dx_id].
* The XLMEMBERS entries are in order by their dn_membid, so
* the member section offset is the population count of bits
* in ddo_pgp->dp_xlrefs[] up to and not including dn_membid.
*/
}
sizeof (dof_secidx_t), 0, sizeof (dof_xlref_t),
}
/*
* Copy the return type and the array of section indices that form the
* DIFO into a single dof_difohdr_t and then add DOF_SECT_DIFOHDR.
*/
sizeof (dof_secidx_t), 0, 0,
/*
* Add any other sections related to dtrace_difo_t. These are not
* referenced in dof_difohdr_t because they are not used by emulation.
*/
sizeof (uint64_t), 0, sizeof (dof_relodesc_t),
/*
* This code assumes the target of all relocations is the
* integer table 'intsec' (DOF_SECT_INTTAB). If other sections
* need relocation in the future this will need to change.
*/
sizeof (dof_secidx_t), 0, 0, sizeof (dof_relohdr_t));
}
sizeof (uint64_t), 0, sizeof (dof_relodesc_t),
/*
* This code assumes the target of all relocations is the
* integer table 'intsec' (DOF_SECT_INTTAB). If other sections
* need relocation in the future this will need to change.
*/
sizeof (dof_secidx_t), 0, 0, sizeof (dof_relohdr_t));
}
return (hdrsec);
}
static void
{
uint_t i = 0;
return; /* translator has already been emitted */
/*
* Generate an array of dof_xlmember_t's into ddo_xlms. If we are
* importing the translator, add only those members referenced by the
* program and set the dofxm_difo reference of each member to NONE. If
* we're exporting the translator, add all members and a DIFO for each.
*/
if (type == DOF_SECT_XLIMPORT) {
continue; /* member is not referenced */
} else {
}
}
}
/*ARGSUSED*/
static int
{
uint_t i;
dofpr.dofpr_addr = 0;
}
}
}
dofpr.dofpr_pad1 = 0;
dofpr.dofpr_pad2 = 0;
/*
* There should be one probe offset or is-enabled probe offset
* or else this probe instance won't have been created. The
* kernel will reject DOF which has a probe with no offsets.
*/
/*
* If pi_rname isn't set, the relocation will be against the
* function name. If it is, the relocation will be against
* pi_rname. This will be used if the function is scoped
* locally so an alternate symbol is added for the purpose
* of this relocation.
*/
else
}
return (0);
}
static void
{
id_t i;
return; /* ignore providers that are exported by dtrace(7D) */
/*
* For each translator referenced by the provider (pv_xrefs), emit an
* exported translator section for it if one hasn't been created yet.
*/
}
}
sizeof (uint64_t), 0, sizeof (dof_probe_t),
} else {
}
sizeof (dof_secidx_t), 0, 0, sizeof (dof_provider_t));
sizeof (uint64_t), 0, sizeof (dof_relodesc_t),
sizeof (dof_secidx_t), 0, 0, sizeof (dof_relohdr_t));
sizeof (dof_secidx_t), 0, sizeof (dof_secidx_t),
}
}
static int
{
/*
* If our config values cannot fit in a uint8_t, we can't generate a
* DOF header since the values won't fit. This can only happen if the
* user forcibly compiles a program with an artificial configuration.
*/
else
return (0);
}
void *
{
dof_hdr_t h;
char *fmt;
uint_t i;
if (flags & ~DTRACE_D_MASK) {
return (NULL);
}
return (NULL);
return (NULL);
/*
* Iterate through the statement list computing the maximum number of
* actions and the maximum format string for allocating local buffers.
*/
i = dtrace_printf_format(dtp,
}
continue; /* same ecb as previous statement */
i++;
}
/*
* If there are references to dynamic translators in the program, add
* an imported translator table entry for each referenced translator.
*/
if (pgp->dp_xrefslen != 0) {
}
}
/*
* Now iterate through the statement list, creating the DOF section
* headers and data for each one and adding them to our buffers.
*/
uint_t i;
continue; /* same ecb as previous statement */
/*
* Add a DOF_SECT_PROBEDESC for the ECB's probe description,
* and copy the probe description strings into the string table.
*/
sizeof (dof_secidx_t), 0,
sizeof (dof_probedesc_t), sizeof (dof_probedesc_t));
/*
* If there is a predicate DIFO associated with the ecbdesc,
* write out the DIFO sections and save the DIFO section index.
*/
/*
* Now iterate through the action list generating DIFOs as
* referenced therein and adding action descriptions to 'dofa'.
*/
} else
/*
* If the first action in a statement has format data,
* add the format string to the global string table.
*/
(void) dtrace_printf_format(dtp,
} else
strndx = 0; /* use dtad_arg instead */
else
}
if (strndx != 0) {
} else {
}
}
if (i > 0) {
sizeof (uint64_t), 0, sizeof (dof_actdesc_t),
sizeof (dof_actdesc_t) * i);
}
/*
* Now finally, add the DOF_SECT_ECBDESC referencing all the
* previously created sub-sections.
*/
sizeof (uint64_t), 0, 0, sizeof (dof_ecbdesc_t));
}
/*
* If any providers are user-defined, output DOF sections corresponding
* to the providers and the probes and arguments that they define.
*/
if (flags & DTRACE_D_PROBES) {
}
/*
* If we're not stripping unloadable sections, generate compiler
* comments and any other unloadable miscellany.
*/
if (!(flags & DTRACE_D_STRIP)) {
sizeof (char), 0, 0, sizeof (struct utsname));
}
/*
* Compute and fill in the appropriate values for the dof_hdr_t's
* dofh_secnum, dofh_loadsz, and dofh_filez values.
*/
h.dofh_loadsz = ssize +
} else {
lsize = h.dofh_loadsz;
h.dofh_filesz = lsize;
}
/*
* Set the global DOF_SECT_STRTAB's offset to be after the header,
* section headers, and other loadable data. Since we're going to
* iterate over the buffer data directly, we must check for errors.
*/
(void) dt_set_errno(dtp, i);
return (NULL);
}
/*
* Now relocate all the other section headers by adding the appropriate
* delta to their respective dofs_offset values.
*/
if (i == ddo->ddo_strsec)
continue; /* already relocated above */
else
}
/*
* Finally, assemble the complete in-memory DOF buffer by writing the
* header and then concatenating all our buffers. dt_buf_concat() will
* propagate any errors and cause dt_buf_claim() to return NULL.
*/
}
void
{
}
void *
{
for (i = 0; i < DTRACEOPT_MAX; i++) {
nopts++;
}
return (NULL);
}
/*
* Fill in the option section header...
*/
for (i = 0; i < DTRACEOPT_MAX; i++) {
continue;
dofo->dofo_option = i;
dofo++;
}
return (dof);
}
void *
{
return (NULL);
}