| 1862 | } |
| 1863 | |
| 1864 | static bool |
| 1865 | prof_dump_file(tsd_t *tsd, bool propagate_err, const char *filename, |
| 1866 | bool leakcheck, prof_tdata_t *tdata, |
| 1867 | struct prof_tdata_merge_iter_arg_s *prof_tdata_merge_iter_arg, |
| 1868 | struct prof_gctx_merge_iter_arg_s *prof_gctx_merge_iter_arg, |
| 1869 | struct prof_gctx_dump_iter_arg_s *prof_gctx_dump_iter_arg, |
| 1870 | prof_gctx_tree_t *gctxs) { |
| 1871 | /* Create dump file. */ |
| 1872 | if ((prof_dump_fd = prof_dump_open(propagate_err, filename)) == -1) { |
| 1873 | return true; |
| 1874 | } |
| 1875 | |
| 1876 | /* Dump profile header. */ |
| 1877 | if (prof_dump_header(tsd_tsdn(tsd), propagate_err, |
| 1878 | &prof_tdata_merge_iter_arg->cnt_all)) { |
| 1879 | goto label_write_error; |
| 1880 | } |
| 1881 | |
| 1882 | /* Dump per gctx profile stats. */ |
| 1883 | prof_gctx_dump_iter_arg->tsdn = tsd_tsdn(tsd); |
| 1884 | prof_gctx_dump_iter_arg->propagate_err = propagate_err; |
| 1885 | if (gctx_tree_iter(gctxs, NULL, prof_gctx_dump_iter, |
| 1886 | (void *)prof_gctx_dump_iter_arg) != NULL) { |
| 1887 | goto label_write_error; |
| 1888 | } |
| 1889 | |
| 1890 | /* Dump /proc/<pid>/maps if possible. */ |
| 1891 | if (prof_dump_maps(propagate_err)) { |
| 1892 | goto label_write_error; |
| 1893 | } |
| 1894 | |
| 1895 | if (prof_dump_close(propagate_err)) { |
| 1896 | return true; |
| 1897 | } |
| 1898 | |
| 1899 | return false; |
| 1900 | label_write_error: |
| 1901 | prof_dump_close(propagate_err); |
| 1902 | return true; |
| 1903 | } |
| 1904 | |
| 1905 | static bool |
| 1906 | prof_dump(tsd_t *tsd, bool propagate_err, const char *filename, |
no test coverage detected