| ... | @@ -1768,49 +1768,21 @@ pub fn dumpBadGetPathHelp( | ... | @@ -1768,49 +1768,21 @@ pub fn dumpBadGetPathHelp( |
| 1768 | }); | 1768 | }); |
| 1769 | | 1769 | |
| 1770 | const tty_config = std.io.tty.detectConfig(stderr); | 1770 | const tty_config = std.io.tty.detectConfig(stderr); |
| 1771 | if (s.getStackTrace()) |stack_trace| { | 1771 | tty_config.setColor(w, .red) catch {}; |
| 1772 | tty_config.setColor(w, .red) catch {}; | 1772 | try stderr.writeAll(" The step was created by this stack trace:\n"); |
| 1773 | try stderr.writeAll(" The step was created by this stack trace:\n"); | 1773 | tty_config.setColor(w, .reset) catch {}; |
| 1774 | tty_config.setColor(w, .reset) catch {}; | | |
| 1775 | | | |
| 1776 | const debug_info = std.debug.getSelfDebugInfo() catch |err| { | | |
| 1777 | try w.print("Unable to dump stack trace: Unable to open debug info: {s}\n", .{@errorName(err)}); | | |
| 1778 | return; | | |
| 1779 | }; | | |
| 1780 | const ally = debug_info.allocator; | | |
| 1781 | | 1774 | |
| 1782 | std.debug.writeStackTrace(stack_trace, w, ally, debug_info, tty_config) catch |err| { | 1775 | s.dump(stderr); |
| 1783 | try stderr.writer().print("Unable to dump stack trace: {s}\n", .{@errorName(err)}); | 1776 | if (asking_step) |as| { |
| 1784 | return; | | |
| 1785 | }; | | |
| 1786 | if (asking_step) |as| { | | |
| 1787 | tty_config.setColor(w, .red) catch {}; | | |
| 1788 | try stderr.writer().print(" The step '{s}' that is missing a dependency on the above step was created by this stack trace:\n", .{as.name}); | | |
| 1789 | tty_config.setColor(w, .reset) catch {}; | | |
| 1790 | | | |
| 1791 | if (as.getStackTrace()) |as_stack_trace| { | | |
| 1792 | std.debug.writeStackTrace(as_stack_trace, w, ally, debug_info, tty_config) catch |err| { | | |
| 1793 | try stderr.writer().print("Unable to dump stack trace: {s}\n", .{@errorName(err)}); | | |
| 1794 | return; | | |
| 1795 | }; | | |
| 1796 | } else { | | |
| 1797 | const field = "debug_stack_frames_count"; | | |
| 1798 | comptime assert(@hasField(Build, field)); | | |
| 1799 | tty_config.setColor(w, .yellow) catch {}; | | |
| 1800 | try stderr.writer().print("no stack trace collected for this step, see std.Build." ++ field ++ "\n", .{}); | | |
| 1801 | tty_config.setColor(w, .reset) catch {}; | | |
| 1802 | } | | |
| 1803 | } | | |
| 1804 | tty_config.setColor(w, .red) catch {}; | 1777 | tty_config.setColor(w, .red) catch {}; |
| 1805 | try stderr.writeAll(" Hope that helps. Proceeding to panic.\n"); | 1778 | try stderr.writer().print(" The step '{s}' that is missing a dependency on the above step was created by this stack trace:\n", .{as.name}); |
| 1806 | tty_config.setColor(w, .reset) catch {}; | | |
| 1807 | } else { | | |
| 1808 | const field = "debug_stack_frames_count"; | | |
| 1809 | comptime assert(@hasField(Build, field)); | | |
| 1810 | tty_config.setColor(w, .yellow) catch {}; | | |
| 1811 | try stderr.writer().print("no stack trace collected for this step, see std.Build." ++ field ++ "\n", .{}); | | |
| 1812 | tty_config.setColor(w, .reset) catch {}; | 1779 | tty_config.setColor(w, .reset) catch {}; |
| | 1780 | |
| | 1781 | as.dump(stderr); |
| 1813 | } | 1782 | } |
| | 1783 | tty_config.setColor(w, .red) catch {}; |
| | 1784 | try stderr.writeAll(" Hope that helps. Proceeding to panic.\n"); |
| | 1785 | tty_config.setColor(w, .reset) catch {}; |
| 1814 | } | 1786 | } |
| 1815 | | 1787 | |
| 1816 | /// Allocates a new string for assigning a value to a named macro. | 1788 | /// Allocates a new string for assigning a value to a named macro. |