diff options
Diffstat (limited to 'gcc/ada/s-taprop-linux.adb')
-rw-r--r-- | gcc/ada/s-taprop-linux.adb | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/gcc/ada/s-taprop-linux.adb b/gcc/ada/s-taprop-linux.adb index 4e69ea4b321..6047d312567 100644 --- a/gcc/ada/s-taprop-linux.adb +++ b/gcc/ada/s-taprop-linux.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2011, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -767,6 +767,23 @@ package body System.Task_Primitives.Operations is Self_ID.Common.LL.Thread := pthread_self; Self_ID.Common.LL.LWP := lwp_self; + if Self_ID.Common.Task_Image_Len > 0 then + declare + Task_Name : String (1 .. Parameters.Max_Task_Image_Length + 1); + Result : int; + + begin + -- Set thread name to ease debugging + + Task_Name (1 .. Self_ID.Common.Task_Image_Len) := + Self_ID.Common.Task_Image (1 .. Self_ID.Common.Task_Image_Len); + Task_Name (Self_ID.Common.Task_Image_Len + 1) := ASCII.NUL; + + Result := prctl (PR_SET_NAME, unsigned_long (Task_Name'Address)); + pragma Assert (Result = 0); + end; + end if; + Specific.Set (Self_ID); if Use_Alternate_Stack |