Explorar o código

Added -gprof option for gprof profiling support.

woollybah %!s(int64=6) %!d(string=hai) anos
pai
achega
7c7680568f
Modificáronse 4 ficheiros con 40 adicións e 2 borrados
  1. 9 0
      CHANGELOG
  2. 7 1
      bmk_config.bmx
  3. 17 1
      bmk_make.bmx
  4. 7 0
      bmk_util.bmx

+ 9 - 0
CHANGELOG

@@ -1,3 +1,12 @@
+## [3.40] - 2019-09-02
+### Added
+ - New '-gprof' option for gprof profiling support.
+ - Basic conditional comparisons. (bcc 0.111+)
+ - User defined compiler options may now contain specific integer values. (bcc 0.111+)
+### Fixed
+ - Icon and buildpath usage improvements.
+ - Suppress creation of nested .bmx folders.
+
 ## [3.39] - 2019-06-20
 ### Fixed
  - Correctly set file version on Win32.

+ 7 - 1
bmk_config.bmx

@@ -10,7 +10,7 @@ Import brl.map
 
 Import "stringbuffer_core.bmx"
 
-Const BMK_VERSION:String = "3.39"
+Const BMK_VERSION:String = "3.40"
 
 Const ALL_SRC_EXTS$="bmx;i;c;m;h;cpp;cxx;mm;hpp;hxx;s;cc;asm;S"
 
@@ -60,6 +60,7 @@ Global opt_nopie:Int
 Global opt_nopie_set:Int
 Global opt_upx:Int
 Global opt_userdefs:String
+Global opt_gprof:Int
 
 Global opt_dumpbuild
 
@@ -245,6 +246,8 @@ Function ParseConfigArgs$[]( args$[], legacyMax:Int = False )
 			n:+1
 			If n=args.length MissingArg(argv)
 			opt_userdefs=args[n]
+		Case "gprof"
+			opt_gprof = True
 		Default
 			CmdError "Invalid option '" + argv + "'"
 		End Select
@@ -359,6 +362,9 @@ Function Usage:String(fullUsage:Int = False)
 		s:+ "~t~tGenerates line mappings suitable for GDB debugging.~n"
 		s:+ "~t~tBacktrace (etc.) will show .bmx relative source lines rather than that of the generated code."
 		s:+ "~n~n"
+		s:+ "~t-gprof~n"
+		s:+ "~t~tCompiles for gprof profiling.~n"
+		s:+ "~n~n"
 		s:+ "~t-h~n"
 		s:+ "~t~tBuild multithreaded version. (This is the default on NG)~n"
 		s:+ "~t~tThe default on legacy BlitzMax is to build non-threaded. On legacy, using this option will also~n"

+ 17 - 1
bmk_make.bmx

@@ -362,6 +362,14 @@ Type TBuildManager Extends TCallback
 		If opt_release Then
 			cc_opts :+ " -DNDEBUG"
 		End If
+		If processor.BCCVersion() <> "BlitzMax" Then
+			If opt_gdbdebug Then
+				cc_opts :+ " -g"
+			End If
+			If opt_gprof Then
+				cc_opts :+ " -pg"
+			End If
+		End If
 	
 		Local sb:TStringBuffer = New TStringBuffer
 		sb.Append(" -g ").Append(processor.CPU())
@@ -1241,7 +1249,15 @@ Type TBuildManager Extends TCallback
 			If opt_threaded Then
 				cc_opts :+ " -DTHREADED"
 			End If
-			
+			If processor.BCCVersion() <> "BlitzMax" Then
+				If opt_gdbdebug Then
+					cc_opts :+ " -g"
+				End If
+				If opt_gprof Then
+					cc_opts :+ " -pg"
+				End If
+			End If
+
 			source.cc_opts = ""
 			If source.mod_opts Then
 				source.cc_opts :+ source.mod_opts.cc_opts

+ 7 - 0
bmk_util.bmx

@@ -304,6 +304,10 @@ Function LinkApp( path$,lnk_files:TList,makelib:Int,opts$ )
 			End If
 		Else
 			sb.Append(" -static")
+			
+			If opt_gprof Then
+				sb.Append(" -pg")
+			End If
 		End If
 		
 		sb.Append(" -o ").Append(CQuote( path ))
@@ -449,6 +453,9 @@ Function LinkApp( path$,lnk_files:TList,makelib:Int,opts$ )
 		If Not opt_nopie Then
 			sb.Append(" -no-pie -fpie")
 		End If
+		If opt_gprof Then
+			sb.Append(" -pg")
+		End If
 		sb.Append(" -pthread")
 		sb.Append(" -o ").Append(CQuote( path ))
 		sb.Append(" ").Append(CQuote( tmpfile ))