|
|
1.1.1.2 root 1: /*
1.1 root 2: * Mach Operating System
3: * Copyright (c) 1991,1990,1989 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: #if MACH_KDB
28:
29: #if MACH_DEBUG
30:
31: #include <mach/mach_types.h> /* vm_address_t */
32: #include <mach/std_types.h> /* pointer_t */
33: #include <mach/vm_param.h>
34: #include <vm/vm_map.h>
35: #include <vm/vm_kern.h>
1.1.1.3 root 36: #include <vm/vm_user.h>
1.1 root 37: #include <kern/host.h>
38: #include <kern/task.h>
39: #include <ddb/db_sym.h>
40:
41:
42:
43: /*
44: * Loads a symbol table for an external file into the kernel debugger.
45: * The symbol table data is an array of characters. It is assumed that
46: * the caller and the kernel debugger agree on its format.
47: */
48: kern_return_t
1.1.1.4 ! root 49: host_load_symbol_table(
! 50: host_t host,
! 51: task_t task,
! 52: char * name,
! 53: pointer_t symtab,
! 54: unsigned int symtab_count)
1.1 root 55: {
56: kern_return_t result;
57: vm_offset_t symtab_start;
58: vm_offset_t symtab_end;
59: vm_map_t map;
60: vm_map_copy_t symtab_copy_object;
61:
62: if (host == HOST_NULL)
63: return (KERN_INVALID_ARGUMENT);
64:
65: /*
66: * Copy the symbol table array into the kernel.
67: * We make a copy of the copy object, and clear
68: * the old one, so that returning error will not
69: * deallocate the data twice.
70: */
71: symtab_copy_object = (vm_map_copy_t) symtab;
72: result = vm_map_copyout(
73: kernel_map,
74: &symtab_start,
75: vm_map_copy_copy(symtab_copy_object));
76: if (result != KERN_SUCCESS)
77: return (result);
78:
79: symtab_end = symtab_start + symtab_count;
80:
81: /*
82: * Add the symbol table.
83: * Do not keep a reference for the task map. XXX
84: */
85: if (task == TASK_NULL)
86: map = VM_MAP_NULL;
87: else
88: map = task->map;
89: if (!X_db_sym_init((char *)symtab_start,
90: (char *)symtab_end,
91: name,
92: (char *)map))
93: {
94: /*
95: * Not enough room for symbol table - failure.
96: */
97: (void) vm_deallocate(kernel_map,
98: symtab_start,
99: symtab_count);
100: return (KERN_FAILURE);
101: }
102:
103: /*
104: * Wire down the symbol table
105: */
106: (void) vm_map_pageable(kernel_map,
107: symtab_start,
108: round_page(symtab_end),
109: VM_PROT_READ|VM_PROT_WRITE);
110:
111: /*
112: * Discard the original copy object
113: */
114: vm_map_copy_discard(symtab_copy_object);
115:
116: return (KERN_SUCCESS);
117: }
118:
119: #endif /* MACH_DEBUG */
120:
1.1.1.2 root 121: #endif /* MACH_KDB */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.