Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/ddb db_lstacktrace() can't use db_stacktrace_print and l...



details:   https://anonhg.NetBSD.org/src/rev/1ad71f57cd3b
branches:  trunk
changeset: 961395:1ad71f57cd3b
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sun Apr 18 01:05:23 2021 +0000

description:
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.)

diffstat:

 sys/ddb/db_interface.h |  17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diffs (39 lines):

diff -r 572f987c790f -r 1ad71f57cd3b sys/ddb/db_interface.h
--- a/sys/ddb/db_interface.h    Sat Apr 17 22:03:57 2021 +0000
+++ b/sys/ddb/db_interface.h    Sun Apr 18 01:05:23 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_interface.h,v 1.38 2021/02/10 07:17:39 simonb Exp $ */
+/*     $NetBSD: db_interface.h,v 1.39 2021/04/18 01:05:23 mrg Exp $    */
 
 /*-
  * Copyright (c) 1995 The NetBSD Foundation, Inc.
@@ -80,7 +80,6 @@
 /* kern/subr_disk.c, dev/dksubr.c */
 void           db_show_disk(db_expr_t, bool, db_expr_t, const char *);
 
-
 /* The db_stacktrace_print macro may be overridden by an MD macro */
 #ifndef db_stacktrace_print
 #define        db_stacktrace_print(prfunc) \
@@ -88,8 +87,20 @@
        true, 65535, "", prfunc)
 #endif /* !db_stacktrace_print */
 
+#include <sys/syslog.h>
+
+static __inline__ void
+_db_log_wrapper(const char *fmt, ...)
+{
+       va_list ap;
+
+       va_start(ap, fmt);
+       vlog(LOG_INFO, fmt, ap);
+       va_end(ap);
+}
+
 #define        db_stacktrace()         db_stacktrace_print(printf);
 #define        db_ustacktrace()        db_stacktrace_print(uprintf);
-#define        db_lstacktrace()        db_stacktrace_print(log);
+#define        db_lstacktrace()        db_stacktrace_print(_db_log_wrapper);
 
 #endif /* _DDB_DB_INTERFACE_H_ */



Home | Main Index | Thread Index | Old Index