Exemplo n.º 1
0
int
mdb_ctf_type_resolve(mdb_ctf_id_t mid, mdb_ctf_id_t *outp)
{
	ctf_id_t id;
	mdb_ctf_impl_t *idp = (mdb_ctf_impl_t *)∣

	if ((id = ctf_type_resolve(idp->mci_fp, idp->mci_id)) == CTF_ERR) {
		if (outp)
			mdb_ctf_type_invalidate(outp);
		return (set_errno(ctf_to_errno(ctf_errno(idp->mci_fp))));
	}

	if (ctf_type_kind(idp->mci_fp, id) == CTF_K_FORWARD) {
		char name[MDB_SYM_NAMLEN];
		mdb_ctf_id_t lookup_id;

		if (ctf_type_name(idp->mci_fp, id, name, sizeof (name)) !=
		    NULL &&
		    mdb_ctf_lookup_by_name(name, &lookup_id) == 0 &&
		    outp != NULL) {
			*outp = lookup_id;
			return (0);
		}
	}

	if (outp != NULL)
		set_ctf_id(outp, idp->mci_fp, id);

	return (0);
}
Exemplo n.º 2
0
static int
ttrace_ttr_size_check(void)
{
	mdb_ctf_id_t ttrtid;
	ssize_t ttr_size;

	if (mdb_ctf_lookup_by_name("trap_trace_rec_t", &ttrtid) != 0 ||
	    mdb_ctf_type_resolve(ttrtid, &ttrtid) != 0) {
		mdb_warn("failed to determine size of trap_trace_rec_t; "
		    "non-TRAPTRACE kernel?\n");
		return (0);
	}

	if ((ttr_size = mdb_ctf_type_size(ttrtid)) !=
	    sizeof (trap_trace_rec_t)) {
		/*
		 * On Intel machines, this will happen when TTR_STACK_DEPTH
		 * is changed.  This code could be smarter, and could
		 * dynamically adapt to different depths, but not until a
		 * need for such adaptation is demonstrated.
		 */
		mdb_warn("size of trap_trace_rec_t (%d bytes) doesn't "
		    "match expected %d\n", ttr_size, sizeof (trap_trace_rec_t));
		return (0);
	}

	return (1);
}
Exemplo n.º 3
0
int
mdb_tab_complete_member(mdb_tab_cookie_t *mcp, const char *type,
    const char *member)
{
	mdb_ctf_id_t id;

	if (mdb_ctf_lookup_by_name(type, &id) != 0)
		return (-1);

	return (mdb_tab_complete_member_by_id(mcp, id, member));
}
Exemplo n.º 4
0
const mdb_modinfo_t *
_mdb_init(void)
{
	if (mdb_ctf_lookup_by_name("enum rep_protocol_requestid",
	    &request_enum) == -1) {
		mdb_warn("enum rep_protocol_requestid not found");
	}
	if (mdb_ctf_lookup_by_name("enum rep_protocol_responseid",
	    &response_enum) == -1) {
		mdb_warn("enum rep_protocol_responseid not found");
	}
	if (mdb_ctf_lookup_by_name("enum rc_ptr_type",
	    &ptr_type_enum) == -1) {
		mdb_warn("enum rc_ptr_type not found");
	}
	if (mdb_ctf_lookup_by_name("enum thread_state",
	    &thread_state_enum) == -1) {
		mdb_warn("enum thread_state not found");
	}
	return (&modinfo);
}