Help with Debug

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
joerg
Posts: 7
Joined: Tue Sep 25, 2012 4:08 pm
Location: Austria
Contact:

Re: Help with Debug

Post by joerg » Mon Nov 19, 2012 8:52 am

Hi Marek and Maximilian,

Thanks a lot for your fast feedback.
Concerning IDE:
That´s together with notepad++ a fine development environment. I have the problem that IDE F5 Run (and therefore debug) doesn't work for my project.
IDE F5 Run works fine for coding with one program (like all samples) but not for the ERP system I am developing where I have structured the coding in a WENEinc.prg file with tons of includes like
...
#INCLUDE "inkey.ch" &&(Old) clipper inkey codes
* #INCLUDE <hmg.ch>
#INCLUDE "hmg.ch"
#include "mysql.ch" && Definitions for mySQL
...
#INCLUDE "WENEbo_pop.prg" && Detail popup
...
When using "ThisWindow.Name" in WENEbo_pop.prg I get a "syntax error at '.'". The same is true for many other includes - I get tons of errors for HMG commands from IDE F5 run.
HMG build.bat works fine for the main program.

Concerning the sample coding with ALTD() from Maximilian:
The first ALTD(1) works fine (when building with /d it is not necessary) - After the second ALTD() I get the described loop/hangup.

Thanks again :D and kind regards,
Joerg

User avatar
danielmaximiliano
Posts: 2081
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: Help with Debug

Post by danielmaximiliano » Mon Nov 19, 2012 11:46 am

Debugger works fine.

Code: Select all

/*
 * $Id: altdtest.prg 17835 2012-07-18 13:41:31Z vszakats $
 */

// Testing AltD()
// Notice you have to compile it using /b

PROCEDURE Main()

   AltD( 1 )   // Enables the debugger. Press F5 to go

   Alert( "debugger enabled" )

   AltD()      // Invokes the debugger

   Alert( "debugger invoked" )

   RETURN

Greenshot_2012-11-19_08-41-07.jpg
Greenshot_2012-11-19_08-41-07.jpg (70.43 KiB) Viewed 1741 times
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`.HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. : +54901169026142
Telegram Name : DaNiElMaXiMiLiAnO

User avatar
Jairo Maia
Posts: 53
Joined: Sun Jul 17, 2011 1:47 pm
Location: Campinas - SP - Brazil

Re: Help with Debug

Post by Jairo Maia » Mon Nov 19, 2012 12:39 pm

Hi Daniel,

Although I never used the debug, one thing let me curious:

I got the same result as you with hmg 3.0.46, but i changed the function Alert() to MsgBox(), due to if i keep the Alert() the example no work.

So, my ask is:
Did you compile the code above as it is?

Best Regards.

User avatar
danielmaximiliano
Posts: 2081
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: Help with Debug

Post by danielmaximiliano » Mon Nov 19, 2012 9:11 pm

Jairo Maia wrote:Hi Daniel,

Although I never used the debug, one thing let me curious:

I got the same result as you with hmg 3.0.46, but i changed the function Alert() to MsgBox(), due to if i keep the Alert() the example no work.

So, my ask is:
Did you compile the code above as it is?

Best Regards.
You have an example that does not work with the Debugger??? thus better implement the call to debug.
Debugger has many very good options that can be applied in an executable to debug faster.

Tiene usted un ejemplo que no funcione con el Debugger ??? de esa forma poder aplicar mejor los llamado hacia debug.
Debugger tiene muchas opciones muy buenas que se puede aplicar en un ejecutable para depurarlo mas rapidamente.
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`.HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. : +54901169026142
Telegram Name : DaNiElMaXiMiLiAnO

User avatar
danielmaximiliano
Posts: 2081
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: Help with Debug

Post by danielmaximiliano » Tue Nov 20, 2012 2:10 pm

Hola a Todos :
el depurador que utiliza Harbour / Pascal y otros lenguajes esta basado en GDB.
http://www.gnu.org/software/gdb/

el depurador es lanzado desde el IDE apenas comienza la aplicacion seleccionando Proyecto , Depurar.

desde la linea de comandos tenemos que compilar el Proyecto .HBP o .PRG con el parametro /b.

Code: Select all

Call c:\hmg.3.0.46\build.bat %* /b
pero esto no es todo, si al lanzar el depurador no tenemos nuestro Fuente en el mismo?
el depurador busca los fuentes en la carpeta donde se encuentra el ejecutable pero si esta en otro lugar como este Ejemplo de Gmail en mismo no es cargado.

tenemos una solucion para ello.

Code: Select all

Options Path C:\Gmail2\Source
File Open Incomming.Prg
Monitor Static
Monitor Public
Monitor Local
Monitor Private
todo esto lo incluiremos en un archivo que es necesario para el depurador.
Init.cld

pero que sucede si queremos lanzar el depurador en determinado lugar del fuente?
ya tenemos nuestra aplicacion con el depurador listo para trabajar solo tenemos que capturar las teclas Alt-D con un simple GET
el GUI atrapa ciertas teclas. si alguien tiene un solucion es bienvenida.

Code: Select all

Function InvokeDebugger() 
REQUEST HB_GT_WIN_DEFAULT
 Incomming.Hide
 SetMode(25,80)
  AltD( .T. )  /* Invoke Debug */
  ? "to activate debug "
  ? 
  ? "Press [ Alt-D + Enter ] or Press [ Alt-Q + Enter ] to exit"
  
   Inkey( 0 )
   AltD( .F. )
Incomming.restore

 Return

dentro del depurador tenemos las clasicas teclas
F8 - pasos
F5 - Correr
Alt-X - salir


Translate Google

Hi Everyone:
Harbour using the debugger / Pascal and other languages ​​is based on GDB.

http://www.gnu.org/software/gdb/

is launched from the IDE just starts the application by selecting Project, Debug.

from the command line we need to compile the Project .HBP or .PRG with parameters /b.

Code: Select all

[code]Call c:\hmg.3.0.46\build.bat MyProject.hbp /b
[/code]

But that's not all, if not to launch the debugger have our source in the same?
the debugger looks for Sources in the folder where the executable but if this elsewhere as Gmail in this example it is not loaded.

We have a solution for this.

Code: Select all

Options Path C:\Gmail2\Source
File Open Incomming.Prg
Monitor Static
Monitor Public
Monitor Local
Monitor Private
this will include it in a file that is necessary for the debugger.
Init.cld

but what if we want to launch the debugger in a particular place the source?
we have our application with the debugger ready to work just have to capture the Alt-D with a simple GET
The GUI captures certain keys. if anyone has a solution is welcome.

Code: Select all

Function InvokeDebugger() 
REQUEST HB_GT_WIN_DEFAULT
 Incomming.Hide
 SetMode(25,80)
  AltD( .T. )  /* Invoke Debug */
  ? "to activate debug "
  ? 
  ? "Press [ Alt-D + Enter ] or Press [ Alt-Q + Enter ] to exit"
  
   Inkey( 0 )
   AltD( .F. )
Incomming.restore

 Return


within the debugger keys have the classic
F8 - steps
F5 - Run
Alt-X - Quit

I will do more research on Init.cld that has many internal parameters that is passed to debugger.
Gmail.jpg
Gmail.jpg (127.68 KiB) Viewed 1690 times
Sample :
Gmail2.rar
(120.99 KiB) Downloaded 89 times
Use debug.bat to compile the example working folder c:\Gmail2
utilize debug.bat para compilar el ejemplo, la carpeta de trabajo c:\Gmail2
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`.HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. : +54901169026142
Telegram Name : DaNiElMaXiMiLiAnO

User avatar
danielmaximiliano
Posts: 2081
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: Help with Debug

Post by danielmaximiliano » Tue Nov 20, 2012 3:57 pm

Fix -

Code: Select all

#define DISABLE     0
#define ENABLE      1

Function InvokeDebugger() 
REQUEST HB_GT_WIN_DEFAULT
 Incomming.Hide
 SetMode(25,80)
  AltD( ENABLE )  /* Enables the debugger. */
  AltD()     /* Invoke  Debug */
   AltD( DISABLE )
Incomming.restore

 Return
In Debug
F8 = Next Step
F5 = Continue execution of the Program

Do not use ALT-X
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`.HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. : +54901169026142
Telegram Name : DaNiElMaXiMiLiAnO

User avatar
fchirico
Posts: 324
Joined: Sat Aug 23, 2008 11:27 pm
Location: Argentina

Re: Help with Debug

Post by fchirico » Tue Nov 20, 2012 11:36 pm

mol wrote:Debugging is beatiful!
You can monitor your variables, loops, you can change/set value of variables. You can view opened dbfs, indexes, arrays.
Place altd() function to your code, where you want to observe how program runs. You can run program line by line or run whole function/procedure. When debugger window opens, all possibilities are placed in upper menu.
I didn't search documentation about debug in the internet, because I use it from always (there was no internet years ago). I can search my installation diskettes for clipper 5.2, I think there was some information in norton guide format.
Gracias Marek, gracias Rathi !!!
Gracias a todos!

Luego de 20 años de programar con xBase pude aprender como usar el DEBUG.
En otros lenguajes de programación lo usaba, pero nunca entendí como usarlo con xBase.

Estoy super contento!

---------------------------------------------------------------------------

Thank you Marek, thank you Rathi!!!

Thank you all!

After 20 years of programming with xBase could learn how to use DEBUG.
In other programming languages ​​used it, but I never understood how to use it with xBase.

I'm super happy!
Saludos, Fernando Chirico.

User avatar
andyglezl
Posts: 981
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: Help with Debug

Post by andyglezl » Fri Mar 01, 2013 9:40 pm

Hola a Todos !

Siguiendo este post, me di cuenta de que yo no era el unico en no utilizar el Debug.

Tuve la necesidad de saber el valor de algunos controles en algun momento de la ejecucion
del programa (ademas de que me enfade de poner msginfo() ) y me di a la tarea de hacer
algo que ayudara mas a este proposito. (anexo imagen)

Pero... llego el momento en que mi mente ya no "carburaba" (como decimos por aca)
y el proyecto se quedo en status de "Espera...". (me sirve, pero no como quisiera)

Lo pongo a disposicion del Foro para ver si con la ayuda de todos, podemos hacer de esto
una herramienta mas util.

P.D. Intente poner tambien el status de las variables de memoria desde un archivo .mem
pero me encontre con algunas limitantes.
----------------------------------------------------------------------------------------------
Hi Everyone!

Following this post, I realized that I was not alone in not using Debug.

I needed to know the value of some controls at some point in the execution
program (besides putting me angry MsgInfo ()) and I gave myself the task of making
something that would help more to this purpose. (attached image)

But ... came the moment my mind is not "carburaba" (as we say over here)
and the project remained in status of "Waiting ...". (I do, but not as I would like)

I am available to forum to see if with the help of everyone, we can do this
a more useful tool.

P.S. Tried to note the status of memory variables from a. Mem
But I found some limitations.
--------------------------------------------------------------------------------------------
Attachments
DemoDebug.rar
(10.37 KiB) Downloaded 89 times
EjempDebug.jpg
EjempDebug.jpg (203.98 KiB) Viewed 1494 times
Andrés González López
Desde Guadalajara, Jalisco. México.

User avatar
Rathinagiri
Posts: 5234
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Help with Debug

Post by Rathinagiri » Sat Mar 02, 2013 3:31 am

Wow! That is really fantastic. It will be really helpful to all.

Thanks for sharing. As you have mentioned we can improve a lot to make this an excellent tool.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

Leopoldo Blancas
Posts: 344
Joined: Wed Nov 21, 2012 7:14 pm
Location: México

Re: Help with Debug

Post by Leopoldo Blancas » Sat Mar 02, 2013 3:56 am

Hola Andyglezl

Baje tu aplicaciòn y me sale el siguiente error al compilar...

Code: Select all

Harbour 3.2.0dev (Rev. 18706)
Copyright (c) 1999-2012, http://harbour-project.org/

C:\hmg.3.1.1\MiosHMG\DemoDebug\DemoDebug.prg(4) Error F0029  [b]Can't open #include file 'i_keybd_ext.ch'[/b]
hbmk2: Error: Running Harbour compiler (embedded). 1
(C:\hmg.3.1.1\harbour\bin\harbour.exe) 
Alguna sugerencia?

Gracias
Polo
*-----------------------------------------------------------------------------------------------------------------------------------------
Hello Andyglezl

Lower your application and I get the following error when compiling ...

Code: Select all

 Harbour 3.2.0dev (Rev. 18706)
Copyright (c) 1999-2012, http://harbour-project.org/

C: \ hmg.3.1.1 \ MiosHMG \ DemoDebug \ DemoDebug.prg (4) Error F0029 [b] Can not open # include file 'i_keybd_ext.ch' [/ b]
hbmk2: Error: Running Harbour compiler (embedded). 1
(C: \ hmg.3.1.1 \ harbor \ bin \ Harbour.exe) [/ code]

Any suggestions?
thanks
Polo

Post Reply