some more API calls

fixed another bug in debug section

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40258
This commit is contained in:
David Anderson 2007-01-01 20:58:02 +00:00
parent 2fc806542a
commit 473550130c
3 changed files with 43 additions and 2 deletions

View File

@ -608,6 +608,20 @@ namespace SourcePawn
* @return Number of functions.
*/
virtual unsigned int FunctionCount(const sp_context_t *ctx) =0;
/**
* @brief Returns a version string.
*
* @return Versioning string.
*/
virtual const char *GetVersionString() =0;
/**
* @brief Returns a string describing optimizations.
*
* @return String describing CPU specific optimizations.
*/
virtual const char *GetCPUOptimizations() =0;
};
};

View File

@ -2119,8 +2119,23 @@ jit_rewind:
{
sym = (sp_fdbg_symbol_t *)cursor;
ctx->symbols[iter].codestart = RelocLookup(jit, sym->codestart, false);
ctx->symbols[iter].codeend = RelocLookup(jit, sym->codeend, false);
/**
* @brief There is an "issue" where the compiler will give totally bogus code
* address because codegeneration is still being calculated. A simple fix for
* this is to coerce the codestart value to 0 when it's invalid.
*/
if (sym->codestart > data->codesize)
{
ctx->symbols[iter].codestart = 0;
} else {
ctx->symbols[iter].codestart = RelocLookup(jit, sym->codestart, false);
}
if (sym->codeend > data->codesize)
{
ctx->symbols[iter].codeend = data->codesize;
} else {
ctx->symbols[iter].codeend = RelocLookup(jit, sym->codeend, false);
}
ctx->symbols[iter].name = strbase + sym->name;
ctx->symbols[iter].sym = sym;
@ -2261,3 +2276,13 @@ unsigned int JITX86::FunctionCount(const sp_context_t *ctx)
return fnc->num_functions;
}
const char *JITX86::GetVersionString()
{
return "1.0.0.0";
}
const char *JITX86::GetCPUOptimizations()
{
return "Generic 80486";
}

View File

@ -81,6 +81,8 @@ public:
unsigned int GetAPIVersion();
bool FunctionLookup(const sp_context_t *ctx, uint32_t code_addr, unsigned int *result);
unsigned int FunctionCount(const sp_context_t *ctx);
const char *GetVersionString();
const char *GetCPUOptimizations();
};
cell_t NativeCallback(sp_context_t *ctx, ucell_t native_idx, cell_t *params);