thermosphere: gdb: add debugManagerInit

This commit is contained in:
TuxSH 2020-01-31 02:53:40 +00:00
parent 057d3e5e1c
commit 1fd2cdb664
7 changed files with 85 additions and 3 deletions

View file

@ -152,7 +152,7 @@ SECTIONS
. = ALIGN(8);
__real_bss_end__ = ABSOLUTE(.);
__image_size__ = ABSOLUTE(__real_bss_end__ - __start__);
ASSERT(__image_size__ <= __max_image_size__, "Image too big!");
/*ASSERT(__image_size__ <= __max_image_size__, "Image too big!");*/
/*
The logic here: tempbss *additional pages* are at a very different PA, but
we can allow .tempbss to use unused "non-temporary" BSS space. Their VAs are

View file

@ -75,6 +75,12 @@ void debugManagerPauseSgiHandler(void)
barrierWait(&g_debugManager.pauseBarrier);
}
void debugManagerInit(TransportInterfaceType gdbIfaceType, u32 gdbIfaceId, u32 gdbIfaceFlags)
{
memset(&g_debugManager, 0, sizeof(DebugManager));
GDB_InitializeContext(&g_gdbContext, gdbIfaceType, gdbIfaceId, gdbIfaceFlags);
}
bool debugManagerHandlePause(void)
{
u32 coreId = currentCoreCtx->coreId;

View file

@ -18,6 +18,7 @@
#include "exceptions.h"
#include "gdb/context.h"
#include "transport_interface.h"
extern GDBContext g_gdbContext;
@ -49,6 +50,8 @@ typedef struct DebugEventInfo {
void debugManagerPauseSgiHandler(void);
void debugManagerInit(TransportInterfaceType gdbIfaceType, u32 gdbIfaceId, u32 gdbIfaceFlags);
void debugManagerSetReportingEnabled(bool enabled);
// Hypervisor interrupts will be serviced during the pause-wait

View file

@ -43,6 +43,7 @@
#include "../watchpoints.h"
static TEMPORARY char g_gdbWorkBuffer[GDB_WORK_BUF_LEN];
static TEMPORARY char g_gdbBuffer[GDB_BUF_LEN + 4];
static const struct{
char command;
@ -174,6 +175,7 @@ void GDB_InitializeContext(GDBContext *ctx, TransportInterfaceType ifaceType, u3
{
memset(ctx, 0, sizeof(GDBContext));
ctx->workBuffer = g_gdbWorkBuffer;
ctx->buffer = g_gdbBuffer;
ctx->transportInterface = transportInterfaceCreate(
ifaceType,
ifaceId,

View file

@ -93,7 +93,7 @@ typedef struct GDBContext {
char *commandData, *commandEnd;
size_t lastSentPacketSize;
char buffer[GDB_BUF_LEN + 4];
char *buffer;
char *workBuffer;
} GDBContext;

View file

@ -101,7 +101,7 @@ void thermosphereMain(ExceptionStackFrame *frame, u64 pct)
transportInterfaceInitLayer();
debugLogInit();
test();
debugManagerInit(TRANSPORT_INTERFACE_TYPE_UART, DEFAULT_UART, DEFAULT_UART_FLAGS);
DEBUG("EL2: core %u reached main first!\n", currentCoreCtx->coreId);
}

View file

@ -700,6 +700,77 @@ strchr (const char *s1,
return NULL;
}
/*
FUNCTION
<<strcat>>---concatenate strings
INDEX
strcat
ANSI_SYNOPSIS
#include <string.h>
char *strcat(char *<[dst]>, const char *<[src]>);
TRAD_SYNOPSIS
#include <string.h>
char *strcat(<[dst]>, <[src]>)
char *<[dst]>;
char *<[src]>;
DESCRIPTION
<<strcat>> appends a copy of the string pointed to by <[src]>
(including the terminating null character) to the end of the
string pointed to by <[dst]>. The initial character of
<[src]> overwrites the null character at the end of <[dst]>.
RETURNS
This function returns the initial value of <[dst]>
PORTABILITY
<<strcat>> is ANSI C.
<<strcat>> requires no supporting OS subroutines.
QUICKREF
strcat ansi pure
*/
/*SUPPRESS 560*/
/*SUPPRESS 530*/
char *
strcat (char *s1, const char *s2)
{
#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__)
char *s = s1;
while (*s1)
s1++;
while ((*s1++ = *s2++))
;
return s;
#else
char *s = s1;
/* Skip over the data in s1 as quickly as possible. */
if (ALIGNED (s1))
{
unsigned long *aligned_s1 = (unsigned long *)s1;
while (!DETECTNULL (*aligned_s1))
aligned_s1++;
s1 = (char *)aligned_s1;
}
while (*s1)
s1++;
/* s1 now points to the its trailing null character, we can
just use strcpy to do the work for us now.
?!? We might want to just include strcpy here.
Also, this will cause many more unaligned string copies because
s1 is much less likely to be aligned. I don't know if its worth
tweaking strcpy to handle this better. */
strcpy (s1, s2);
return s;
#endif /* not PREFER_SIZE_OVER_SPEED */
}
/*
FUNCTION
<<strcmp>>---character string compare