diff options
author | roland <rsx@bluewin.ch> | 2018-08-21 16:05:45 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-08-21 18:56:12 -0400 |
commit | dcf27e6f78529e7e471a4be64ca47398eb1b6b52 (patch) | |
tree | 227bd782b285325d034e7eb28239bc28e368a43d | |
parent | ddffa0cd8da568c97011007fc6470c61cd4447e5 (diff) | |
download | haskell-dcf27e6f78529e7e471a4be64ca47398eb1b6b52.tar.gz |
Show -with-rtsopts options in runtime's --info (#15261)
Add an additional line to the output of +RTS --info. It shows the value
of the flag -with-rtsopts provided at compile/link time.
Test Plan: make test TESTS="T15261a T15261b"
Reviewers: hvr, erikd, dfeuer, thomie, austin, bgamari, simonmar, osa1,
monoidal
Reviewed By: osa1, monoidal
Subscribers: osa1, rwbarton, carter
GHC Trac Issues: #15261
Differential Revision: https://phabricator.haskell.org/D5053
-rw-r--r-- | docs/users_guide/phases.rst | 3 | ||||
-rw-r--r-- | docs/users_guide/runtime_control.rst | 4 | ||||
-rw-r--r-- | rts/RtsFlags.c | 2 | ||||
-rw-r--r-- | rts/RtsUtils.c | 6 | ||||
-rw-r--r-- | rts/RtsUtils.h | 2 | ||||
-rw-r--r-- | testsuite/tests/rts/T15261/Makefile | 11 | ||||
-rw-r--r-- | testsuite/tests/rts/T15261/T15261a.hs | 2 | ||||
-rw-r--r-- | testsuite/tests/rts/T15261/T15261a.stdout | 1 | ||||
-rw-r--r-- | testsuite/tests/rts/T15261/T15261b.hs | 2 | ||||
-rw-r--r-- | testsuite/tests/rts/T15261/T15261b.stdout | 1 | ||||
-rw-r--r-- | testsuite/tests/rts/T15261/all.T | 2 |
11 files changed, 32 insertions, 4 deletions
diff --git a/docs/users_guide/phases.rst b/docs/users_guide/phases.rst index f8fe8d1857..531f8c0bf6 100644 --- a/docs/users_guide/phases.rst +++ b/docs/users_guide/phases.rst @@ -1004,6 +1004,9 @@ for example). change RTS options at run-time, in which case ``-with-rtsopts`` would be the *only* way to set them.) + Use the runtime flag :rts-flag:`--info` on the executable program + to see the options set with ``-with-rtsopts``. + Note that ``-with-rtsopts`` has no effect when used with ``-no-hs-main``; see :ref:`using-own-main` for details. diff --git a/docs/users_guide/runtime_control.rst b/docs/users_guide/runtime_control.rst index 797c7e26e4..0c38ac5919 100644 --- a/docs/users_guide/runtime_control.rst +++ b/docs/users_guide/runtime_control.rst @@ -1219,6 +1219,7 @@ Getting information about the RTS ,("Word size", "64") ,("Compiler unregisterised", "NO") ,("Tables next to code", "YES") + ,("Flag -with-rtsopts", "") ] The information is formatted such that it can be read as a of type @@ -1269,3 +1270,6 @@ Getting information about the RTS performance optimisation that is not available on all platforms. This field tells you whether the program has been compiled with this optimisation. (Usually yes, except on unusual platforms.) + + ``Flag -with-rtsopts`` + The value of the GHC flag :ghc-flag:`-with-rtsopts=⟨opts⟩` at compile/link time. diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c index 7c292d2044..6a72e67859 100644 --- a/rts/RtsFlags.c +++ b/rts/RtsFlags.c @@ -901,7 +901,7 @@ error = true; else if (strequal("info", &rts_argv[arg][2])) { OPTION_SAFE; - printRtsInfo(); + printRtsInfo(rtsConfig); stg_exit(0); } #if defined(THREADED_RTS) diff --git a/rts/RtsUtils.c b/rts/RtsUtils.c index 5357dc635e..618815de76 100644 --- a/rts/RtsUtils.c +++ b/rts/RtsUtils.c @@ -275,7 +275,7 @@ int genericRaise(int sig) { #endif } -static void mkRtsInfoPair(char *key, char *val) { +static void mkRtsInfoPair(const char *key, const char *val) { /* XXX should check for "s, \s etc in key and val */ printf(" ,(\"%s\", \"%s\")\n", key, val); } @@ -285,7 +285,7 @@ static void mkRtsInfoPair(char *key, char *val) { #define TOSTRING2(x) #x #define TOSTRING(x) TOSTRING2(x) -void printRtsInfo(void) { +void printRtsInfo(const RtsConfig rts_config) { /* The first entry is just a hack to make it easy to get the * commas right */ printf(" [(\"GHC RTS\", \"YES\")\n"); @@ -306,6 +306,8 @@ void printRtsInfo(void) { mkRtsInfoPair("Word size", TOSTRING(WORD_SIZE_IN_BITS)); mkRtsInfoPair("Compiler unregisterised", GhcUnregisterised); mkRtsInfoPair("Tables next to code", GhcEnableTablesNextToCode); + mkRtsInfoPair("Flag -with-rtsopts", /* See Trac #15261 */ + rts_config.rts_opts != NULL ? rts_config.rts_opts : ""); printf(" ]\n"); } diff --git a/rts/RtsUtils.h b/rts/RtsUtils.h index 16596c1716..49712c0d47 100644 --- a/rts/RtsUtils.h +++ b/rts/RtsUtils.h @@ -40,7 +40,7 @@ char *showStgWord64(StgWord64, char *, bool); void heapCheckFail( void ); #endif -void printRtsInfo(void); +void printRtsInfo(const RtsConfig); void checkFPUStack(void); diff --git a/testsuite/tests/rts/T15261/Makefile b/testsuite/tests/rts/T15261/Makefile new file mode 100644 index 0000000000..f50b22c282 --- /dev/null +++ b/testsuite/tests/rts/T15261/Makefile @@ -0,0 +1,11 @@ +TOP=../../.. +include $(TOP)/mk/boilerplate.mk +include $(TOP)/mk/test.mk + +T15261a: + '$(TEST_HC)' $(TEST_HC_OPTS) -v0 -with-rtsopts="-t -s" --make T15261a.hs + ./T15261a +RTS --info | grep "rtsopts" + +T15261b: + '$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make T15261b.hs + ./T15261b +RTS --info | grep "rtsopts" diff --git a/testsuite/tests/rts/T15261/T15261a.hs b/testsuite/tests/rts/T15261/T15261a.hs new file mode 100644 index 0000000000..4c512dc9c1 --- /dev/null +++ b/testsuite/tests/rts/T15261/T15261a.hs @@ -0,0 +1,2 @@ +main :: IO () +main = putStrLn "T15261a" diff --git a/testsuite/tests/rts/T15261/T15261a.stdout b/testsuite/tests/rts/T15261/T15261a.stdout new file mode 100644 index 0000000000..5919bb4bdd --- /dev/null +++ b/testsuite/tests/rts/T15261/T15261a.stdout @@ -0,0 +1 @@ + ,("Flag -with-rtsopts", "-t -s") diff --git a/testsuite/tests/rts/T15261/T15261b.hs b/testsuite/tests/rts/T15261/T15261b.hs new file mode 100644 index 0000000000..1304a85c6d --- /dev/null +++ b/testsuite/tests/rts/T15261/T15261b.hs @@ -0,0 +1,2 @@ +main :: IO () +main = putStrLn "T15261b" diff --git a/testsuite/tests/rts/T15261/T15261b.stdout b/testsuite/tests/rts/T15261/T15261b.stdout new file mode 100644 index 0000000000..80184e82ab --- /dev/null +++ b/testsuite/tests/rts/T15261/T15261b.stdout @@ -0,0 +1 @@ + ,("Flag -with-rtsopts", "") diff --git a/testsuite/tests/rts/T15261/all.T b/testsuite/tests/rts/T15261/all.T new file mode 100644 index 0000000000..5bc6977c26 --- /dev/null +++ b/testsuite/tests/rts/T15261/all.T @@ -0,0 +1,2 @@ +test('T15261a', normal, run_command, ['$MAKE -s --no-print-directory T15261a']) +test('T15261b', normal, run_command, ['$MAKE -s --no-print-directory T15261b']) |