Improved info API.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4789 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
8c39874daa
commit
d645a797cb
3 changed files with 871 additions and 232 deletions
File diff suppressed because it is too large
Load diff
|
@ -77,7 +77,7 @@ typedef void (*cc65_errorfunc) (const struct cc65_parseerror*);
|
||||||
/* Line information */
|
/* Line information */
|
||||||
typedef struct cc65_lineinfo cc65_lineinfo;
|
typedef struct cc65_lineinfo cc65_lineinfo;
|
||||||
struct cc65_lineinfo {
|
struct cc65_lineinfo {
|
||||||
unsigned count; /* Count of data sets that follow */
|
unsigned count; /* Number of data sets that follow */
|
||||||
struct {
|
struct {
|
||||||
const char* name; /* Name of the file */
|
const char* name; /* Name of the file */
|
||||||
unsigned long size; /* Size of file */
|
unsigned long size; /* Size of file */
|
||||||
|
@ -88,6 +88,17 @@ struct cc65_lineinfo {
|
||||||
} data[1];
|
} data[1];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* A list of files with some information */
|
||||||
|
typedef struct cc65_filelist cc65_filelist;
|
||||||
|
struct cc65_filelist {
|
||||||
|
unsigned count; /* Number of data sets that follow */
|
||||||
|
struct {
|
||||||
|
const char* name; /* Name of the file */
|
||||||
|
unsigned long size; /* Size of file */
|
||||||
|
unsigned long mtime; /* Modification time */
|
||||||
|
} data[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -107,13 +118,25 @@ cc65_dbginfo cc65_read_dbginfo (const char* filename, cc65_errorfunc errorfunc);
|
||||||
void cc65_free_dbginfo (cc65_dbginfo Handle);
|
void cc65_free_dbginfo (cc65_dbginfo Handle);
|
||||||
/* Free debug information read from a file */
|
/* Free debug information read from a file */
|
||||||
|
|
||||||
cc65_lineinfo* cc65_get_lineinfo (cc65_dbginfo handle, unsigned long addr);
|
cc65_lineinfo* cc65_lineinfo_byaddr (cc65_dbginfo handle, unsigned long addr);
|
||||||
/* Return line information for the given address. The function returns NULL
|
/* Return line information for the given address. The function returns NULL
|
||||||
* if no line information was found.
|
* if no line information was found.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
cc65_lineinfo* cc65_lineinfo_byname (cc65_dbginfo handle, const char* filename,
|
||||||
|
cc65_line line);
|
||||||
|
/* Return line information for a file/line number combination. The function
|
||||||
|
* returns NULL if no line information was found.
|
||||||
|
*/
|
||||||
|
|
||||||
void cc65_free_lineinfo (cc65_dbginfo handle, cc65_lineinfo* info);
|
void cc65_free_lineinfo (cc65_dbginfo handle, cc65_lineinfo* info);
|
||||||
/* Free line info returned by cc65_get_lineinfo() */
|
/* Free line info returned by one of the other functions */
|
||||||
|
|
||||||
|
cc65_filelist* cc65_get_filelist (cc65_dbginfo handle);
|
||||||
|
/* Return a list of all files referenced in the debug information */
|
||||||
|
|
||||||
|
void cc65_free_filelist (cc65_dbginfo handle, cc65_filelist* list);
|
||||||
|
/* free a file list returned by cc65_get_filelist() */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -65,6 +65,8 @@ int main (int argc, char** argv)
|
||||||
{
|
{
|
||||||
const char* Input;
|
const char* Input;
|
||||||
cc65_dbginfo Info;
|
cc65_dbginfo Info;
|
||||||
|
cc65_filelist* Files;
|
||||||
|
unsigned I;
|
||||||
unsigned long Addr;
|
unsigned long Addr;
|
||||||
|
|
||||||
|
|
||||||
|
@ -82,14 +84,23 @@ int main (int argc, char** argv)
|
||||||
}
|
}
|
||||||
printf ("Input file \"%s\" successfully read\n", Input);
|
printf ("Input file \"%s\" successfully read\n", Input);
|
||||||
|
|
||||||
|
/* Output a list of files */
|
||||||
|
printf ("Files used in compilation:\n");
|
||||||
|
Files = cc65_get_filelist (Info);
|
||||||
|
for (I = 0; I < Files->count; ++I) {
|
||||||
|
printf (" %s\n", Files->data[I].name);
|
||||||
|
}
|
||||||
|
cc65_free_filelist (Info, Files);
|
||||||
|
|
||||||
/* Output debug information for all addresses in the complete 6502 address
|
/* Output debug information for all addresses in the complete 6502 address
|
||||||
* space. This is also sort of a benchmark for the search algorithms.
|
* space. This is also sort of a benchmark for the search algorithms.
|
||||||
*/
|
*/
|
||||||
|
printf ("Line info:\n");
|
||||||
for (Addr = 0; Addr < 0x10000; ++Addr) {
|
for (Addr = 0; Addr < 0x10000; ++Addr) {
|
||||||
cc65_lineinfo* L = cc65_get_lineinfo (Info, Addr);
|
cc65_lineinfo* L = cc65_lineinfo_byaddr (Info, Addr);
|
||||||
if (L) {
|
if (L) {
|
||||||
unsigned I;
|
unsigned I;
|
||||||
printf ("$%04lX: ", Addr);
|
printf (" $%04lX: ", Addr);
|
||||||
for (I = 0; I < L->count; ++I) {
|
for (I = 0; I < L->count; ++I) {
|
||||||
if (I > 0) {
|
if (I > 0) {
|
||||||
printf (", ");
|
printf (", ");
|
||||||
|
|
Loading…
Add table
Reference in a new issue