2011-04-27 19:21:31 +02:00
|
|
|
;
|
2024-01-29 19:59:16 +01:00
|
|
|
; Copyright (c) 2024, Ampere Computing LLC. All rights reserved.<BR>
|
2011-04-27 19:21:31 +02:00
|
|
|
; Copyright (c) 2011, Hewlett-Packard Company. All rights reserved.<BR>
|
|
|
|
;
|
2019-04-04 01:03:38 +02:00
|
|
|
; SPDX-License-Identifier: BSD-2-Clause-Patent
|
2011-04-27 19:21:31 +02:00
|
|
|
;
|
|
|
|
|
2024-01-29 19:59:16 +01:00
|
|
|
PARAMETERS &systbl
|
2011-04-27 19:21:31 +02:00
|
|
|
|
2024-01-29 19:59:16 +01:00
|
|
|
gosub FindDebugInfo &systbl
|
|
|
|
enddo
|
2011-04-27 19:21:31 +02:00
|
|
|
|
|
|
|
FindDebugInfo:
|
|
|
|
LOCAL &SystemTable &CfgTableEntries &ConfigTable &i &offset &dbghdr &dbgentries &dbgptr &dbginfo &loadedimg
|
|
|
|
ENTRY &SystemTable
|
|
|
|
|
|
|
|
&dbgentries=0
|
2024-01-29 19:59:16 +01:00
|
|
|
&CfgTableEntries=Data.Long(a:&SystemTable+0x68)
|
|
|
|
&ConfigTable=Data.Long(a:&SystemTable+0x70)
|
2011-04-27 19:21:31 +02:00
|
|
|
|
|
|
|
print "config table is at &ConfigTable (&CfgTableEntries entries)"
|
|
|
|
|
|
|
|
; now search for debug info entry with guid 49152E77-1ADA-4764-B7A2-7AFEFED95E8B
|
|
|
|
; 0x49152E77 0x47641ADA 0xFE7AA2B7 0x8B5ED9FE
|
|
|
|
&i=0
|
|
|
|
while &i<&CfgTableEntries
|
|
|
|
(
|
2024-01-29 19:59:16 +01:00
|
|
|
&offset=&ConfigTable+(&i*0x18)
|
2011-04-27 19:21:31 +02:00
|
|
|
if Data.Long(a:&offset)==0x49152E77
|
|
|
|
(
|
|
|
|
if Data.Long(a:&offset+4)==0x47641ADA
|
|
|
|
(
|
|
|
|
if Data.Long(a:&offset+8)==0xFE7AA2B7
|
|
|
|
(
|
|
|
|
if Data.Long(a:&offset+0xc)==0x8B5ED9FE
|
|
|
|
(
|
|
|
|
&dbghdr=Data.Long(a:&offset+0x10)
|
|
|
|
&dbgentries=Data.Long(a:&dbghdr+4)
|
|
|
|
&dbgptr=Data.Long(a:&dbghdr+8)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
&i=&i+1
|
|
|
|
)
|
|
|
|
|
|
|
|
if &dbgentries==0
|
|
|
|
(
|
|
|
|
print "no debug entries found"
|
|
|
|
return
|
|
|
|
)
|
|
|
|
|
|
|
|
print "debug table at &dbgptr (&dbgentries entries)"
|
|
|
|
|
|
|
|
symbol.reset
|
|
|
|
|
|
|
|
&i=0
|
|
|
|
while &i<&dbgentries
|
|
|
|
(
|
|
|
|
&dbginfo=Data.Long(a:&dbgptr+(&i*4))
|
|
|
|
if &dbginfo!=0
|
|
|
|
(
|
|
|
|
if Data.Long(a:&dbginfo)==1 ; normal debug info type
|
|
|
|
(
|
2024-01-29 19:59:16 +01:00
|
|
|
&loadedimg=Data.Long(a:&dbginfo+8)
|
|
|
|
&imagebaseptr=&loadedimg+0x40
|
|
|
|
&imagebase=Data.Long(a:&imagebaseptr)
|
|
|
|
do ~~~~/EfiProcessPeImage.cmm "&imagebase"
|
2011-04-27 19:21:31 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
&i=&i+1
|
|
|
|
)
|
|
|
|
return
|