Sun Sep 27 18:24:23 2009 UTC ()
kgdb still needs db_{get,put}_value in ddb/db_access.c when SOFTWARE_SSTEP is defined in db_machdep.h.


(bsh)
diff -r1.19 -r1.20 src/sys/ddb/db_access.c
diff -r1.4 -r1.5 src/sys/ddb/files.ddb

cvs diff -r1.19 -r1.20 src/sys/ddb/db_access.c (expand / switch to unified diff)

--- src/sys/ddb/db_access.c 2009/03/07 22:02:17 1.19
+++ src/sys/ddb/db_access.c 2009/09/27 18:24:23 1.20
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: db_access.c,v 1.19 2009/03/07 22:02:17 ad Exp $ */ 1/* $NetBSD: db_access.c,v 1.20 2009/09/27 18:24:23 bsh Exp $ */
2 2
3/* 3/*
4 * Mach Operating System 4 * Mach Operating System
5 * Copyright (c) 1991,1990 Carnegie Mellon University 5 * Copyright (c) 1991,1990 Carnegie Mellon University
6 * All Rights Reserved. 6 * All Rights Reserved.
7 * 7 *
8 * Permission to use, copy, modify and distribute this software and its 8 * Permission to use, copy, modify and distribute this software and its
9 * documentation is hereby granted, provided that both the copyright 9 * documentation is hereby granted, provided that both the copyright
10 * notice and this permission notice appear in all copies of the 10 * notice and this permission notice appear in all copies of the
11 * software, derivative works or modified versions, and any portions 11 * software, derivative works or modified versions, and any portions
12 * thereof, and that both notices appear in supporting documentation. 12 * thereof, and that both notices appear in supporting documentation.
13 * 13 *
14 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 14 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
@@ -20,39 +20,45 @@ @@ -20,39 +20,45 @@
20 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 20 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
21 * School of Computer Science 21 * School of Computer Science
22 * Carnegie Mellon University 22 * Carnegie Mellon University
23 * Pittsburgh PA 15213-3890 23 * Pittsburgh PA 15213-3890
24 * 24 *
25 * any improvements or extensions that they make and grant Carnegie the 25 * any improvements or extensions that they make and grant Carnegie the
26 * rights to redistribute these changes. 26 * rights to redistribute these changes.
27 * 27 *
28 * Author: David B. Golub, Carnegie Mellon University 28 * Author: David B. Golub, Carnegie Mellon University
29 * Date: 7/90 29 * Date: 7/90
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: db_access.c,v 1.19 2009/03/07 22:02:17 ad Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: db_access.c,v 1.20 2009/09/27 18:24:23 bsh Exp $");
 34
 35#include "opt_kgdb.h"
34 36
35#include <sys/param.h> 37#include <sys/param.h>
36#include <sys/proc.h> 38#include <sys/proc.h>
37#include <sys/endian.h> 39#include <sys/endian.h>
38 40
39#include <ddb/ddb.h> 41#include <ddb/ddb.h>
40 42
41/* 43/*
42 * Access unaligned data items on aligned (longword) 44 * Access unaligned data items on aligned (longword)
43 * boundaries. 45 * boundaries.
 46 *
 47 * This file is shared by ddb and kgdb.
44 */ 48 */
45 49
 50#if defined(DDB) || defined(KGDB) && defined(SOFTWARE_SSTEP)
 51
46const int db_extend[] = { /* table for sign-extending */ 52const int db_extend[] = { /* table for sign-extending */
47 0, 53 0,
48 0xFFFFFF80, 54 0xFFFFFF80,
49 0xFFFF8000, 55 0xFFFF8000,
50 0xFF800000 56 0xFF800000
51}; 57};
52 58
53db_expr_t 59db_expr_t
54db_get_value(db_addr_t addr, size_t size, bool is_signed) 60db_get_value(db_addr_t addr, size_t size, bool is_signed)
55{ 61{
56 char data[sizeof(db_expr_t)]; 62 char data[sizeof(db_expr_t)];
57 db_expr_t value; 63 db_expr_t value;
58 size_t i; 64 size_t i;
@@ -81,26 +87,30 @@ db_put_value(db_addr_t addr, size_t size @@ -81,26 +87,30 @@ db_put_value(db_addr_t addr, size_t size
81#if BYTE_ORDER == LITTLE_ENDIAN 87#if BYTE_ORDER == LITTLE_ENDIAN
82 for (i = 0; i < size; i++) 88 for (i = 0; i < size; i++)
83#else /* BYTE_ORDER == BIG_ENDIAN */ 89#else /* BYTE_ORDER == BIG_ENDIAN */
84 for (i = size; i-- > 0;) 90 for (i = size; i-- > 0;)
85#endif /* BYTE_ORDER */ 91#endif /* BYTE_ORDER */
86 { 92 {
87 data[i] = value & 0xFF; 93 data[i] = value & 0xFF;
88 value >>= 8; 94 value >>= 8;
89 } 95 }
90 96
91 db_write_bytes(addr, size, data); 97 db_write_bytes(addr, size, data);
92} 98}
93 99
 100#endif /* DDB || KGDB && SOFTWARE_SSTEP */
 101
 102#ifdef DDB
 103
94void * 104void *
95db_read_ptr(const char *name) 105db_read_ptr(const char *name)
96{ 106{
97 db_expr_t val; 107 db_expr_t val;
98 void *p; 108 void *p;
99 109
100 if (!db_value_of_name(name, &val)) { 110 if (!db_value_of_name(name, &val)) {
101 db_printf("db_read_ptr: cannot find `%s'\n", name); 111 db_printf("db_read_ptr: cannot find `%s'\n", name);
102 db_error(NULL); 112 db_error(NULL);
103 /* NOTREACHED */ 113 /* NOTREACHED */
104 } 114 }
105 db_read_bytes((db_addr_t)val, sizeof(p), (char *)&p); 115 db_read_bytes((db_addr_t)val, sizeof(p), (char *)&p);
106 return p; 116 return p;
@@ -110,13 +120,15 @@ int @@ -110,13 +120,15 @@ int
110db_read_int(const char *name) 120db_read_int(const char *name)
111{ 121{
112 db_expr_t val; 122 db_expr_t val;
113 int p; 123 int p;
114 124
115 if (!db_value_of_name(name, &val)) { 125 if (!db_value_of_name(name, &val)) {
116 db_printf("db_read_int: cannot find `%s'\n", name); 126 db_printf("db_read_int: cannot find `%s'\n", name);
117 db_error(NULL); 127 db_error(NULL);
118 /* NOTREACHED */ 128 /* NOTREACHED */
119 } 129 }
120 db_read_bytes((db_addr_t)val, sizeof(p), (char *)&p); 130 db_read_bytes((db_addr_t)val, sizeof(p), (char *)&p);
121 return p; 131 return p;
122} 132}
 133
 134#endif /* DDB */

cvs diff -r1.4 -r1.5 src/sys/ddb/files.ddb (expand / switch to unified diff)

--- src/sys/ddb/files.ddb 2009/03/31 15:50:45 1.4
+++ src/sys/ddb/files.ddb 2009/09/27 18:24:23 1.5
@@ -1,24 +1,24 @@ @@ -1,24 +1,24 @@
1# $NetBSD: files.ddb,v 1.4 2009/03/31 15:50:45 reinoud Exp $ 1# $NetBSD: files.ddb,v 1.5 2009/09/27 18:24:23 bsh Exp $
2 2
3# 3#
4# DDB options 4# DDB options
5# 5#
6defflag opt_ddb.h DDB DDB_VERBOSE_HELP 6defflag opt_ddb.h DDB DDB_VERBOSE_HELP
7defparam opt_ddbparam.h DDB_FROMCONSOLE DDB_ONPANIC DDB_HISTORY_SIZE 7defparam opt_ddbparam.h DDB_FROMCONSOLE DDB_ONPANIC DDB_HISTORY_SIZE
8 DDB_BREAK_CHAR DDB_KEYCODE SYMTAB_SPACE 8 DDB_BREAK_CHAR DDB_KEYCODE SYMTAB_SPACE
9 DDB_COMMANDONENTER  9 DDB_COMMANDONENTER
10 10
11file ddb/db_access.c ddb 11file ddb/db_access.c ddb | kgdb
12file ddb/db_aout.c ddb 12file ddb/db_aout.c ddb
13file ddb/db_break.c ddb 13file ddb/db_break.c ddb
14file ddb/db_command.c ddb 14file ddb/db_command.c ddb
15file ddb/db_cpu.c ddb 15file ddb/db_cpu.c ddb
16file ddb/db_examine.c ddb 16file ddb/db_examine.c ddb
17file ddb/db_expr.c ddb 17file ddb/db_expr.c ddb
18file ddb/db_input.c ddb 18file ddb/db_input.c ddb
19file ddb/db_kernel.c ddb 19file ddb/db_kernel.c ddb
20file ddb/db_lex.c ddb 20file ddb/db_lex.c ddb
21file ddb/db_lwp.c ddb 21file ddb/db_lwp.c ddb
22file ddb/db_output.c ddb 22file ddb/db_output.c ddb
23file ddb/db_proc.c ddb 23file ddb/db_proc.c ddb
24file ddb/db_print.c ddb 24file ddb/db_print.c ddb