|
VOID EFIAPI | GdbSymbolEventHandler (IN EFI_EVENT Event, IN VOID *Context) |
|
EFI_STATUS EFIAPI | GdbStubEntry (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) |
|
VOID | TransferFromInBufToMem (IN UINTN Length, IN unsigned char *Address, IN CHAR8 *NewData) |
|
VOID | TransferFromMemToOutBufAndSend (IN UINTN Length, IN unsigned char *Address) |
|
UINTN | SendPacket (IN CHAR8 *PacketData) |
|
UINTN | ReceivePacket (OUT CHAR8 *PacketData, IN UINTN PacketDataSize) |
|
VOID | EmptyBuffer (IN CHAR8 *Buf) |
|
INTN | HexCharToInt (IN CHAR8 Char) |
|
VOID EFIAPI | SendError (IN UINT8 ErrorNum) |
|
VOID EFIAPI | SendSuccess (VOID) |
|
VOID EFIAPI | SendNotSupported (VOID) |
|
VOID | GdbSendTSignal (IN EFI_SYSTEM_CONTEXT SystemContext, IN UINT8 GdbExceptionType) |
|
UINT8 | ConvertEFItoGDBtype (IN EFI_EXCEPTION_TYPE EFIExceptionType) |
|
VOID EFIAPI | ReadFromMemory (CHAR8 *PacketData) |
|
VOID EFIAPI | WriteToMemory (IN CHAR8 *PacketData) |
|
UINTN | ParseBreakpointPacket (IN CHAR8 *PacketData, OUT UINTN *Type, OUT UINTN *Address, OUT UINTN *Length) |
|
UINTN | gXferObjectReadResponse (IN CHAR8 Type, IN CHAR8 *Str) |
|
VOID *EFIAPI | PeCoffLoaderGetDebuggerInfo (IN VOID *Pe32Data, OUT VOID **DebugBase) |
|
VOID | QxferLibrary (IN UINTN Offset, IN UINTN Length) |
|
VOID EFIAPI | GdbExceptionHandler (IN EFI_EXCEPTION_TYPE ExceptionType, IN OUT EFI_SYSTEM_CONTEXT SystemContext) |
|
VOID EFIAPI | GdbPeriodicCallBack (IN OUT EFI_SYSTEM_CONTEXT SystemContext) |
|
UEFI driver that implements a GDB stub
Note: Any code in the path of the Serial IO output can not call DEBUG as will will blow out the stack. Serial IO calls DEBUG, debug calls Serial IO, ...
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file GdbStub.c.
VOID *EFIAPI PeCoffLoaderGetDebuggerInfo |
( |
IN VOID * |
Pe32Data, |
|
|
OUT VOID ** |
DebugBase |
|
) |
| |
Note: This should be a library function. In the Apple case you have to add the size of the PE/COFF header into the starting address to make things work right as there is no way to pad the Mach-O for the size of the PE/COFF header.
Returns a pointer to the PDB file name for a PE/COFF image that has been loaded into system memory with the PE/COFF Loader Library functions.
Returns the PDB file name for the PE/COFF image specified by Pe32Data. If the PE/COFF image specified by Pe32Data is not a valid, then NULL is returned. If the PE/COFF image specified by Pe32Data does not contain a debug directory entry, then NULL is returned. If the debug directory entry in the PE/COFF image specified by Pe32Data does not contain a PDB file name, then NULL is returned. If Pe32Data is NULL, then ASSERT().
- Parameters
-
Pe32Data | Pointer to the PE/COFF image that is loaded in system memory. |
DebugBase | Address that the debugger would use as the base of the image |
- Returns
- The PDB file name for the PE/COFF image specified by Pe32Data or NULL if it cannot be retrieved. DebugBase is only valid if PDB file name is valid.
Definition at line 838 of file GdbStub.c.
Process "qXfer:object:read:annex:offset,length" request.
Returns an XML document that contains loaded libraries. In our case it is information in the EFI Debug Image Table converted into an XML document.
GDB will call with an arbitrary length (it can't know the real length and will reply with chunks of XML that are easy for us to deal with. Gdb will keep calling until we say we are done. XML doc looks like:
<library-list> <library name="/a/a/c/d.dSYM"><segment address="0x10000000"></library> <library name="/a/m/e/e.pdb"><segment address="0x20000000"></library> <library name="/a/l/f/f.dll"><segment address="0x30000000"></library> </library-list>
Since we can not allocate memory in interrupt context this module has assumptions about how it will get called: 1) Length will generally be max remote packet size (big enough) 2) First Offset of an XML document read needs to be 0 3) This code will return back small chunks of the XML document on every read. Each subsequent call will ask for the next available part of the document.
Note: The only variable size element in the XML is: " <library name=\"%s\"><segment address=\"%p\"/></library>\n" and it is based on the file path and name of the symbol file. If the symbol file name is bigger than the max gdb remote packet size we could update this code to respond back in chunks.
- Parameters
-
Offset | offset into special data area |
Length | number of bytes to read starting at Offset |
Definition at line 1004 of file GdbStub.c.
VOID EFIAPI ReadFromMemory |
( |
CHAR8 * |
PacketData | ) |
|
"m addr,length" Find the Length of the area to read and the start address. Finally, pass them to another function, TransferFromMemToOutBufAndSend, that will read from that memory space and send it as a packet.
pointer to the input buffer
Definition at line 593 of file GdbStub.c.
Receive a GDB Remote Serial Protocol Packet
$PacketData::checksum PacketData is passed in and this function adds the packet prefix '$', the packet terminating character '#' and the two digit checksum.
If host re-starts sending a packet without ending the previous packet, only the last valid packet is processed. (In other words, if received packet is '$12345$12345$123456::checksum', only '$123456::checksum' will be processed.)
If an ack '+' is not sent resend the packet
- Parameters
-
PacketData | Payload data for the packet |
- Return values
-
Number | of bytes of packet data received. |
Definition at line 327 of file GdbStub.c.
UINTN SendPacket |
( |
IN CHAR8 * |
PacketData | ) |
|
Send a GDB Remote Serial Protocol Packet
$PacketData::checksum PacketData is passed in and this function adds the packet prefix '$', the packet terminating character '#' and the two digit checksum.
If an ack '+' is not sent resend the packet, but timeout eventually so we don't end up in an infinite loop. This is so if you unplug the debugger code just keeps running
- Parameters
-
PacketData | Payload data for the packet |
- Return values
-
Number | of bytes of packet data sent. |
Definition at line 270 of file GdbStub.c.
VOID EFIAPI WriteToMemory |
( |
IN CHAR8 * |
PacketData | ) |
|
"M addr,length :XX..." Find the Length of the area in bytes to write and the start address. Finally, pass them to another function, TransferFromInBufToMem, that will write to that memory space the info in the input buffer.
pointer to the input buffer
Definition at line 640 of file GdbStub.c.