Re: more on MT debugging
Pascal Bourguignon <[email protected]> Fri, 15 Feb 2019 00:53:59 +0100
| Newsgroups | gmane.lisp.clisp.devel |
|---|---|
| Message-ID | <[email protected]> |
--===============4599061454387583532== Content-Type: multipart/alternative; boundary="Apple-Mail=_D38BE12D-61D7-4176-B894-1D1E5A59DEC3" --Apple-Mail=_D38BE12D-61D7-4176-B894-1D1E5A59DEC3 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On 14 Feb 2019, at 21:20, Don Cohen = <[email protected]> wrote: >=20 > Pascal Bourguignon writes: >=20 >> Specifically, any function in the CL package can be called >> internally thru other mechanisms than provided to the user code: >> the C code can call directly the C implementation of the CL >> functions, without passing thru the CL API. Hence TRACE is allowed >> NOT to work in those cases! > ... >=20 >> Instead, you can use gdb to break on those C functions. >=20 > I suppose that further, internal functions could be called from other=20= > functions, e.g., intern might call internal functions in hashtabl.d, > so it wouldn't be good enough to break only the external functions. >=20 > Is the current theory that only the file hashtabl.d has to be fixed=20 > for MT ? Would it be worth while to try my test with a gdb break on=20= > every function in that file? >=20 > Does anyone have any other suggestions for trying to track down the > cause of a segfault once I can reproduce it? =20 Now, perhaps it would be a little difficult to apply to the sources of = clisp, (would valgrind be appliable?), but I would start by compiling = with a recent gcc (eg. gcc-8.2) using a whole complement of -fsanitize = options, and correct all the problems found there first. I=E2=80=99d = suggest the following as a basis. sanitize_ld=3D( -fsanitize=3Dleak ) sanitize_cc=3D( -fsanitize=3Daddress -fsanitize=3Dnull -fsanitize=3Dbounds -fsanitize=3Dvla-bound -fsanitize=3Dobject-size -fsanitize=3Dunreachable -fsanitize=3Dreturn # C++ only -fsanitize=3Dshift -fsanitize=3Dshift-exponent -fsanitize=3Dshift-base -fsanitize=3Dinteger-divide-by-zero -fsanitize=3Dsigned-integer-overflow -fsanitize=3Dfloat-divide-by-zero -fsanitize=3Dfloat-cast-overflow -fsanitize=3Dnonnull-attribute -fsanitize=3Dreturns-nonnull-attribute -fsanitize=3Dbool -fsanitize=3Denum -fsanitize=3Dvptr # C++ only -fsanitize-address-use-after-scope -fsanitize-undefined-trap-on-error -fstack-protector-all -fstack-check ) Once the program can be compiled and run successfully with those = correction, to debug the remaining segfault, you would run it under gdb = to be able to inspect the stack when the segfault occur, and try to = locate the place in the source where it occured. This may also be done = on the core file, but it is easier to debug in a live process. --=20 __Pascal J. Bourguignon__ --Apple-Mail=_D38BE12D-61D7-4176-B894-1D1E5A59DEC3 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 <html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; = charset=3Dutf-8"></head><body style=3D"word-wrap: break-word; = -webkit-nbsp-mode: space; line-break: after-white-space;" class=3D""><br = class=3D""><div><br class=3D""><blockquote type=3D"cite" class=3D""><div = class=3D"">On 14 Feb 2019, at 21:20, Don Cohen <<a = href=3D"mailto:[email protected]" = class=3D"">[email protected]</a>> = wrote:</div><br class=3D"Apple-interchange-newline"><div class=3D""><div = class=3D"">Pascal Bourguignon writes:<br class=3D""><br = class=3D""><blockquote type=3D"cite" class=3D"">Specifically, any = function in the CL package can be called<br class=3D"">internally thru = other mechanisms than provided to the user code:<br class=3D"">the C = code can call directly the C implementation of the CL<br = class=3D"">functions, without passing thru the CL API. Hence TRACE is = allowed<br class=3D"">NOT to work in those cases!<br = class=3D""></blockquote>...<br class=3D""><br class=3D""><blockquote = type=3D"cite" class=3D"">Instead, you can use gdb to break on those C = functions.<br class=3D""></blockquote><br class=3D"">I suppose that = further, internal functions could be called from other <br = class=3D"">functions, e.g., intern might call internal functions in = hashtabl.d,<br class=3D"">so it wouldn't be good enough to break only = the external functions.<br class=3D""><br class=3D"">Is the current = theory that only the file hashtabl.d has to be fixed <br class=3D"">for = MT ? Would it be worth while to try my test with a gdb break on = <br class=3D"">every function in that file?<br class=3D""><br = class=3D"">Does anyone have any other suggestions for trying to track = down the<br class=3D"">cause of a segfault once I can reproduce it? = <br class=3D""></div></div></blockquote></div><div class=3D""><br = class=3D""></div><div class=3D""><br class=3D""></div><div class=3D"">Now,= perhaps it would be a little difficult to apply to the sources of = clisp, (would valgrind be appliable?), but I would start by compiling = with a recent gcc (eg. gcc-8.2) using a whole complement of -fsanitize = options, and correct all the problems found there first. I=E2=80=99d = suggest the following as a basis.</div><div class=3D""><br = class=3D""></div><div class=3D""><div class=3D""><font face=3D"Menlo" = class=3D"">sanitize_ld=3D(</font></div><div class=3D""><font = face=3D"Menlo" class=3D""> = -fsanitize=3Dleak</font></div><div class=3D""><font face=3D"Menlo" = class=3D"">)</font></div><div class=3D""><font face=3D"Menlo" = class=3D""><br class=3D""></font></div><div class=3D""><font = face=3D"Menlo" class=3D"">sanitize_cc=3D(</font></div><div = class=3D""><font face=3D"Menlo" class=3D""> = -fsanitize=3Daddress</font></div><div class=3D""><font face=3D"Menlo" = class=3D""> -fsanitize=3Dnull</font></div><div = class=3D""><font face=3D"Menlo" class=3D""> = -fsanitize=3Dbounds</font></div><div class=3D""><font face=3D"Menlo" = class=3D""> -fsanitize=3Dvla-bound</font></div><div = class=3D""><font face=3D"Menlo" class=3D""> = -fsanitize=3Dobject-size</font></div><div class=3D""><font face=3D"Menlo" = class=3D""><br class=3D""></font></div><div class=3D""><font = face=3D"Menlo" class=3D""> = -fsanitize=3Dunreachable</font></div><div class=3D""><font face=3D"Menlo" = class=3D""> -fsanitize=3Dreturn # C++ only</font></div><div = class=3D""><font face=3D"Menlo" class=3D""><br = class=3D""></font></div><div class=3D""><font face=3D"Menlo" = class=3D""> -fsanitize=3Dshift</font></div><div = class=3D""><font face=3D"Menlo" class=3D""> = -fsanitize=3Dshift-exponent</font></div><div class=3D""><font = face=3D"Menlo" class=3D""> = -fsanitize=3Dshift-base</font></div><div class=3D""><font face=3D"Menlo" = class=3D""> = -fsanitize=3Dinteger-divide-by-zero</font></div><div class=3D""><font = face=3D"Menlo" class=3D""> = -fsanitize=3Dsigned-integer-overflow</font></div><div class=3D""><font = face=3D"Menlo" class=3D""><br class=3D""></font></div><div = class=3D""><font face=3D"Menlo" class=3D""> = -fsanitize=3Dfloat-divide-by-zero</font></div><div class=3D""><font = face=3D"Menlo" class=3D""> = -fsanitize=3Dfloat-cast-overflow</font></div><div class=3D""><font = face=3D"Menlo" class=3D""> = -fsanitize=3Dnonnull-attribute</font></div><div class=3D""><font = face=3D"Menlo" class=3D""> = -fsanitize=3Dreturns-nonnull-attribute</font></div><div class=3D""><font = face=3D"Menlo" class=3D""> -fsanitize=3Dbool</font></div><div= class=3D""><font face=3D"Menlo" class=3D""> = -fsanitize=3Denum</font></div><div class=3D""><font face=3D"Menlo" = class=3D""> -fsanitize=3Dvptr # C++ only</font></div><div = class=3D""><font face=3D"Menlo" class=3D""><br = class=3D""></font></div><div class=3D""><font face=3D"Menlo" = class=3D""><br class=3D""></font></div><div class=3D""><font = face=3D"Menlo" class=3D""> = -fsanitize-address-use-after-scope</font></div><div class=3D""><font = face=3D"Menlo" class=3D""> = -fsanitize-undefined-trap-on-error</font></div><div class=3D""><font = face=3D"Menlo" class=3D""> = -fstack-protector-all</font></div><div class=3D""><font face=3D"Menlo" = class=3D""> -fstack-check</font></div><div class=3D""><font = face=3D"Menlo" class=3D"">)</font></div><div class=3D""><br = class=3D""></div></div><div class=3D""><br class=3D""></div><div = class=3D"">Once the program can be compiled and run successfully with = those correction, to debug the remaining segfault, you would run it = under gdb to be able to inspect the stack when the segfault occur, and = try to locate the place in the source where it occured. This may = also be done on the core file, but it is easier to debug in a live = process.</div><br class=3D""><div class=3D""> <div style=3D"color: rgb(0, 0, 0); letter-spacing: normal; text-align: = start; text-indent: 0px; text-transform: none; white-space: normal; = word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: = break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" = class=3D""><div style=3D"color: rgb(0, 0, 0); letter-spacing: normal; = text-align: start; text-indent: 0px; text-transform: none; white-space: = normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: = break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" = class=3D""><div style=3D"color: rgb(0, 0, 0); letter-spacing: normal; = text-align: start; text-indent: 0px; text-transform: none; white-space: = normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: = break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" = class=3D"">-- <br class=3D"">__Pascal J. Bourguignon__</div><div = style=3D"color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; = text-indent: 0px; text-transform: none; white-space: normal; = word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: = break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" = class=3D""><br class=3D""><br class=3D""><br class=3D""></div></div></div>= </div> <br class=3D""></body></html>= --Apple-Mail=_D38BE12D-61D7-4176-B894-1D1E5A59DEC3-- --===============4599061454387583532== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --===============4599061454387583532== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ clisp-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/clisp-devel --===============4599061454387583532==--