]>
git.saurik.com Git - apple/xnu.git/blob - osfmk/ddb/db_write_cmd.c
2 * Copyright (c) 2000-2004 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@
26 * Mach Operating System
27 * Copyright (c) 1991,1990 Carnegie Mellon University
28 * All Rights Reserved.
30 * Permission to use, copy, modify and distribute this software and its
31 * documentation is hereby granted, provided that both the copyright
32 * notice and this permission notice appear in all copies of the
33 * software, derivative works or modified versions, and any portions
34 * thereof, and that both notices appear in supporting documentation.
36 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
37 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
38 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
40 * Carnegie Mellon requests users of this software to return to
42 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
43 * School of Computer Science
44 * Carnegie Mellon University
45 * Pittsburgh PA 15213-3890
47 * any improvements or extensions that they make and grant Carnegie Mellon
48 * the rights to redistribute these changes.
53 * Author: David B. Golub, Carnegie Mellon University
57 #include <mach/boolean.h>
58 #include <kern/task.h>
59 #include <kern/thread.h>
61 #include <machine/db_machdep.h>
63 #include <ddb/db_lex.h>
64 #include <ddb/db_access.h>
65 #include <ddb/db_command.h>
66 #include <ddb/db_sym.h>
67 #include <ddb/db_task_thread.h>
68 #include <ddb/db_expr.h>
69 #include <ddb/db_write_cmd.h>
70 #include <ddb/db_output.h> /* For db_printf() */
82 register db_addr_t addr
;
83 register db_expr_t old_value
;
86 boolean_t wrote_one
= FALSE
;
87 boolean_t t_opt
, u_opt
;
91 addr
= (db_addr_t
) address
;
93 size
= db_size_option(modif
, &u_opt
, &t_opt
);
97 if (!db_get_next_act(&thr_act
, 0))
102 task
= db_current_space();
104 /* if user space is not explicitly specified,
105 look in the kernel */
109 if (!DB_VALID_ADDRESS(addr
, u_opt
)) {
110 db_printf("Bad address 0x%llx\n", (unsigned long long)addr
);
114 while (db_expression(&new_value
)) {
115 old_value
= db_get_task_value(addr
, size
, FALSE
, task
);
116 db_task_printsym(addr
, DB_STGY_ANY
, task
);
117 db_printf("\t\t%#8lln\t=\t%#8lln\n", (unsigned long long)old_value
, (unsigned long long)new_value
);
118 db_put_task_value(addr
, size
, new_value
, task
);
125 db_error("Nothing written.\n");
128 db_prev
= addr
- size
;