2007-10-09 Pierre Muller <muller@ics.u-strasbg.fr>
* p-lang.h (pascal_main_name): Add declaration. * p-lang.c (GPC_P_INITIALIZE, GPC_MAIN_PROGRAM_NAME_1) (GPC_MAIN_PROGRAM_NAME_2): New constants. (pascal_main_name): New function. * symtab.c: Include p-lang.h. (find_main_name): Add call to pascal_main_name. * Makefile.in (symtab.o): Add dependency on p-lang.h.
This commit is contained in:
parent
944d6884ea
commit
cd6c7346a6
5 changed files with 73 additions and 2 deletions
50
gdb/p-lang.c
50
gdb/p-lang.c
|
@ -35,6 +35,56 @@
|
|||
extern void _initialize_pascal_language (void);
|
||||
|
||||
|
||||
/* All GPC versions until now (2007-09-27) also define a symbol called
|
||||
'_p_initialize'. Check for the presence of this symbol first. */
|
||||
static const char GPC_P_INITIALIZE[] = "_p_initialize";
|
||||
|
||||
/* The name of the symbol that GPC uses as the name of the main
|
||||
procedure (since version 20050212). */
|
||||
static const char GPC_MAIN_PROGRAM_NAME_1[] = "_p__M0_main_program";
|
||||
|
||||
/* Older versions of GPC (versions older than 20050212) were using
|
||||
a different name for the main procedure. */
|
||||
static const char GPC_MAIN_PROGRAM_NAME_2[] = "pascal_main_program";
|
||||
|
||||
/* Function returning the special symbol name used
|
||||
by GPC for the main procedure in the main program
|
||||
if it is found in minimal symbol list.
|
||||
This function tries to find minimal symbols generated by GPC
|
||||
so that it finds the even if the program was compiled
|
||||
without debugging information.
|
||||
According to information supplied by Waldeck Hebisch,
|
||||
this should work for all versions posterior to June 2000. */
|
||||
|
||||
const char *
|
||||
pascal_main_name (void)
|
||||
{
|
||||
struct minimal_symbol *msym;
|
||||
|
||||
msym = lookup_minimal_symbol (GPC_P_INITIALIZE, NULL, NULL);
|
||||
|
||||
/* If '_p_initialize' was not found, the main program is likely not
|
||||
written in Pascal. */
|
||||
if (msym == NULL)
|
||||
return NULL;
|
||||
|
||||
msym = lookup_minimal_symbol (GPC_MAIN_PROGRAM_NAME_1, NULL, NULL);
|
||||
if (msym != NULL)
|
||||
{
|
||||
return GPC_MAIN_PROGRAM_NAME_1;
|
||||
}
|
||||
|
||||
msym = lookup_minimal_symbol (GPC_MAIN_PROGRAM_NAME_2, NULL, NULL);
|
||||
if (msym != NULL)
|
||||
{
|
||||
return GPC_MAIN_PROGRAM_NAME_2;
|
||||
}
|
||||
|
||||
/* No known entry procedure found, the main program is probably
|
||||
not compiled with GPC. */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Determines if type TYPE is a pascal string type.
|
||||
Returns 1 if the type is a known pascal type
|
||||
This function is used by p-valprint.c code to allow better string display.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue