From e63dfe66074095c741b8d86a44210de9c7cc6138 Mon Sep 17 00:00:00 2001 From: jcs Date: Tue, 9 Feb 2021 14:37:13 +0000 Subject: [PATCH] ddb: when a new wsdisplay console attaches, resize ddb cols/rows to it ok visa --- sys/ddb/db_output.c | 9 ++++++++- sys/ddb/db_output.h | 3 ++- sys/dev/wscons/wsdisplay.c | 10 +++++++++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/sys/ddb/db_output.c b/sys/ddb/db_output.c index 77fd0e34944..3aa2c6a8657 100644 --- a/sys/ddb/db_output.c +++ b/sys/ddb/db_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_output.c,v 1.35 2020/10/15 03:14:00 deraadt Exp $ */ +/* $OpenBSD: db_output.c,v 1.36 2021/02/09 14:37:13 jcs Exp $ */ /* $NetBSD: db_output.c,v 1.13 1996/04/01 17:27:14 christos Exp $ */ /* @@ -252,3 +252,10 @@ stacktrace_print(struct stacktrace *st, int (*pr)(const char *, ...)) if (st->st_count == 0) (*pr)("\n"); } + +void +db_resize(int cols, int rows) +{ + db_max_width = cols; + db_max_line = rows; +} diff --git a/sys/ddb/db_output.h b/sys/ddb/db_output.h index 86ca761acaa..2abbfbba616 100644 --- a/sys/ddb/db_output.h +++ b/sys/ddb/db_output.h @@ -1,4 +1,4 @@ -/* $OpenBSD: db_output.h,v 1.16 2013/12/12 21:00:09 guenther Exp $ */ +/* $OpenBSD: db_output.h,v 1.17 2021/02/09 14:37:13 jcs Exp $ */ /* $NetBSD: db_output.h,v 1.9 1996/04/04 05:13:50 cgd Exp $ */ /* @@ -41,6 +41,7 @@ int db_printf(const char *, ...) int db_vprintf(const char *, va_list) __attribute__((__format__(__kprintf__,1,0))); void db_end_line(int); +void db_resize(int, int); /* * This is a replacement for the non-standard %z, %n and %r printf formats diff --git a/sys/dev/wscons/wsdisplay.c b/sys/dev/wscons/wsdisplay.c index 82daa85dda3..b1fa71b5b15 100644 --- a/sys/dev/wscons/wsdisplay.c +++ b/sys/dev/wscons/wsdisplay.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsdisplay.c,v 1.142 2020/08/05 13:50:25 fcambus Exp $ */ +/* $OpenBSD: wsdisplay.c,v 1.143 2021/02/09 14:37:13 jcs Exp $ */ /* $NetBSD: wsdisplay.c,v 1.82 2005/02/27 00:27:52 perry Exp $ */ /* @@ -65,6 +65,10 @@ #include #endif +#ifdef DDB +#include +#endif + #include "wsmoused.h" struct wsscreen_internal { @@ -836,6 +840,10 @@ wsdisplay_cnattach(const struct wsscreen_descr *type, void *cookie, int ccol, cn_tab = &wsdisplay_cons; wsdisplay_console_initted = 1; + +#ifdef DDB + db_resize(type->ncols, type->nrows); +#endif } /* -- 2.20.1