|
|
1.1.1.2 ! root 1: /* 1.1 root 2: * Mach Operating System 3: * Copyright (c) 1992,1991,1990 Carnegie Mellon University 4: * All Rights Reserved. 1.1.1.2 ! root 5: * 1.1 root 6: * Permission to use, copy, modify and distribute this software and its 7: * documentation is hereby granted, provided that both the copyright 8: * notice and this permission notice appear in all copies of the 9: * software, derivative works or modified versions, and any portions 10: * thereof, and that both notices appear in supporting documentation. 1.1.1.2 ! root 11: * 1.1 root 12: * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 13: * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR 14: * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 1.1.1.2 ! root 15: * 1.1 root 16: * Carnegie Mellon requests users of this software to return to 1.1.1.2 ! root 17: * 1.1 root 18: * Software Distribution Coordinator or [email protected] 19: * School of Computer Science 20: * Carnegie Mellon University 21: * Pittsburgh PA 15213-3890 1.1.1.2 ! root 22: * 1.1 root 23: * any improvements or extensions that they make and grant Carnegie Mellon 24: * the rights to redistribute these changes. 25: */ 26: /* 27: * Author: David B. Golub, Carnegie Mellon University 28: * Date: 7/90 29: */ 30: 31: #include "mach_kdb.h" 32: #if MACH_KDB 33: 34: #include <mach/boolean.h> 35: #include <kern/task.h> 36: #include <kern/thread.h> 37: 38: #include <machine/db_machdep.h> 39: 40: #include <ddb/db_lex.h> 41: #include <ddb/db_access.h> 42: #include <ddb/db_command.h> 43: #include <ddb/db_sym.h> 44: #include <ddb/db_task_thread.h> 45: 46: 47: 48: /* 49: * Write to file. 50: */ 51: /*ARGSUSED*/ 52: void 53: db_write_cmd(address, have_addr, count, modif) 54: db_expr_t address; 55: boolean_t have_addr; 56: db_expr_t count; 57: char * modif; 58: { 59: register db_addr_t addr; 60: register db_expr_t old_value; 61: db_expr_t new_value; 62: register int size; 63: boolean_t wrote_one = FALSE; 64: boolean_t t_opt, u_opt; 65: thread_t thread; 66: task_t task; 67: 68: addr = (db_addr_t) address; 69: 70: size = db_size_option(modif, &u_opt, &t_opt); 1.1.1.2 ! root 71: if (t_opt) 1.1 root 72: { 73: if (!db_get_next_thread(&thread, 0)) 74: return; 75: task = thread->task; 76: } 77: else 78: task = db_current_task(); 1.1.1.2 ! root 79: ! 80: /* if user space is not explicitly specified, 1.1 root 81: look in the kernel */ 82: if (!u_opt) 83: task = TASK_NULL; 84: 85: if (!DB_VALID_ADDRESS(addr, u_opt)) { 86: db_printf("Bad address %#*X\n", 2*sizeof(vm_offset_t), addr); 87: return; 88: } 89: 90: while (db_expression(&new_value)) { 91: old_value = db_get_task_value(addr, size, FALSE, task); 92: db_task_printsym(addr, DB_STGY_ANY, task); 93: db_printf("\t\t%#*N\t=\t%#*N\n", 94: 2*sizeof(db_expr_t), old_value, 95: 2*sizeof(db_expr_t), new_value); 96: db_put_task_value(addr, size, new_value, task); 97: addr += size; 98: 99: wrote_one = TRUE; 100: } 101: 102: if (!wrote_one) 103: db_error("Nothing written.\n"); 104: 105: db_next = addr; 106: db_prev = addr - size; 107: } 108: 1.1.1.2 ! root 109: #endif /* MACH_KDB */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.