1546 /*ARGSUSED*/
1547 static int
1548 showrev_addversion(void *vers_nv, const mdb_map_t *ignored, const char *object)
1549 {
1550 ctf_file_t *ctfp;
1551 const char *version = NULL;
1552 char *objname;
1553
1554 objname = mdb_alloc(strlen(object) + 1, UM_SLEEP | UM_GC);
1555 (void) strcpy(objname, object);
1556
1557 if ((ctfp = mdb_tgt_name_to_ctf(mdb.m_target, objname)) != NULL)
1558 version = ctf_label_topmost(ctfp);
1559
1560 /*
1561 * Not all objects have CTF and label data, so set version to "Unknown".
1562 */
1563 if (version == NULL)
1564 version = "Unknown";
1565
1566 /*
1567 * The hash table implementation in OVERLOAD mode limits the version
1568 * name to 31 characters because we cannot specify an external name.
1569 * The full version name is available via the ::objects dcmd if needed.
1570 */
1571 (void) mdb_nv_insert(vers_nv, version, NULL, (uintptr_t)objname,
1572 MDB_NV_OVERLOAD);
1573
1574 return (0);
1575 }
1576
1577 static int
1578 showrev_ispatch(const char *s)
1579 {
1580 if (s == NULL)
1581 return (0);
1582
1583 if (*s == 'T')
1584 s++; /* skip T for T-patch */
1585
1586 for (; *s != '\0'; s++) {
1587 if ((*s < '0' || *s > '9') && *s != '-')
1588 return (0);
1589 }
1590
|
1546 /*ARGSUSED*/
1547 static int
1548 showrev_addversion(void *vers_nv, const mdb_map_t *ignored, const char *object)
1549 {
1550 ctf_file_t *ctfp;
1551 const char *version = NULL;
1552 char *objname;
1553
1554 objname = mdb_alloc(strlen(object) + 1, UM_SLEEP | UM_GC);
1555 (void) strcpy(objname, object);
1556
1557 if ((ctfp = mdb_tgt_name_to_ctf(mdb.m_target, objname)) != NULL)
1558 version = ctf_label_topmost(ctfp);
1559
1560 /*
1561 * Not all objects have CTF and label data, so set version to "Unknown".
1562 */
1563 if (version == NULL)
1564 version = "Unknown";
1565
1566 (void) mdb_nv_insert(vers_nv, version, NULL, (uintptr_t)objname,
1567 MDB_NV_OVERLOAD);
1568
1569 return (0);
1570 }
1571
1572 static int
1573 showrev_ispatch(const char *s)
1574 {
1575 if (s == NULL)
1576 return (0);
1577
1578 if (*s == 'T')
1579 s++; /* skip T for T-patch */
1580
1581 for (; *s != '\0'; s++) {
1582 if ((*s < '0' || *s > '9') && *s != '-')
1583 return (0);
1584 }
1585
|