summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2007-10-31 19:39:53 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2007-10-31 19:39:53 +0000
commit22895839ee9361ea29d796e0cea093b0b905f740 (patch)
treef31305e6da1b5fb4bb2dc963b2df27c1fb8288eb
parent3046af380a719bd7e763718dde1e6e464cf7134c (diff)
Pull from master repo, commit by gmcgarry:
Provide compile-time flag STAB_LINE_ASSOLUTE which creates N_SLINE stabs using absolute addresses instead of relative addresses. Fixes debugging on OSX (and probably other non-ELF targets).
-rw-r--r--usr.bin/pcc/ccom/stabs.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/usr.bin/pcc/ccom/stabs.c b/usr.bin/pcc/ccom/stabs.c
index 8263add7129..71e3ba6f85d 100644
--- a/usr.bin/pcc/ccom/stabs.c
+++ b/usr.bin/pcc/ccom/stabs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: stabs.c,v 1.2 2007/10/20 18:24:11 otto Exp $ */
+/* $OpenBSD: stabs.c,v 1.3 2007/10/31 19:39:52 otto Exp $ */
/*
* Copyright (c) 2004 Anders Magnusson (ragge@ludd.luth.se).
@@ -183,7 +183,11 @@ findtype(TWORD t, union dimfun *df, struct suedef *sue)
void
stabs_line(int line)
{
+#ifdef STAB_LINE_ABSOLUTE
+ cprint(savestabs, ".stabn %d,0,%d," STABLBL, N_SLINE, line, stablbl);
+#else
cprint(savestabs, ".stabn %d,0,%d," STABLBL "-%s", N_SLINE, line, stablbl, exname(curfun));
+#endif
cprint(1, STABLBL ":", stablbl++);
}
@@ -193,8 +197,12 @@ stabs_line(int line)
void
stabs_lbrac(int blklvl)
{
+#ifdef STAB_LINE_ABSOLUTE
+ cprint(savestabs, ".stabn %d,0,%d," STABLBL, N_LBRAC, blklvl, stablbl);
+#else
cprint(savestabs, ".stabn %d,0,%d," STABLBL "-%s",
N_LBRAC, blklvl, stablbl, exname(curfun));
+#endif
cprint(1, STABLBL ":", stablbl++);
}
@@ -204,8 +212,13 @@ stabs_lbrac(int blklvl)
void
stabs_rbrac(int blklvl)
{
+#ifdef STAB_LINE_ABSOLUTE
+ cprint(savestabs, ".stabn %d,0,%d," STABLBL "\n",
+ N_RBRAC, blklvl, stablbl);
+#else
cprint(savestabs, ".stabn %d,0,%d," STABLBL "-%s\n",
N_RBRAC, blklvl, stablbl, exname(curfun));
+#endif
cprint(1, STABLBL ":", stablbl++);
}