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