2 // Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
4 // This program and the accompanying materials
5 // are licensed and made available under the terms and conditions of the BSD License
6 // which accompanies this distribution. The full text of the license may be found at
7 // http://opensource.org/licenses/bsd-license.php
9 // THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 // WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 ENTRY &ram_start &ram_size
15 ;If system is running then stop the execution so we can load symbols.
22 AREA.Create SYMBOL 300. 100.
27 ; Added based on suggestion from Lauterbach support.
31 GOSUB load_symbols &ram_start &ram_size
34 WINPOS 83.125 29.063 48. 9. 0. 0. W003
37 WINPOS 83.25 10. 48. 9. 0. 1. W002
43 ENTRY &mem_start &mem_size
44 &mem_ptr=&mem_start+&mem_size
47 &mem_ptr=&mem_ptr-0x400000 // 4 MB
48 &word1=Data.LONG(D:&mem_ptr)
49 &word2=Data.LONG(D:&mem_ptr+0x04)
54 &result=Data.LONG(D:&mem_ptr+0x08)
59 WHILE &mem_ptr>&mem_start
65 IF Data.LONG(D:&guid)==0x49152E77
67 IF Data.LONG(D:&guid+0x04)==0x47641ADA
69 IF Data.LONG(D:&guid+0x08)==0xFE7AA2B7
71 IF Data.LONG(D:&guid+0x0C)==0x8B5ED9FE
80 find_debug_info_table_header:
82 &config_table_entries=Data.LONG(D:&system_table+0x40)
83 &config_table_pointer=Data.LONG(D:&system_table+0x44)
84 RPT &config_table_entries
86 GOSUB compare_guid &config_table_pointer
90 &result=Data.LONG(D:&config_table_pointer+0x10)
93 &config_table_pointer=&config_table_pointer+0x14
99 IF Data.BYTE(D:&header+0x00)==0x4D
101 IF Data.BYTE(D:&header+0x01)==0x5A
103 IF Data.BYTE(D:&header+0x80)==0x50
105 IF Data.BYTE(D:&header+0x81)==0x45
119 &more_string=data.string(d:&stringOffset)
121 if (string.len("&more_string")>=128.)
123 &string="&string"+"&more_string"
124 &stringOffset=&stringOffset+string.len("&more_string")
126 //Get remaining file string
127 GOSUB get_file_string &stringOffset
129 &string="&string"+"&more_string"
133 &string="&string"+"&more_string"
139 ENTRY &header &load_address
140 GOSUB valid_pe_header &header
145 &debugOffset=Data.LONG(D:&header+0x0128)
146 &stringOffset=&header+&debugOffset+0x002C
148 &stringOffset=&stringOffset+11.
150 GOSUB get_file_string &stringOffset
153 &filestring="c:"+"&filestring"
155 PRINT "&filestring 0x" &load_address
156 Data.load.elf &filestring &load_address /nocode /noclear
162 RETURN Data.LONG(D:&header+0x00AC)
165 ENTRY &mem_start &mem_size
166 GOSUB find_system_table &mem_start &mem_size
168 GOSUB find_debug_info_table_header &system_table
169 ENTRY &debug_info_table_header
170 &debug_info_table=Data.LONG(D:&debug_info_table_header+0x08)
171 &debug_info_table_size=Data.LONG(D:&debug_info_table_header+0x04)
173 RPT &debug_info_table_size
175 &debug_image_info=Data.LONG(D:&debug_info_table+&index)
176 IF &debug_image_info==0
178 &loaded_image_protocol=Data.LONG(D:&debug_image_info+0x04);
179 &image_base=Data.LONG(D:&loaded_image_protocol+0x20);
180 GOSUB pe_headersize &image_base
182 &image_load_address=&image_base+&header_size
183 GOSUB load_symbol_file &image_base &image_load_address