Sun Apr 18 01:05:23 2021 UTC ()
db_lstacktrace() can't use db_stacktrace_print and log() directly.

log() takes a 'int level' first argument, that must be supplied.
add an inline wrapper that calls vlog() with LOG_INFO, and the
supplied va_list.

(not noticed because this macro is not used anywhere in src but
i have a use in some uncommited code, that now failed to compile.)


(mrg)
diff -r1.38 -r1.39 src/sys/ddb/db_interface.h

cvs diff -r1.38 -r1.39 src/sys/ddb/db_interface.h (expand / switch to unified diff)

--- src/sys/ddb/db_interface.h 2021/02/10 07:17:39 1.38
+++ src/sys/ddb/db_interface.h 2021/04/18 01:05:23 1.39
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: db_interface.h,v 1.38 2021/02/10 07:17:39 simonb Exp $ */ 1/* $NetBSD: db_interface.h,v 1.39 2021/04/18 01:05:23 mrg Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1995 The NetBSD Foundation, Inc. 4 * Copyright (c) 1995 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Christos Zoulas. 8 * by Christos Zoulas.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -70,26 +70,37 @@ void db_show_mqueue_cmd(db_expr_t, bool @@ -70,26 +70,37 @@ void db_show_mqueue_cmd(db_expr_t, bool
70/* kern/kern_module.c */ 70/* kern/kern_module.c */
71void db_show_module_cmd(db_expr_t, bool, db_expr_t, const char *); 71void db_show_module_cmd(db_expr_t, bool, db_expr_t, const char *);
72 72
73/* kern/subr_vmem.c */ 73/* kern/subr_vmem.c */
74void db_show_all_vmems(db_expr_t, bool, db_expr_t, const char *); 74void db_show_all_vmems(db_expr_t, bool, db_expr_t, const char *);
75 75
76/* kern/subr_autoconf.c */ 76/* kern/subr_autoconf.c */
77void db_show_all_devices(db_expr_t, bool, db_expr_t, const char *); 77void db_show_all_devices(db_expr_t, bool, db_expr_t, const char *);
78void db_show_all_device(db_expr_t, bool, db_expr_t, const char *); 78void db_show_all_device(db_expr_t, bool, db_expr_t, const char *);
79 79
80/* kern/subr_disk.c, dev/dksubr.c */ 80/* kern/subr_disk.c, dev/dksubr.c */
81void db_show_disk(db_expr_t, bool, db_expr_t, const char *); 81void db_show_disk(db_expr_t, bool, db_expr_t, const char *);
82 82
83 
84/* The db_stacktrace_print macro may be overridden by an MD macro */ 83/* The db_stacktrace_print macro may be overridden by an MD macro */
85#ifndef db_stacktrace_print 84#ifndef db_stacktrace_print
86#define db_stacktrace_print(prfunc) \ 85#define db_stacktrace_print(prfunc) \
87 db_stack_trace_print((db_expr_t)(intptr_t)__builtin_frame_address(0), \ 86 db_stack_trace_print((db_expr_t)(intptr_t)__builtin_frame_address(0), \
88 true, 65535, "", prfunc) 87 true, 65535, "", prfunc)
89#endif /* !db_stacktrace_print */ 88#endif /* !db_stacktrace_print */
90 89
 90#include <sys/syslog.h>
 91
 92static __inline__ void
 93_db_log_wrapper(const char *fmt, ...)
 94{
 95 va_list ap;
 96
 97 va_start(ap, fmt);
 98 vlog(LOG_INFO, fmt, ap);
 99 va_end(ap);
 100}
 101
91#define db_stacktrace() db_stacktrace_print(printf); 102#define db_stacktrace() db_stacktrace_print(printf);
92#define db_ustacktrace() db_stacktrace_print(uprintf); 103#define db_ustacktrace() db_stacktrace_print(uprintf);
93#define db_lstacktrace() db_stacktrace_print(log); 104#define db_lstacktrace() db_stacktrace_print(_db_log_wrapper);
94 105
95#endif /* _DDB_DB_INTERFACE_H_ */ 106#endif /* _DDB_DB_INTERFACE_H_ */