diff options
author | Pierre Muller <muller@sourceware.org> | 2008-06-11 22:03:49 +0000 |
---|---|---|
committer | Pierre Muller <muller@sourceware.org> | 2008-06-11 22:03:49 +0000 |
commit | 4309257cda01fce18971fd5a5ea28ed6aaf552cc (patch) | |
tree | 3207f06e4a8f03ae972c6da4a37a795ec78cfeda /gdb/symtab.c | |
parent | a4e2ee12f0631722c380973c0336dd165fd0137d (diff) | |
download | gdb-4309257cda01fce18971fd5a5ea28ed6aaf552cc.zip gdb-4309257cda01fce18971fd5a5ea28ed6aaf552cc.tar.gz gdb-4309257cda01fce18971fd5a5ea28ed6aaf552cc.tar.bz2 |
* gdbarch.sh (gdbarch_skip_main_prologue): New.
* gdbarch.h, gdbarch.c: Regenerate.
* i386-tdep.h (i386_skip_main_prologue): Declare.
* i386-tdep.c (i386_skip_main_prologue): New.
* i386-cygwin-tdep.c (i386_cygwin_init_abi): Register
i386_skip_main_prologue as gdbarch_skip_main_prologue gdbarch callback.
* symtab.c (find_function_start_sal): When pc points at the "main"
function, call gdbarch_skip_main_prologue.
Diffstat (limited to 'gdb/symtab.c')
-rw-r--r-- | gdb/symtab.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c index 6adecbf..0466490 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -2617,6 +2617,21 @@ find_function_start_sal (struct symbol *sym, int funfirstline) /* Recalculate the line number (might not be N+1). */ sal = find_pc_sect_line (pc, SYMBOL_BFD_SECTION (sym), 0); } + + /* On targets with executable formats that don't have a concept of + constructors (ELF with .init has, PE doesn't), gcc emits a call + to `__main' in `main' between the prologue and before user + code. */ + if (funfirstline + && gdbarch_skip_main_prologue_p (current_gdbarch) + && SYMBOL_LINKAGE_NAME (sym) + && strcmp (SYMBOL_LINKAGE_NAME (sym), "main") == 0) + { + pc = gdbarch_skip_main_prologue (current_gdbarch, pc); + /* Recalculate the line number (might not be N+1). */ + sal = find_pc_sect_line (pc, SYMBOL_BFD_SECTION (sym), 0); + } + sal.pc = pc; return sal; |