Commit 8b08c15b authored by mnislaih's avatar mnislaih

Toggle whether the RTS gets build with debugger support for ghci

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
parent 989cfb23
......@@ -413,10 +413,12 @@ ifeq "$(GhcWithInterpreter) $(bootstrapped)" "YES YES"
# 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"
......
......@@ -45,7 +45,7 @@ import CoreUtils ( exprType )
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 )
......@@ -104,10 +104,14 @@ mkBreakpointExpr loc bkptFuncId = do
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
......
......@@ -534,7 +534,7 @@ refreshBkptTable :: [ModSummary] -> GHCi ()
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
......@@ -547,3 +547,8 @@ refreshBkptTable (ms:mod_sums) = do
(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
......@@ -131,7 +131,7 @@ builtin_commands = [
("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),
......
......@@ -201,7 +201,9 @@ data DynFlag
| Opt_SplitObjs
| Opt_StgStats
| Opt_HideAllPackages
#if defined(GHCI) && defined(DEBUGGER)
| Opt_Debugging
#endif
| Opt_PrintBindResult
| Opt_Haddock
......
......@@ -364,8 +364,11 @@ runMeta :: (SrcSpan -> th_syn -> Either Message hs_syn)
-> 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
......
......@@ -315,6 +315,9 @@ BuildingGranSim=$(subst mg,YES,$(filter mg,$(WAYS)))
HscIfaceFileVersion=6
# Building with debugger?
GhciWithDebugger=YES
#------------------------------------------------------------------------------
# Options for Libraries
......
......@@ -95,7 +95,7 @@ static /*Str*/HashTable *symhash;
/* 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
......@@ -828,7 +828,7 @@ static void ghciInsertStrHashTable ( char* obj_name,
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")) {
......@@ -882,7 +882,7 @@ initLinker( void )
stablehash = allocStrHashTable();
symhash = allocStrHashTable();
#if defined(GHCI) && defined(BREAKPOINT)
#if defined(DEBUGGER)
dchash = allocHashTable();
#endif
......@@ -1103,7 +1103,7 @@ lookupSymbol( char *lbl )
}
}
#if defined(GHCI) && defined(BREAKPOINT)
#if defined(DEBUGGER)
char *
lookupDataCon( StgWord addr )
{
......@@ -4397,7 +4397,6 @@ static int machoGetMisalignment( FILE * f )
#endif
#if defined(GHCI) && defined(BREAKPOINT)
int isSuffixOf(char* x, char* suffix) {
int suffix_len = strlen (suffix);
int x_len = strlen (x);
......@@ -4412,4 +4411,3 @@ int isSuffixOf(char* x, char* suffix) {
char* x_suffix = &x[strlen(x)-strlen(suffix)];
return strcmp(x_suffix, suffix) == 0;
}
#endif
......@@ -144,6 +144,10 @@ ifeq "$(HaveLibMingwEx)" "YES"
PACKAGE_CPP_OPTS += -DHAVE_LIBMINGWEX
endif
ifeq "$(GhciWithDebugger)" "YES"
STANDARD_OPTS += -DDEBUGGER
endif
ifeq "$(DotnetSupport)" "YES"
#
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment