Deleted Added
full compact
dt_print.c (256281) dt_print.c (268578)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 633 unchanged lines hidden (view full) ---

642dtrace_print(dtrace_hdl_t *dtp, FILE *fp, const char *typename,
643 caddr_t addr, size_t len)
644{
645 const char *s;
646 char *object;
647 dt_printarg_t pa;
648 ctf_id_t id;
649 dt_module_t *dmp;
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 633 unchanged lines hidden (view full) ---

642dtrace_print(dtrace_hdl_t *dtp, FILE *fp, const char *typename,
643 caddr_t addr, size_t len)
644{
645 const char *s;
646 char *object;
647 dt_printarg_t pa;
648 ctf_id_t id;
649 dt_module_t *dmp;
650 ctf_file_t *ctfp;
651 int libid;
650
651 /*
652 * Split the fully-qualified type ID (module`id). This should
653 * always be the format, but if for some reason we don't find the
654 * expected value, return 0 to fall back to the generic trace()
652
653 /*
654 * Split the fully-qualified type ID (module`id). This should
655 * always be the format, but if for some reason we don't find the
656 * expected value, return 0 to fall back to the generic trace()
655 * behavior.
657 * behavior. In the case of userland CTF modules this will actually be
658 * of the format (module`lib`id). This is due to the fact that those
659 * modules have multiple CTF containers which `lib` identifies.
656 */
657 for (s = typename; *s != '\0' && *s != '`'; s++)
658 ;
659
660 if (*s != '`')
661 return (0);
662
663 object = alloca(s - typename + 1);
664 bcopy(typename, object, s - typename);
665 object[s - typename] = '\0';
660 */
661 for (s = typename; *s != '\0' && *s != '`'; s++)
662 ;
663
664 if (*s != '`')
665 return (0);
666
667 object = alloca(s - typename + 1);
668 bcopy(typename, object, s - typename);
669 object[s - typename] = '\0';
670 dmp = dt_module_lookup_by_name(dtp, object);
671 if (dmp == NULL)
672 return (0);
673
674 if (dmp->dm_pid != 0) {
675 libid = atoi(s + 1);
676 s = strchr(s + 1, '`');
677 if (s == NULL || libid > dmp->dm_nctflibs)
678 return (0);
679 ctfp = dmp->dm_libctfp[libid];
680 } else {
681 ctfp = dt_module_getctf(dtp, dmp);
682 }
683
666 id = atoi(s + 1);
667
668 /*
669 * Try to get the CTF kind for this id. If something has gone horribly
670 * wrong and we can't resolve the ID, bail out and let trace() do the
671 * work.
672 */
684 id = atoi(s + 1);
685
686 /*
687 * Try to get the CTF kind for this id. If something has gone horribly
688 * wrong and we can't resolve the ID, bail out and let trace() do the
689 * work.
690 */
673 dmp = dt_module_lookup_by_name(dtp, object);
674 if (dmp == NULL || ctf_type_kind(dt_module_getctf(dtp, dmp),
675 id) == CTF_ERR) {
691 if (ctfp == NULL || ctf_type_kind(ctfp, id) == CTF_ERR)
676 return (0);
692 return (0);
677 }
678
679 /* setup the print structure and kick off the main print routine */
680 pa.pa_dtp = dtp;
681 pa.pa_addr = addr;
693
694 /* setup the print structure and kick off the main print routine */
695 pa.pa_dtp = dtp;
696 pa.pa_addr = addr;
682 pa.pa_ctfp = dt_module_getctf(dtp, dmp);
697 pa.pa_ctfp = ctfp;
683 pa.pa_nest = 0;
684 pa.pa_depth = 0;
685 pa.pa_file = fp;
686 (void) ctf_type_visit(pa.pa_ctfp, id, dt_print_member, &pa);
687
688 dt_print_trailing_braces(&pa, 0);
689
690 return (len);
691}
698 pa.pa_nest = 0;
699 pa.pa_depth = 0;
700 pa.pa_file = fp;
701 (void) ctf_type_visit(pa.pa_ctfp, id, dt_print_member, &pa);
702
703 dt_print_trailing_braces(&pa, 0);
704
705 return (len);
706}