mirror of
https://github.com/cc65/cc65.git
synced 2025-01-13 09:31:53 +00:00
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
File diff suppressed because it is too large
Load Diff
@ -77,7 +77,7 @@ typedef void (*cc65_errorfunc) (const struct cc65_parseerror*);
|
||||
/* Line information */
|
||||
typedef struct cc65_lineinfo cc65_lineinfo;
|
||||
struct cc65_lineinfo {
|
||||
unsigned count; /* Count of data sets that follow */
|
||||
unsigned count; /* Number of data sets that follow */
|
||||
struct {
|
||||
const char* name; /* Name of the file */
|
||||
unsigned long size; /* Size of file */
|
||||
@ -88,6 +88,17 @@ struct cc65_lineinfo {
|
||||
} 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);
|
||||
/* 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
|
||||
* 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);
|
||||
/* 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;
|
||||
cc65_dbginfo Info;
|
||||
cc65_filelist* Files;
|
||||
unsigned I;
|
||||
unsigned long Addr;
|
||||
|
||||
|
||||
@ -82,11 +84,20 @@ int main (int argc, char** argv)
|
||||
}
|
||||
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
|
||||
* space. This is also sort of a benchmark for the search algorithms.
|
||||
*/
|
||||
printf ("Line info:\n");
|
||||
for (Addr = 0; Addr < 0x10000; ++Addr) {
|
||||
cc65_lineinfo* L = cc65_get_lineinfo (Info, Addr);
|
||||
cc65_lineinfo* L = cc65_lineinfo_byaddr (Info, Addr);
|
||||
if (L) {
|
||||
unsigned I;
|
||||
printf (" $%04lX: ", Addr);
|
||||
|
Loading…
x
Reference in New Issue
Block a user