aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2008-02-27 20:27:49 +0000
committerJoel Brobecker <brobecker@gnat.com>2008-02-27 20:27:49 +0000
commit6a048695b3493bf9d6bb6237f6601f551d6750ed (patch)
tree281ea00ffdb58a8b7985fa6d1fa8c8708b744fa0
parent0b998f49632b88e19c955a54108d96585b3ba1e6 (diff)
downloadgdb-6a048695b3493bf9d6bb6237f6601f551d6750ed.zip
gdb-6a048695b3493bf9d6bb6237f6601f551d6750ed.tar.gz
gdb-6a048695b3493bf9d6bb6237f6601f551d6750ed.tar.bz2
* breakpoint.c (skip_prologue_sal): New function.
(resolve_sal_pc): Adjust SAL past prologue if the SAL was computed from a line number.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/breakpoint.c24
2 files changed, 30 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 96dd838..aae2461 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2008-02-27 Joel Brobecker <brobecker@adacore.com>
+ * breakpoint.c (skip_prologue_sal): New function.
+ (resolve_sal_pc): Adjust SAL past prologue if the SAL was
+ computed from a line number.
+
+2008-02-27 Joel Brobecker <brobecker@adacore.com>
+
* features/rs6000/power-core.xml, features/rs6000/power64-core.xml
features/rs6000/powerpc-601.xml, features/rs6000/rs6000.xml:
Set PC register type to "code_ptr".
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 019f4c8..a689e3a 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -5482,6 +5482,25 @@ set_breakpoint (char *address, char *condition,
0);
}
+/* Adjust SAL to the first instruction past the function prologue.
+ The end of the prologue is determined using the line table from
+ the debugging information.
+
+ If SAL is already past the prologue, then do nothing. */
+
+static void
+skip_prologue_sal (struct symtab_and_line *sal)
+{
+ struct symbol *sym = find_pc_function (sal->pc);
+ struct symtab_and_line start_sal;
+
+ if (sym == NULL)
+ return;
+
+ start_sal = find_function_start_sal (sym, 1);
+ if (sal->pc < start_sal.pc)
+ *sal = start_sal;
+}
/* Helper function for break_command_1 and disassemble_command. */
@@ -5496,6 +5515,11 @@ resolve_sal_pc (struct symtab_and_line *sal)
error (_("No line %d in file \"%s\"."),
sal->line, sal->symtab->filename);
sal->pc = pc;
+
+ /* If this SAL corresponds to a breakpoint inserted using
+ a line number, then skip the function prologue if necessary. */
+ if (sal->explicit_line)
+ skip_prologue_sal (sal);
}
if (sal->section == 0 && sal->symtab != NULL)