Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch {amd64,i386}/db_machdep.c: Don't bury a function ca...
details: https://anonhg.NetBSD.org/src/rev/d01845eb5f4d
branches: trunk
changeset: 372762:d01845eb5f4d
user: uwe <uwe%NetBSD.org@localhost>
date: Sat Dec 24 14:47:47 2022 +0000
description:
{amd64,i386}/db_machdep.c: Don't bury a function call in an if condition
db_frame_info has many arguments and requires contorted line wrapping
that obscures the condition. The same object code is generated
(modulo a local variable moved closer to its only use site).
diffstat:
sys/arch/amd64/amd64/db_machdep.c | 13 +++++++------
sys/arch/i386/i386/db_machdep.c | 12 ++++++------
2 files changed, 13 insertions(+), 12 deletions(-)
diffs (81 lines):
diff -r edd63f35cfd8 -r d01845eb5f4d sys/arch/amd64/amd64/db_machdep.c
--- a/sys/arch/amd64/amd64/db_machdep.c Sat Dec 24 14:32:42 2022 +0000
+++ b/sys/arch/amd64/amd64/db_machdep.c Sat Dec 24 14:47:47 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_machdep.c,v 1.14 2022/12/24 14:32:42 uwe Exp $ */
+/* $NetBSD: db_machdep.c,v 1.15 2022/12/24 14:47:47 uwe Exp $ */
/*
* Mach Operating System
@@ -26,7 +26,7 @@
* rights to redistribute these changes.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.14 2022/12/24 14:32:42 uwe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.15 2022/12/24 14:47:47 uwe Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -111,7 +111,7 @@
struct trapframe *tf;
struct x86_64_frame *fp;
struct intrframe *ifp;
- int traptype, trapno, err, i;
+ int trapno, err, i;
db_expr_t syscallno;
switch (is_trap) {
@@ -175,9 +175,10 @@
* a frame can be recognized by always having
* err 0 or IREENT_MAGIC and trapno T_ASTFLT.
*/
- if (db_frame_info(*nextframe, (db_addr_t)*ip, NULL, NULL, &traptype,
- NULL) != DB_SYM_NULL
- && traptype == INTERRUPT) {
+ int traptype = NONE;
+ db_sym_t sym = db_frame_info(*nextframe, (db_addr_t)*ip,
+ NULL, NULL, &traptype, NULL);
+ if (sym != DB_SYM_NULL && traptype == INTERRUPT) {
for (i = 0; i < 4; i++) {
ifp = (struct intrframe *)(argp + i);
err = db_get_value((long)&ifp->if_tf.tf_err,
diff -r edd63f35cfd8 -r d01845eb5f4d sys/arch/i386/i386/db_machdep.c
--- a/sys/arch/i386/i386/db_machdep.c Sat Dec 24 14:32:42 2022 +0000
+++ b/sys/arch/i386/i386/db_machdep.c Sat Dec 24 14:47:47 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_machdep.c,v 1.9 2022/12/24 14:32:42 uwe Exp $ */
+/* $NetBSD: db_machdep.c,v 1.10 2022/12/24 14:47:47 uwe Exp $ */
/*
* Mach Operating System
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.9 2022/12/24 14:32:42 uwe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.10 2022/12/24 14:47:47 uwe Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -128,7 +128,6 @@
static struct trapframe tf;
static struct i386tss tss;
struct i386_frame *fp;
- int traptype;
uintptr_t ptr;
switch (is_trap) {
@@ -207,9 +206,10 @@
* a frame can be recognized by always having
* err 0 or IREENT_MAGIC and trapno T_ASTFLT.
*/
- if (db_frame_info(*nextframe, (db_addr_t)*ip, NULL, NULL, &traptype,
- NULL) != DB_SYM_NULL
- && traptype == INTERRUPT) {
+ int traptype = NONE;
+ db_sym_t sym = db_frame_info(*nextframe, (db_addr_t)*ip,
+ NULL, NULL, &traptype, NULL);
+ if (sym != DB_SYM_NULL && traptype == INTERRUPT) {
struct intrframe *ifp;
int trapno;
int err;
Home |
Main Index |
Thread Index |
Old Index