De­bug­ging lang/​mono – 2nd round

Today I had again some en­ergy to look at why mono fails to build on FreeBSD-cur­rent.

I de­cided to do a debug-​build of mono. This did not work ini­tially, I had to pro­duce some patches. 🙁

Does this mean nobody is do­ing de­bug builds of mono on FreeBSD?

I have to say, this ex­per­i­ence with lang/​mono is com­pletely un­sat­is­fy­ing.

Ok, bot­tom line, either the de­bug build seems to pre­vent a race con­di­tion in most cases (I had a lot less lockups for each of the two builds I did).

Whatever it is, I do not care ATM (if the con­fig­ure stuff is look­ing at the ar­chi­tec­ture of the sys­tem, it may be the case that the i386-​portbld-​freebsdX does not en­able some im­port­ant stuff which would be en­abled when run with i486-​portbld-​freebsdX or bet­ter). Here are the patches I used in case someone is in­ter­ested (warn­ing, copy&paste con­ver­ted tabs to spaces, you also have to ap­ply the map.c (a gen­er­ated file… maybe a touch of the right file would al­low to ap­ply this patch in the nor­mal patch stage) re­lated stuff when the build fails, else there is some parser er­ror in mono):

— mcs/​class/​Mono.Posix/Mono.Unix/UnixProcess.cs.orig       2010-​01-​29 11:34:00.592323482 +0100
+++ mcs/class/Mono.Posix/Mono.Unix/UnixProcess.cs    2010-​01-​29 11:34:18.540607357 +0100
@@ –57,7 +57,7 @@ namespace Mono.Unix {
 int r = Nat­ive.Sy­scall.wait­pid (pid, out status,
 Native.WaitOptions.WNOHANG | Native.WaitOptions.WUNTRACED);
 UnixMarshal.ThrowExceptionForLastErrorIf ®; –                       re­turn r;
+                       re­turn status; } 

pub­lic int Ex­it­Code {

 — mono/io-layer/processes.c.orig    2010-​01-​29 11:36:08.904331535 +0100 +++ mono/io-layer/processes.c 2010-​01-​29 11:42:21.819159544 +0100 @@ –160,7 +160,7 @@ static gboolean waitfor_​pid (gpointer te ret = wait­pid (process->id, &status, WNOHANG); } while (er­rno == EINTR); 

–       if (ret <= 0) { +       if (ret == 0 || (ret < 0 && er­rno != ECHILD)) { /​* Pro­cess not ready for wait */​ #if­def DEBUG g_​message (“%s: Pro­cess %d not ready for wait­ing for: %s”, @@ –169,6 +169,17 @@ static gboolean waitfor_​pid (gpointer te 

re­turn (FALSE); } + +       if (ret < 0 && er­rno == ECHILD) { +#if­def DEBUG +               g_​message (“%s: Pro­cess %d does not ex­ist (any­more)”, _​_​func_​_​, +                          process->id); +#en­dif +               /​* Fak­ing the re­turn status. I do not know if it is cor­rect +                * to as­sume a suc­cess­ful exit. +                */​ +               status = 0; + } 

#if­def DEBUG g_​message (“%s: Pro­cess %d fin­ished”, _​_​func_​_​, ret); 

 — mono/metadata/mempool.c.orig      2010-​01-​29 11:58:16.871052861 +0100 +++ mono/metadata/mempool.c   2010-​01-​29 12:30:45.143367454 +0100 @@ –212,12 +212,14 @@ mono_​backtrace (int size) 

En­ter­Crit­ic­alSec­tion (&mempool_​tracing_​lock); g_​print (“Al­loc­at­ing %d bytes\n”, size); +#if defined(HAVE_BACKTRACE_SYMBOLS) sym­bols = back­trace (ar­ray, BACKTRACE_​DEPTH); names = backtrace_​symbols (ar­ray, sym­bols); for (i = 1; i < sym­bols; ++i) { g_​print (“\t%s\n”, names [i]); } free (names); +#en­dif LeaveCrit­ic­alSec­tion (&mempool_​tracing_​lock); }

 — mono/metadata/metadata.c.orig     2010-​01-​29 11:59:38.552316989 +0100 +++ mono/metadata/metadata.c  2010-​01-​29 12:00:43.957337476 +0100 @@ –3673,12 +3673,16 @@ mono_​backtrace (int limit) void *array[limit]; char **names; int i; +#if defined(HAVE_BACKTRACE_SYMBOLS) back­trace (ar­ray, limit); names = backtrace_​symbols (ar­ray, limit); for (i =0; i < limit; ++i) { g_​print (“\t%s\n”, names [i]); } g_​free (names); +#else +       g_​print (“No back­trace available.\n”); +#en­dif } #en­dif

 — support/map.c.orig        2010-​01-​29 12:05:22.374653708 +0100 +++ support/map.c 2010-​01-​29 12:10:29.024412452 +0100 @@ –216,7 +216,7 @@ #define _cnm_dump(to_t, from) do {} while (0) #en­dif /​* def _​CNM_​DUMP */​

-#if­def DEBUG +#if defined(DEBUG) && !defined(__FreeBSD__) #define _cnm_return_val_if_overflow(to_t,from,val)  G_​STMT_​START {   \ int     uns = _​cnm_​integral_​type_​is_​unsigned (to_​t);             \ gint64  min = (gint64)  _​cnm_​integral_​type_​min (to_​t);           \

StumbleUponXINGBalatarinBox.netDiggGoogle GmailNetvouzPlurkSiteJotTypePad PostYahoo BookmarksVKSlashdotPocketHacker NewsDiigoBuddyMarksRedditLinkedInBibSonomyBufferEmailHatenaLiveJournalNewsVinePrintViadeoYahoo MailAIMBitty BrowserCare2 NewsEvernoteMail.RuPrintFriendlyWaneloYahoo MessengerYoolinkWebnewsStumpediaProtopage BookmarksOdnoklassnikiMendeleyInstapaperFarkCiteULikeBlinklistAOL MailTwitterGoogle+PinterestTumblrAmazon Wish ListBlogMarksDZoneDeliciousFlipboardFolkdJamespotMeneameMixiOknotiziePushaSvejoSymbaloo FeedsWhatsAppYouMobdiHITTWordPressRediff MyPageOutlook.comMySpaceDesign FloatBlogger PostApp.netDiary.RuKindle ItNUjijSegnaloTuentiWykopTwiddlaSina WeiboPinboardNetlogLineGoogle BookmarksDiasporaBookmarks.frBaiduFacebookGoogle ClassroomKakaoQzoneSMSTelegramRenrenKnownYummlyShare/​Save

1 thought on “De­bug­ging lang/​mono – 2nd round”

  1. Pingback: Mono build problems on FreeBSD-current « The Daily BSD

Leave a Reply

Your email address will not be published. Required fields are marked *