How does the /d build option work

Issues and Discussions related to Harbour

Moderator: Rathinagiri

Post Reply
bluebird
Posts: 172
Joined: Wed Sep 28, 2016 3:55 am
DBs Used: DBF

How does the /d build option work

Post by bluebird »

After build.bat /d someprg.prg, the result on my system (ver 3.4.3 or the new 3.4.4) is aaan exe file called d.exe

Can somene explain how the /d works and how the debugger gets connected so I can try to resolve this problem.

Thanks you
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Re: How does the /d build option work

Post by Pablo César »

Hi,

In this topic viewtopic.php?p=48031#p48031 I pointed out several problems with the Build.bat switches and no one analyzed, neither to give the reason nor to indicate if I was wrong. :|

I made a Build.bat that works with the combinations of switches and worked perfectly, but no one was interested in the time Claudio was in charge to approve.

Now things seem to take much longer to get approved than before...

I have always been in favor of participating in the forum, but I confess that doing something new in HMG discourages a lot... :|
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
bluebird
Posts: 172
Joined: Wed Sep 28, 2016 3:55 am
DBs Used: DBF

Re: How does the /d build option work

Post by bluebird »

Finally a response. I still cannot use debug - the /d parameter causes build.bat to make a new file that it calls d.exe.

I looked at the build.bat file that I have and there are no batch lines in it that try to interpret the /d option.

I must have the wrong batch file or perhaps there is a setup problem that prevents HMG (or is it BCC) from finding the actual debug code.

If anyone has a batch file that works, could you please send it via this forum.

PS. I use windows 10 with versions 3.3.3 and recently 3.4.4.

Gracious
edk
Posts: 909
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: How does the /d build option work

Post by edk »

Hi Bluebird.

Here is the Build.bat, which works fine for me with HMG debugger.

Code: Select all

@echo off

rem *******************************************************************************
rem SYNTAX
rem *******************************************************************************
rem	build [ /n ] [ /d ] [ /c ] <program.prg> | <project.hbp> [<hbmk2 params>]
rem
rem	/n	no run after build
rem	/d	enabled debugger
rem	/c	console mode
rem
rem
rem	This batch file passes information to hbmk2 to make possible an easy (zero
rem	configuration build of HMG applications).
rem 
rem	You can achieve a customized build passing parameters directly to hbmk2.
rem	Please, take a look at hbmk2 help:
rem
rem	hbmk2 --help

rem *******************************************************************************
rem SET DEFAULT OPTIONS
rem *******************************************************************************

rem set gtdrivers=-gtwin -gtgui
set gtdrivers=-gtgui
rem set gtdrivers=-gtwin -gtstd
set runafterbuild=.f.
set debug=


rem ******************************************************************************
rem DELETE FILES FROM PREVIOUS BUILD
rem ******************************************************************************

if exist build.log del build.log
if exist error.log del error.log
if exist init.cld del init.cld

rem ******************************************************************************
rem SET HMGPATH
rem ******************************************************************************
rem
rem Using %~dp0 the HMGPATH is automatically set to current (hmg) folder making it
rem portable (zero config)

rem SET HMGPATH=c:\hmg.3.3.1
SET HMGPATH=c:\hmg.3.4.2

rem ******************************************************************************
rem SET BINARIES PATHS
rem ******************************************************************************

SET PATH=%HMGPATH%\harbour\bin;%HMGPATH%\mingw\bin;%PATH%

rem *******************************************************************************
rem PROCESS PARAMETERS 
rem *******************************************************************************
rem
rem	/n	no run after build
rem	/d	enabled debugger
rem	/c	console mode
rem

if "%1"=="" goto End
if [%1]==[/n] set runafterbuild=.f.
if [%1]==[/n] shift

if [%1]==[/d] set gtdrivers=-gtwin -gtgui
if [%1]==[/d] set debug=-b
if [%1]==[/d] echo options norunatstartup > init.cld
if [%1]==[/d] shift

if [%1]==[/c] set gtdrivers=-gtwin -gtgui
if [%1]==[/c] shift

rem ******************************************************************************
rem COMPILE RESOURCES
rem ******************************************************************************

echo #define HMGRPATH %HmgPath%\RESOURCES > _hmg_resconfig.h
COPY /b %HMGPATH%\resources\hmg.rc+"%~n1.rc"+%HMGPATH%\resources\filler _temp.rc >NUL
windres -i _temp.rc -o _temp.o >windres.log 2>&1

rem *******************************************************************************
rem SET PROJECT OUTPUT FILE NAME 
rem *******************************************************************************
rem
rem The first parameter sent to hbmk2 is -o%~n1.exe. I've added to it create the 
rem application with the project basename (<projectname.hbp> specified by the user.

rem *******************************************************************************
rem SET DEFAULT CONFIGURATION FILE
rem *******************************************************************************
rem
rem The second parameter sent to hbmk2 is the hmg.hbc script to set config required.

rem *******************************************************************************
rem SET QUIET MODE
rem *******************************************************************************
rem
rem The third parameter sent to hbmk2 is -q (Harbour quiet mode)

rem ******************************************************************************
rem CALL HBMK2
rem ******************************************************************************

HBMK2 -mt %HMGPATH%\hmg.hbc %gtdrivers% -q %debug% %1 %2 %3 %4 %5 %6 %7 %8 >hbmk.log 2>&1

rem ******************************************************************************
rem CREATE LOGS
rem ******************************************************************************

if errorlevel 1 if exist windres.log copy /a windres.log+hbmk.log error.log >nul
if errorlevel 1 if not exist windres.log copy /a hbmk.log error.log >nul

if errorlevel 0 if exist windres.log copy /a windres.log+hbmk.log build.log >nul
if errorlevel 0 if not exist windres.log copy /a hbmk.log build.log >nul

rem ******************************************************************************
rem CLEANUP
rem ******************************************************************************

if exist windres.log del windres.log
if exist hbmk.log del hbmk.log
if exist _hmg_resconfig.h del _hmg_resconfig.h
if exist _temp.rc del _temp.rc
if exist _temp.o del _temp.o

rem ******************************************************************************
rem SHOW LOG
rem ******************************************************************************

if exist error.log type error.log
if exist build.log type build.log

rem ******************************************************************************
rem RUN APPLICATION
rem ******************************************************************************

if [%runafterbuild%]==[.f.] goto END
if exist dat GOTO OTHER
if exist "%~n1".exe "%~n1".exe
GOTO END
:OTHER
SET /p "OTHER=" <dat
COPY "%~n1".exe %other%
if errorlevel 1 goto END
if exist "%~n1".exe %other%\"%~n1".exe
:END
User avatar
serge_girard
Posts: 3158
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: How does the /d build option work

Post by serge_girard »

I don't use debugger, I prefer my own methods:

Simply:

Code: Select all

SET PRINTER TO C:\TEST\DEBUG.TXT 
SET PRINTER ON 
SET CONSOLE OFF
? 'START'
// DO ALL KINDS OF THINGS
SET PRINTER TO  
SET PRINTER OFF 
SET CONSOLE ON
Then view/edit C:\TEST\DEBUG.TXT

Never neede more than that!

Serge
There's nothing you can do that can't be done...
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Re: How does the /d build option work

Post by Pablo César »

bluebird wrote: Mon May 22, 2017 4:52 am I still cannot use debug - the /d parameter causes build.bat to make a new file that it calls d.exe.
Bluebird have you tried with this Build.bat version as I indicated ?

viewtopic.php?p=48056#p48056 (Look for the attached Build.bat file, download it and replace it)

Or simply, you did not read this topic ?

 
I looked at the build.bat file that I have and there are no batch lines in it that try to interpret the /d option
Your statement is totally incorrect.
In the version I indicated, CHECKSWITCH checks all possible SWITCH combinations.
And even in the old Build.bat versions this switch have it been present and treated.

 
I must have the wrong batch file or perhaps there is a setup problem that prevents HMG (or is it BCC) from finding the actual debug code.
BCC ? :? What are you talking about ?

 
bluebird wrote: Mon May 22, 2017 4:52 amIf anyone has a batch file that works, could you please send it via this forum.
That is the problem, when there is a lack of management to approve suggested improvements for cases where there are HMG failures. Instead of dialogue and resolving such issues, a solution of the personal order is mistakenly adopted. And the failure continues to persist in HMG releases in the future...

The forum is good because there are several ideas, but when there is no participation of the rest or the problems are simply ignored or left to one side, we are all harmed and the precious of all participations are discoureged... :|

 
This Build.bat that Edward has posted, is it working for console too ? Why Build.bat is being setted HMG folder inside as restricted name of folder ??
I do not agreed with that.
SET HMGPATH=c:\hmg.3.4.2 :?:

 
In that same Build.bat topic is for everyone to participate. Is not restricted for HMG persons in charge. Any one can participate. There, I touch others questions like as:
  • %1 != %~1
  • runflag for parameterizations
  • fix to accept spaces in projects names
All of these are very important. But seems nobody knows nothing... or it is easier way to wait for others that come with the solution already chewed... :|

 
serge_girard wrote: Mon May 22, 2017 7:25 am I don't use debugger, I prefer my own methods
Me too, Serge. :)
I also prefer to use MsgDebug for displaying variables, arrays and results...

And actually our last improved IDE version is still with bug due GUI debugger in it... :|
IMO, this could it be cut off and try to improve IDE in many others old demmands...
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
bluebird
Posts: 172
Joined: Wed Sep 28, 2016 3:55 am
DBs Used: DBF

Re: How does the /d build option work

Post by bluebird »

Thanks to all who responded. I now consider it to be my own lack of understanding the HMG contents. There are several different files called build.bat and also a compile.bat. I don't understand why there is that compile.bat though and when to use it.

I now realize that I was using the same build.bat that I used to "build" my own applications. I should have been using either the one in the hmg3.4.3 directory or the improved one mentioned by Pablo Cesar. Up to now, I had not tried the /d option so everything has seemed to be OK.

Thanks to all who had patience to respond.
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Re: How does the /d build option work

Post by Pablo César »

Hi Bluebird,

Now I am understanding your difficulties.

I have prepared a short tutorial using Build.bat at: viewtopic.php?p=51457#p51457

 
bluebird wrote: Mon May 22, 2017 2:16 pm There are several different files called build.bat and also a compile.bat. I don't understand why there is that compile.bat though and when to use it.
Yes in each SAMPLES subfolder there is a build batch file for compilling DEMO and the Compile.bat is a different one because compile.bat creates two libs as example and then uses Build.bat for compilling propose. It's by this reason the Compile.bat exists.

 
I also thank you Bluebird for you clarifying your disfficulties. I thank because now I have understood your difficulty and it could be the same for others members. That's the main reason to explain a bit about Build.bat.

But please use it and let us know your difficulties.

I wish if HMG in charge permit to me, to improve even more the Build.bat but we need always the all participations.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
bluebird
Posts: 172
Joined: Wed Sep 28, 2016 3:55 am
DBs Used: DBF

Re: How does the /d build option work

Post by bluebird »

To the HMG community who helped out.

I installed Pablo Cesar's version of build.bat into the HMG.3.4.3 directory then wrote the humble batch file below to
use whenever I want to compile with the /d option. Tested and works just fine now.
cls
rem
rem Use this batch file to input a file to be compiled
rem with the /d option. If a typo occurs in the filename
rem you can re enter it or just close the batch file.
rem The file should be in the same directory as this batch file
rem
:enterfile
set /p thisfile=Enter thisfile:
if exist "%cd%\%thisfile%" (
echo file exists
) else (
echo file doesn't exist
goto badfilename
)
echo %thisfile%
pause
c:\hmg.3.4.3\build /d %cd%\%thisfile%
exit
:badfilename
echo restart and enter a new file name
pause
cls
goto enterfile
User avatar
serge_girard
Posts: 3158
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: How does the /d build option work

Post by serge_girard »

Congratulations !
There's nothing you can do that can't be done...
Post Reply