]>
git.saurik.com Git - apple/xnu.git/blob - osfmk/ddb/db_write_cmd.c
fdbf1426885899530ae9bd070cb4efcd7388c908
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
28 * Revision 1.1.1.1 1998/09/22 21:05:48 wsanchez
29 * Import of Mac OS X kernel (~semeria)
31 * Revision 1.1.1.1 1998/03/07 02:26:09 wsanchez
32 * Import of OSF Mach kernel (~mburg)
34 * Revision 1.2.10.1 1994/09/23 01:23:15 ezf
35 * change marker to not FREE
36 * [1994/09/22 21:11:42 ezf]
38 * Revision 1.2.8.3 1994/03/17 22:35:48 dwm
39 * The infamous name change: thread_activation + thread_shuttle = thread.
40 * [1994/03/17 21:26:02 dwm]
42 * Revision 1.2.8.2 1994/01/12 17:51:11 dwm
43 * Coloc: initial restructuring to follow Utah model.
44 * [1994/01/12 17:13:42 dwm]
46 * Revision 1.2.8.1 1994/01/05 19:28:25 bolinger
47 * Target current address space, not current "task", for writes.
48 * [1994/01/04 17:44:51 bolinger]
50 * Revision 1.2.2.3 1993/07/27 18:28:36 elliston
51 * Add ANSI prototypes. CR #9523.
52 * [1993/07/27 18:13:37 elliston]
54 * Revision 1.2.2.2 1993/06/09 02:21:11 gm
55 * Added to OSF/1 R1.3 from NMK15.0.
56 * [1993/06/02 20:58:03 jeffc]
58 * Revision 1.2 1993/04/19 16:03:43 devrcs
60 * Removed unused variable 'p' from db_write_cmd().
62 * Reorganized. w/u now works, instead of just w/tu.
66 * Revision 1.1 1992/09/30 02:01:35 robert
73 * Revision 2.6 91/10/09 16:05:06 af
74 * Revision 2.5.3.1 91/10/05 13:09:25 jeffreyh
75 * Added user space write support including inactive task.
78 * Revision 2.5.3.1 91/10/05 13:09:25 jeffreyh
79 * Added user space write support including inactive task.
82 * Revision 2.5 91/05/14 15:38:04 mrt
83 * Correcting copyright
85 * Revision 2.4 91/02/05 17:07:35 mrt
86 * Changed to new Mach copyright
87 * [91/01/31 16:20:19 mrt]
89 * Revision 2.3 90/10/25 14:44:26 rwd
90 * Changed db_write_cmd to print unsigned.
93 * Revision 2.2 90/08/27 21:53:54 dbg
94 * Set db_prev and db_next instead of explicitly advancing dot.
96 * Reflected changes in db_printsym()'s calling seq.
98 * Warn user if nothing was written.
106 * Mach Operating System
107 * Copyright (c) 1991,1990 Carnegie Mellon University
108 * All Rights Reserved.
110 * Permission to use, copy, modify and distribute this software and its
111 * documentation is hereby granted, provided that both the copyright
112 * notice and this permission notice appear in all copies of the
113 * software, derivative works or modified versions, and any portions
114 * thereof, and that both notices appear in supporting documentation.
116 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
117 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
118 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
120 * Carnegie Mellon requests users of this software to return to
122 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
123 * School of Computer Science
124 * Carnegie Mellon University
125 * Pittsburgh PA 15213-3890
127 * any improvements or extensions that they make and grant Carnegie Mellon
128 * the rights to redistribute these changes.
133 * Author: David B. Golub, Carnegie Mellon University
137 #include <mach/boolean.h>
138 #include <kern/task.h>
139 #include <kern/thread.h>
141 #include <machine/db_machdep.h>
143 #include <ddb/db_lex.h>
144 #include <ddb/db_access.h>
145 #include <ddb/db_command.h>
146 #include <ddb/db_sym.h>
147 #include <ddb/db_task_thread.h>
148 #include <ddb/db_expr.h>
149 #include <ddb/db_write_cmd.h>
150 #include <ddb/db_output.h> /* For db_printf() */
162 register db_addr_t addr
;
163 register db_expr_t old_value
;
166 boolean_t wrote_one
= FALSE
;
167 boolean_t t_opt
, u_opt
;
168 thread_act_t thr_act
;
171 addr
= (db_addr_t
) address
;
173 size
= db_size_option(modif
, &u_opt
, &t_opt
);
177 if (!db_get_next_act(&thr_act
, 0))
179 task
= thr_act
->task
;
182 task
= db_current_space();
184 /* if user space is not explicitly specified,
185 look in the kernel */
189 if (!DB_VALID_ADDRESS(addr
, u_opt
)) {
190 db_printf("Bad address 0x%x\n", addr
);
194 while (db_expression(&new_value
)) {
195 old_value
= db_get_task_value(addr
, size
, FALSE
, task
);
196 db_task_printsym(addr
, DB_STGY_ANY
, task
);
197 db_printf("\t\t%#8n\t=\t%#8n\n", old_value
, new_value
);
198 db_put_task_value(addr
, size
, new_value
, task
);
205 db_error("Nothing written.\n");
208 db_prev
= addr
- size
;