| 1591 | } |
| 1592 | |
| 1593 | static bool |
| 1594 | prof_dump_file(tsd_t *tsd, bool propagate_err, const char *filename, |
| 1595 | bool leakcheck, prof_tdata_t *tdata, |
| 1596 | struct prof_tdata_merge_iter_arg_s *prof_tdata_merge_iter_arg, |
| 1597 | struct prof_gctx_merge_iter_arg_s *prof_gctx_merge_iter_arg, |
| 1598 | struct prof_gctx_dump_iter_arg_s *prof_gctx_dump_iter_arg, |
| 1599 | prof_gctx_tree_t *gctxs) { |
| 1600 | /* Create dump file. */ |
| 1601 | if ((prof_dump_fd = prof_dump_open(propagate_err, filename)) == -1) { |
| 1602 | return true; |
| 1603 | } |
| 1604 | |
| 1605 | /* Dump profile header. */ |
| 1606 | if (prof_dump_header(tsd_tsdn(tsd), propagate_err, |
| 1607 | &prof_tdata_merge_iter_arg->cnt_all)) { |
| 1608 | goto label_write_error; |
| 1609 | } |
| 1610 | |
| 1611 | /* Dump per gctx profile stats. */ |
| 1612 | prof_gctx_dump_iter_arg->tsdn = tsd_tsdn(tsd); |
| 1613 | prof_gctx_dump_iter_arg->propagate_err = propagate_err; |
| 1614 | if (gctx_tree_iter(gctxs, NULL, prof_gctx_dump_iter, |
| 1615 | (void *)prof_gctx_dump_iter_arg) != NULL) { |
| 1616 | goto label_write_error; |
| 1617 | } |
| 1618 | |
| 1619 | /* Dump /proc/<pid>/maps if possible. */ |
| 1620 | if (prof_dump_maps(propagate_err)) { |
| 1621 | goto label_write_error; |
| 1622 | } |
| 1623 | |
| 1624 | if (prof_dump_close(propagate_err)) { |
| 1625 | return true; |
| 1626 | } |
| 1627 | |
| 1628 | return false; |
| 1629 | label_write_error: |
| 1630 | prof_dump_close(propagate_err); |
| 1631 | return true; |
| 1632 | } |
| 1633 | |
| 1634 | static bool |
| 1635 | prof_dump(tsd_t *tsd, bool propagate_err, const char *filename, |
no test coverage detected