attempting to store the source location information collected while compiling into the moo_dbginfo_t data structure
This commit is contained in:
parent
81a1785c35
commit
fba3c3213c
@ -240,6 +240,15 @@ int main (int argc, char* argv[])
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* TODO: don't initialize debug information if debug info is not requested.
|
||||
* call moo_loaddbginfo() if loading a compiled image... */
|
||||
if (moo_initdbginfo(moo, 102400) <= -1) /* TODO: set initial debug information size from a configurable value */
|
||||
{
|
||||
moo_logbfmt (moo, MOO_LOG_STDERR, "ERROR: cannot initialize debug information - [%d] %js\n", moo_geterrnum(moo), moo_geterrstr(moo));
|
||||
moo_close (moo);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
#if defined(macintosh)
|
||||
i = 20;
|
||||
|
@ -6824,7 +6824,7 @@ static int add_compiled_method (moo_t* moo)
|
||||
/* the method has been read in from the main souce stream */
|
||||
source_file = moo->_nil;
|
||||
}
|
||||
|
||||
|
||||
preamble_code = MOO_METHOD_PREAMBLE_NONE;
|
||||
preamble_index = 0;
|
||||
preamble_flags = 0;
|
||||
|
@ -66,3 +66,37 @@ void moo_dumpdic (moo_t* moo, moo_oop_dic_t dic, const moo_bch_t* title)
|
||||
}
|
||||
MOO_DEBUG0 (moo, "--------------------------------------------\n");
|
||||
}
|
||||
|
||||
|
||||
/* TODO: moo_loaddbginfofromimage() -> load debug information from compiled image?
|
||||
moo_storedbginfotoimage()? -> store debug information to compiled image?
|
||||
moo_compactdbginfo()? -> compact debug information by scaning dbginfo data. find class and method. if not found, drop the portion.
|
||||
*/
|
||||
|
||||
int moo_initdbginfo (moo_t* moo, moo_oow_t capa)
|
||||
{
|
||||
moo_dbginfo_t* info;
|
||||
|
||||
info = (moo_dbginfo_t*)moo_allocmem(moo, MOO_SIZEOF(*info) + capa);
|
||||
if (!info) return -1;
|
||||
|
||||
info->_capa = capa;
|
||||
info->_len = 0;
|
||||
|
||||
moo->dbginfo = info;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void moo_finidbginfo (moo_t* moo)
|
||||
{
|
||||
if (moo->dbginfo)
|
||||
{
|
||||
moo_freemem (moo, moo->dbginfo);
|
||||
moo->dbginfo = MOO_NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int moo_addmethodtodbginfo (moo_t* moo, const moo_uch_t* class_name, const moo_uch_t* method_name)
|
||||
{
|
||||
return 0;
|
||||
}
|
@ -249,6 +249,8 @@ void moo_fini (moo_t* moo)
|
||||
* the heap may not exist */
|
||||
if (moo->heap) moo_killheap (moo, moo->heap);
|
||||
|
||||
moo_finidbginfo (moo);
|
||||
|
||||
for (i = 0; i < MOO_COUNTOF(moo->sbuf); i++)
|
||||
{
|
||||
if (moo->sbuf[i].ptr)
|
||||
|
@ -944,6 +944,14 @@ struct moo_heap_t
|
||||
moo_space_t newspace;
|
||||
};
|
||||
|
||||
typedef struct moo_dbginfo_t moo_dbginfo_t;
|
||||
struct moo_dbginfo_t
|
||||
{
|
||||
moo_oow_t _capa;
|
||||
moo_oow_t _len;
|
||||
/* actual information is recorded here */
|
||||
};
|
||||
|
||||
/* =========================================================================
|
||||
* VM LOGGING
|
||||
* ========================================================================= */
|
||||
@ -1423,6 +1431,7 @@ struct moo_t
|
||||
/* ========================= */
|
||||
|
||||
moo_heap_t* heap;
|
||||
moo_dbginfo_t* dbginfo;
|
||||
|
||||
/* =============================================================
|
||||
* nil, true, false
|
||||
@ -2050,6 +2059,14 @@ MOO_EXPORT int moo_invoke (
|
||||
const moo_oocs_t* mthname
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* The moo_abort() function requests to stop on-going execution.
|
||||
* On-going execution doesn't get terminated immediately when this function
|
||||
* returns. Termination of execution is honored by the virtual machine.
|
||||
* If the virtual machine is in a blocking context, termination will only
|
||||
* occur after it gets out of the blocking context.
|
||||
*/
|
||||
MOO_EXPORT void moo_abort (
|
||||
moo_t* moo
|
||||
);
|
||||
@ -2061,6 +2078,23 @@ MOO_EXPORT void moo_abort (
|
||||
# define moo_switchprocess(moo) ((moo)->switch_proc = 1)
|
||||
#endif
|
||||
|
||||
/* =========================================================================
|
||||
* DEBUG SUPPORT
|
||||
* ========================================================================= */
|
||||
|
||||
MOO_EXPORT int moo_initdbginfo (
|
||||
moo_t* moo,
|
||||
moo_oow_t init_capa
|
||||
);
|
||||
|
||||
/**
|
||||
* The moo_finidbginfo() function deletes the debug information.
|
||||
* It is called by moo_close(). Unless you want the debug information to
|
||||
* be deleted earlier, you need not call this function explicitly.
|
||||
*/
|
||||
MOO_EXPORT void moo_finidbginfo (
|
||||
moo_t* moo
|
||||
);
|
||||
/* =========================================================================
|
||||
* COMMON OBJECT MANAGEMENT FUNCTIONS
|
||||
* ========================================================================= */
|
||||
|
Loading…
Reference in New Issue
Block a user