Print this page
4159 dtrace ignores all ustack helper frames from dead processes
Reviewed by: Bryan Cantrill <bryan@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libdtrace/common/dt_consume.c
          +++ new/usr/src/lib/libdtrace/common/dt_consume.c
↓ open down ↓ 1373 lines elided ↑ open up ↑
1374 1374  
1375 1375                          if (pc[i] > sym.st_value) {
1376 1376                                  (void) snprintf(c, sizeof (c),
1377 1377                                      "%s`%s+0x%llx", dt_basename(objname), name,
1378 1378                                      (u_longlong_t)(pc[i] - sym.st_value));
1379 1379                          } else {
1380 1380                                  (void) snprintf(c, sizeof (c),
1381 1381                                      "%s`%s", dt_basename(objname), name);
1382 1382                          }
1383 1383                  } else if (str != NULL && str[0] != '\0' && str[0] != '@' &&
1384      -                    (P != NULL && ((map = Paddr_to_map(P, pc[i])) == NULL ||
1385      -                    (map->pr_mflags & MA_WRITE)))) {
     1384 +                    (P == NULL || (map = Paddr_to_map(P, pc[i])) == NULL ||
     1385 +                    map->pr_mflags & MA_WRITE)) {
1386 1386                          /*
1387 1387                           * If the current string pointer in the string table
1388 1388                           * does not point to an empty string _and_ the program
1389 1389                           * counter falls in a writable region, we'll use the
1390 1390                           * string from the string table instead of the raw
1391 1391                           * address.  This last condition is necessary because
1392 1392                           * some (broken) ustack helpers will return a string
1393 1393                           * even for a program counter that they can't
1394 1394                           * identify.  If we have a string for a program
1395 1395                           * counter that falls in a segment that isn't
1396 1396                           * writable, we assume that we have fallen into this
1397      -                         * case and we refuse to use the string.
     1397 +                         * case and we refuse to use the string.  Finally,
     1398 +                         * note that if we could not grab the process (e.g.,
     1399 +                         * because it exited), the information from the helper
     1400 +                         * is better than nothing.
1398 1401                           */
1399 1402                          (void) snprintf(c, sizeof (c), "%s", str);
1400 1403                  } else {
1401 1404                          if (P != NULL && Pobjname(P, pc[i], objname,
1402 1405                              sizeof (objname)) != NULL) {
1403 1406                                  (void) snprintf(c, sizeof (c), "%s`0x%llx",
1404 1407                                      dt_basename(objname), (u_longlong_t)pc[i]);
1405 1408                          } else {
1406 1409                                  (void) snprintf(c, sizeof (c), "0x%llx",
1407 1410                                      (u_longlong_t)pc[i]);
↓ open down ↓ 1645 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX