Commit dcf27e6f authored by Roland Senn's avatar Roland Senn Committed by Ben Gamari

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
parent ddffa0cd
......@@ -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.
......
......@@ -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.
......@@ -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)
......
......@@ -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");
}
......
......@@ -40,7 +40,7 @@ char *showStgWord64(StgWord64, char *, bool);
void heapCheckFail( void );
#endif
void printRtsInfo(void);
void printRtsInfo(const RtsConfig);
void checkFPUStack(void);
......
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"
main :: IO ()
main = putStrLn "T15261a"
,("Flag -with-rtsopts", "-t -s")
main :: IO ()
main = putStrLn "T15261b"
test('T15261a', normal, run_command, ['$MAKE -s --no-print-directory T15261a'])
test('T15261b', normal, run_command, ['$MAKE -s --no-print-directory T15261b'])
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