-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debug improvements #2602
Debug improvements #2602
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2602 +/- ##
==========================================
+ Coverage 74.8% 74.8% +<.01%
==========================================
Files 479 479
Lines 242243 242243
==========================================
+ Hits 181198 181200 +2
+ Misses 61045 61043 -2
|
doc/dev/lib.xml
Outdated
<Section Label="Sect-debugging"> | ||
<Heading>Debugging the GAP Kernel</Heading> | ||
|
||
The GAP kernel supports a variety of options which enabled when running <C>configure</C>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GAP
should be &GAP;
throughout because as an entity it is displayed in a different font (as a <Package
element).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Required: This sentence seems to be missing a word, like "which can be enabled by running" ? Or maybe reorder the sentence for readability (and use the appropriate XML for filenames):
The GAP kernel supports a variety of compile-time options to help writing and debugging GAP kernel code.
They can be enabled by passing one or more of the following options to the configure script.
doc/dev/lib.xml
Outdated
the Configuration line when GAP is started. | ||
<P/> | ||
|
||
Known bugs: GAP will crash if IO_fork is called while memory checking is enabled. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IO_fork
should be a cross-reference to the IO package manual.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two changes in the last commit really should be made, the rest is optional.
src/gasman.c
Outdated
#define CANARY_ENABLE_VALGRIND() VALGRIND_ENABLE_ERROR_REPORTING | ||
|
||
void CHANGED_BAG(Bag bag) { | ||
CANARY_DISABLE_VALGRIND(); |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
configure.ac
Outdated
[AC_DEFINE([MEMORY_CANARY], [1], [define if build with valgrind extensions])], | ||
[enable_valgrind=no] | ||
) | ||
AC_MSG_CHECKING([whether to add valgrind extensions to GASMAN]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional: Instead of "add" here and above, I'd use "enable", to match the name of the option. Also, to me "add" has the wrong meaning here, but that's probably just me being a non-native speaker.
configure.ac
Outdated
@@ -246,6 +246,18 @@ AC_ARG_ENABLE([memory-checking], | |||
AC_MSG_CHECKING([whether to enable memory checking]) | |||
AC_MSG_RESULT([$enable_memory_checking]) | |||
|
|||
AC_ARG_ENABLE([valgrind], | |||
[AS_HELP_STRING([--enable-valgrind], [add valgrind extensions to GASMAN])], | |||
[AC_DEFINE([MEMORY_CANARY], [1], [define if build with valgrind extensions])], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
optional: build -> built? Though everywhere else, we actually use "building"
configure.ac
Outdated
AS_IF([test "x$enable_valgrind" != "xno" -a "x$enable_memory_checking" != "xno"], | ||
AC_MSG_ERROR([--enable-valgrind and --enable-memory-checking cannot be used at the same time]) | ||
) | ||
|
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
doc/dev/lib.xml
Outdated
<Section Label="Sect-debugging"> | ||
<Heading>Debugging the GAP Kernel</Heading> | ||
|
||
The GAP kernel supports a variety of options which enabled when running <C>configure</C>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Required: This sentence seems to be missing a word, like "which can be enabled by running" ? Or maybe reorder the sentence for readability (and use the appropriate XML for filenames):
The GAP kernel supports a variety of compile-time options to help writing and debugging GAP kernel code.
They can be enabled by passing one or more of the following options to the configure script.
doc/dev/lib.xml
Outdated
<P/> | ||
|
||
After configuring, the memory checking must still be turned on. This can be done | ||
either by passing <C>--</C> to GAP's command line, or calling <C>GASMAN_MEM_CHECK(1)</C>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Required: Shouldn't that --
be --enableMemCheck
?
doc/dev/lib.xml
Outdated
assertions are implemented using the <C>GAP_ASSERT</C> macro. These | ||
assertions are disabled when GAP is compiled without <C>--enable-debug</C>. | ||
When <C>--enable-debug</C> is enabled, <C>KernelDebug</C> will be shown in | ||
the Configuration line when GAP is started. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional: Why is Configuration
in upper case? If it is meant to "quote" the output of GAP, I'd mark it as such, e.g.
the line starting with Configuration: when &GAP; is started.
Else, I'd use lower case. Same below.
doc/dev/lib.xml
Outdated
corruption relating to GASMAN (GAP's memory manager). They cannot both be enabled | ||
at the same time. | ||
<P/> | ||
<C>--enable-memory-checking</C> makes GAP check for C pointers to the content of Bags |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd not capitalize "Bag" here, though one might want to insert an explanation of what a bag is. Then again, it makes little sense to use this option if one does not know what a GAP "bag" is. Perhaps Insert in the previous line something like this:
The following explanations assume you are somewhat familiar with the internals of GASMAN (see e.g. src/gasman.c for more information).
doc/dev/lib.xml
Outdated
|
||
At present, this <C>--enable-valgrind</C> only checks for invalid writes to the | ||
last bag which was created. Also, this option does not do anything unless GAP | ||
is run through Valgrind (for example by running <C>valgrind ./gap</C>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is Valgrind capitalized here but not above?
doc/dev/lib.xml
Outdated
<P/> | ||
|
||
<C>--enable-valgrind</C> makes changes to GASMAN so it is compatible with the | ||
valgrind memory checking program. Without this, valgrind will report many |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional: How about adding a URL here?
<URL Text="valgrind">http://valgrind.org</URL> memory checking program. Without this [...]
284b4d4
to
5062251
Compare
All improvements seem good, so I have made all of them. The documentation should still be significantly improved, but at least something exists now. The only change I didn't make was cross-linking to IO_fork because for some reason I was getting errors I didn't understand, and making to the dev manual is quite annoying as it takes so long to run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be merged now, though I still left two optional suggestions
at the same time. | ||
|
||
These options assume you are familiar somewhat familiar with the internals of GASMAN | ||
(see gasman.c for more information). In particular, GASMAN represents memory using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strictly speaking, this should be <F>gasman.c</F>
. But can also be changed later.
doc/dev/lib.xml
Outdated
the line starting <C>Configuration:</C> when &GAP; is started. | ||
<P/> | ||
|
||
Known bugs: &GAP; will crash if IO_fork is called while memory checking is enabled. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is not a ref for technical reasons, then shouldn't it at least be <C>IO_fork</C>
? And perhaps add "from the IO package"?
As these are low-level kernel changes, I don't think this needs to be documented in the release notes... But I am not 100% certain (it depends on how exactly we define what should and what shouldn't go into release notes.... and at whom we target them: end-users only? Or also kernel devs? Thoughts? |
Since this adds a new section "Debugging the GAP Kernel" to the manual, I would add to release notes some text conveniently linking it to that section. |
This PR:
a) Fixes MEMORY_CANARY and adds a configure option for it.
b) Adds some awful, but at least existing, documentation for kernel debugging (further improvements / extensions welcome).