Specifically, this disables the special support in the RTS for looking up the datacon name corresponding to an address.
Correspondingly, the debugging commads in GHCi will not be available, and neither will the '-fdebugging' flag
# Yes, include the interepreter, readline, and Template Haskell extensions
SRC_HC_OPTS += -DGHCI -package template-haskell
-# -DBREAKPOINT causes a loop in stage2
-# SRC_HC_OPTS += -DGHCI -DBREAKPOINT -package template-haskell
PKG_DEPENDS += template-haskell
+# Should the debugger commands be enabled?
+ifeq "$(GhciWithDebugger)" "YES"
+SRC_HC_OPTS += -DDEBUGGER
+endif
# Should GHCI be building info tables in the TABLES_NEXT_TO_CODE style
# or not?
ifeq "$(GhcEnableTablesNextToCode) $(GhcUnregisterised)" "YES NO"
import Outputable
import ErrUtils ( debugTraceMsg )
import FastString ( mkFastString, unpackFS )
-import DynFlags ( GhcMode(..), DynFlag(Opt_Debugging, Opt_IgnoreBreakpoints) )
+import DynFlags ( GhcMode(..), DynFlag(..) )
import DsMonad
import {-#SOURCE#-}DsExpr ( dsLExpr )
instrumenting = idName bkptFuncId == breakpointAutoName
debug_enabled :: DsM Bool
+#if defined(GHCI) && defined(DEBUGGER)
debug_enabled = do
debugging <- doptDs Opt_Debugging
b_enabled <- breakpoints_enabled
return (debugging && b_enabled)
+#else
+debug_enabled = return False
+#endif
maybeInsertBreakpoint :: LHsExpr Id -> Type -> DsM (LHsExpr Id)
--maybeInsertBreakpoint e | pprTrace("insertBreakpoint at" (ppr e) False = undefined
refreshBkptTable [] = return ()
refreshBkptTable (ms:mod_sums) = do
sess <- getSession
- when (Opt_Debugging `elem` flags (GHC.ms_hspp_opts ms)) $ do
+ when isDebugging $ do
old_table <- getBkptTable
new_table <- addModuleGHC sess old_table (GHC.ms_mod ms)
setBkptTable new_table
(ppr mod <> text ": inserted " <> int (length sites) <>
text " breakpoints")
return$ addModule mod sites bt
+#if defined(GHCI) && defined(DEBUGGER)
+ isDebugging = Opt_Debugging `elem` flags (GHC.ms_hspp_opts ms)
+#else
+ isDebugging = False
+#endif
\ No newline at end of file
("etags", keepGoing createETagsFileCmd, False, completeFilename),
("ctags", keepGoing createCTagsFileCmd, False, completeFilename),
("type", keepGoing typeOfExpr, False, completeIdentifier),
-#if defined(GHCI)
+#if defined(DEBUGGER)
("print", keepGoing (pprintClosureCommand True False), False, completeIdentifier),
("sprint", keepGoing (pprintClosureCommand False False),False, completeIdentifier),
("force", keepGoing (pprintClosureCommand False True), False, completeIdentifier),
| Opt_SplitObjs
| Opt_StgStats
| Opt_HideAllPackages
+#if defined(GHCI) && defined(DEBUGGER)
| Opt_Debugging
+#endif
| Opt_PrintBindResult
| Opt_Haddock
-> TcM hs_syn -- Of type t
runMeta convert expr
= do { -- Desugar
+#if defined(GHCI) && defined(DEBUGGER)
ds_expr <- unsetOptM Opt_Debugging $ initDsTc (dsLExpr expr)
-
+#else
+ ds_expr <- initDsTc (dsLExpr expr)
+#endif
-- Compile and link it; might fail if linking fails
; hsc_env <- getTopEnv
; src_span <- getSrcSpanM
HscIfaceFileVersion=6
+# Building with debugger?
+GhciWithDebugger=YES
+
#------------------------------------------------------------------------------
# Options for Libraries
/* Hash table mapping symbol names to StgStablePtr */
static /*Str*/HashTable *stablehash;
-#if defined(GHCI) && defined(BREAKPOINT)
+#if defined(DEBUGGER)
/* Hash table mapping info table ptrs to DataCon names */
static HashTable *dchash;
#endif
if (lookupHashTable(table, (StgWord)key) == NULL)
{
insertStrHashTable(table, (StgWord)key, data);
-#if defined(GHCI) && defined(BREAKPOINT)
+#if defined(DEBUGGER)
// Insert the reverse pair in the datacon hash if it is a closure
{
if(isSuffixOf(key, "static_info") || isSuffixOf(key, "con_info")) {
stablehash = allocStrHashTable();
symhash = allocStrHashTable();
-#if defined(GHCI) && defined(BREAKPOINT)
+#if defined(DEBUGGER)
dchash = allocHashTable();
#endif
}
}
-#if defined(GHCI) && defined(BREAKPOINT)
+#if defined(DEBUGGER)
char *
lookupDataCon( StgWord addr )
{
#endif
-#if defined(GHCI) && defined(BREAKPOINT)
int isSuffixOf(char* x, char* suffix) {
int suffix_len = strlen (suffix);
int x_len = strlen (x);
char* x_suffix = &x[strlen(x)-strlen(suffix)];
return strcmp(x_suffix, suffix) == 0;
}
-#endif
PACKAGE_CPP_OPTS += -DHAVE_LIBMINGWEX
endif
+ifeq "$(GhciWithDebugger)" "YES"
+STANDARD_OPTS += -DDEBUGGER
+endif
+
ifeq "$(DotnetSupport)" "YES"
#