refactor(kernel): update debug messages

This commit is contained in:
EnderIce2 2025-04-17 16:01:03 +00:00
parent 7902726239
commit e270c9f35b
Signed by: enderice2
GPG Key ID: FEB6B8A8507BA62E
4 changed files with 38 additions and 10 deletions

View File

@ -333,7 +333,7 @@ namespace v0
void PS2Wait(dev_t DriverID, const bool Output)
{
dbg_api("%d, %d", DriverID, Output);
// dbg_api("%d, %d", DriverID, Output);
#if defined(__amd64__) || defined(__i386__)
int Timeout = 100000;
@ -379,7 +379,7 @@ namespace v0
uint8_t PS2ReadData(dev_t DriverID)
{
dbg_api("%d", DriverID);
// dbg_api("%d", DriverID);
#if defined(__amd64__) || defined(__i386__)
WaitOutput;

View File

@ -185,17 +185,13 @@ namespace SymbolResolver
if (strlen(name) == 0)
continue;
SymbolTable tbl{};
SymbolTable tbl;
tbl.Address = sym->st_value;
tbl.FunctionName = new char[strlen(name) + 1];
strcpy(tbl.FunctionName, name);
this->SymTable.push_back(tbl);
this->SymbolTableExists = true;
// debug("Symbol %d: %#lx %s(%#lx)",
// i, tbl.Address,
// tbl.FunctionName,
// name);
// debug("Symbol %d: %#lx %s(%#lx)", i, tbl.Address, tbl.FunctionName, name);
}
}
}

View File

@ -220,6 +220,9 @@ namespace Execute
if (ProgramHeader.p_memsz == 0)
continue;
if (BaseAddress == 0)
BaseAddress = ALIGN_DOWN(ProgramHeader.p_vaddr, PAGE_SIZE);
void *pAddr = vma->RequestPages(TO_PAGES(ProgramHeader.p_memsz + (ProgramHeader.p_vaddr % PAGE_SIZE)), true);
void *vAddr = (void *)ALIGN_DOWN(ProgramHeader.p_vaddr, PAGE_SIZE);
uintptr_t destOffset = ProgramHeader.p_vaddr - uintptr_t(vAddr);
@ -411,6 +414,14 @@ namespace Execute
this->ip = entry;
this->IsElfValid = true;
#ifdef DEBUG
std::string sanitizedPath = fd->Path;
size_t pos = sanitizedPath.find("\x06root-0\x06");
if (pos != std::string::npos)
sanitizedPath.erase(pos, std::string("\x06root-0\x06").length());
debug("gdb: \"-exec add-symbol-file-all /workspaces/Fennix/tmp_rootfs%s %#lx\" entry:%#lx", sanitizedPath.c_str(), base, entry);
#endif
}
void ELFObject::LoadDyn(FileNode *fd, PCB *TargetProcess)
@ -436,7 +447,21 @@ namespace Execute
this->ip = entry;
this->IsElfValid = true;
#ifdef DEBUG
std::string sanitizedPath = fd->Path;
size_t pos = sanitizedPath.find("\x06root-0\x06");
if (pos != std::string::npos)
sanitizedPath.erase(pos, std::string("\x06root-0\x06").length());
debug("gdb: \"-exec add-symbol-file-all /workspaces/Fennix/tmp_rootfs%s %#lx\" entry:%#lx", sanitizedPath.c_str(), base, entry);
#endif
Elf_Phdr interp = ELFGetSymbolType(fd, PT_INTERP).front();
if (interp.p_offset == 0)
{
debug("No interpreter found");
return;
}
std::string interpreterPath;
interpreterPath.resize(256);
fd->Read(interpreterPath.data(), 256, interp.p_offset);
@ -490,6 +515,14 @@ namespace Execute
break;
}
#ifdef DEBUG
std::string sanitizedPath = fd->Path;
size_t pos = sanitizedPath.find("\x06root-0\x06");
if (pos != std::string::npos)
sanitizedPath.erase(pos, std::string("\x06root-0\x06").length());
debug("gdb: \"-exec add-symbol-file-all /workspaces/Fennix/tmp_rootfs%s %#lx\" entry:%#lx", sanitizedPath.c_str(), base, ehdr.e_entry);
#endif
return true;
}
case ET_CORE:

View File

@ -828,8 +828,7 @@ namespace KernelConsole
this->Cells = new TerminalCell[Rows * Columns];
debug("Allocated %d bytes for terminal cells",
(Rows * Columns) * sizeof(TerminalCell));
debug("Allocated %d entries (%d bytes at %#lx-%#lx for terminal cells)", Rows * Columns, (Rows * Columns) * sizeof(TerminalCell), this->Cells, (char *)this->Cells + (Rows * Columns) * sizeof(TerminalCell));
}
VirtualTerminal::~VirtualTerminal() { delete[] this->Cells; }