Lines Matching +full:no +full:- +full:can +full:- +full:fd

1 // SPDX-License-Identifier: CDDL-1.0
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or https://opensource.org/licenses/CDDL-1.0.
33 * Output helpers. libspl_backtrace() must not block, must be thread-safe and
35 * printf, so we end up having to call write() directly on the fd. That's
40 #define spl_bt_write_n(fd, s, n) \ argument
41 do { ssize_t r __maybe_unused = write(fd, s, n); } while (0)
42 #define spl_bt_write(fd, s) spl_bt_write_n(fd, s, sizeof (s)-1) argument
46 * libunwind-gcc and libunwind-llvm both list registers using an enum,
48 * a given architecture in different ways. We can check which one is defined
66 * Convert `v` to ASCII hex characters. The bottom `n` nybbles (4-bits ie one
68 * null-terminated. Returns the number of digits written.
80 for (int i = 15; i >= 0; i--) { in spl_bt_u64_to_hex_str()
94 libspl_backtrace(int fd) in libspl_backtrace() argument
113 * top frame, and show them, with names, in a nice three-column in libspl_backtrace()
116 spl_bt_write(fd, "Registers:\n"); in libspl_backtrace()
132 * register must exist, and so we get its name. If libunwind has no in libspl_backtrace()
135 * shouldn't really matter. We can see the value, and that's the main in libspl_backtrace()
159 * is an alternate end-of-string character. LLVM libunwind will in libspl_backtrace()
171 * No valid name, or likely llvm_libunwind returned in libspl_backtrace()
173 * where "xx" is the two-char hex of libunwind's in libspl_backtrace()
178 &buf[1], sizeof (buf)-1) + 1; in libspl_backtrace()
186 spl_bt_write_n(fd, " ", 5-MIN(n, 3)); in libspl_backtrace()
189 spl_bt_write_n(fd, name, n); in libspl_backtrace()
190 spl_bt_write(fd, ": 0x"); in libspl_backtrace()
194 * assuming that all registers are 64-bits wide, which is in libspl_backtrace()
195 * probably fine for any general-purpose registers on any in libspl_backtrace()
201 spl_bt_write_n(fd, buf, n); in libspl_backtrace()
205 spl_bt_write(fd, "\n"); in libspl_backtrace()
210 spl_bt_write(fd, "\n"); in libspl_backtrace()
213 spl_bt_write(fd, "Call trace:\n"); in libspl_backtrace()
221 * specially, because its used a lot internally. Still, no in libspl_backtrace()
227 spl_bt_write(fd, " [couldn't get IP register; " in libspl_backtrace()
234 spl_bt_write(fd, " [0x"); in libspl_backtrace()
235 spl_bt_write_n(fd, buf, n); in libspl_backtrace()
236 spl_bt_write(fd, "] "); in libspl_backtrace()
243 * If libunwind can't determine the name, we just show "???" in libspl_backtrace()
252 if (err == 0 || err == -UNW_ENOMEM) { in libspl_backtrace()
254 spl_bt_write_n(fd, buf, n); in libspl_backtrace()
257 spl_bt_write(fd, "+0x"); in libspl_backtrace()
259 spl_bt_write_n(fd, buf, n); in libspl_backtrace()
261 spl_bt_write(fd, "???"); in libspl_backtrace()
272 if (err == 0 || err == -UNW_ENOMEM) { in libspl_backtrace()
274 spl_bt_write(fd, " (in "); in libspl_backtrace()
275 spl_bt_write_n(fd, buf, n); in libspl_backtrace()
278 spl_bt_write(fd, " +0x"); in libspl_backtrace()
280 spl_bt_write_n(fd, buf, n); in libspl_backtrace()
281 spl_bt_write(fd, ")"); in libspl_backtrace()
284 spl_bt_write(fd, "\n"); in libspl_backtrace()
291 libspl_backtrace(int fd) in libspl_backtrace() argument
295 spl_bt_write(fd, "Call trace:\n"); in libspl_backtrace()
296 backtrace_symbols_fd(btptrs, nptrs, fd); in libspl_backtrace()
300 libspl_backtrace(int fd __maybe_unused) in libspl_backtrace()