Page 2 of 4

Re: Help with Debug

Posted: Mon Nov 19, 2012 8:52 am
by joerg
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

Re: Help with Debug

Posted: Mon Nov 19, 2012 11:46 am
by danielmaximiliano
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 3211 times

Re: Help with Debug

Posted: Mon Nov 19, 2012 12:39 pm
by Jairo Maia
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.

Re: Help with Debug

Posted: Mon Nov 19, 2012 9:11 pm
by danielmaximiliano
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.

Re: Help with Debug

Posted: Tue Nov 20, 2012 2:10 pm
by danielmaximiliano
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 3160 times
Sample :
Gmail2.rar
(120.99 KiB) Downloaded 129 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

Re: Help with Debug

Posted: Tue Nov 20, 2012 3:57 pm
by danielmaximiliano
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

Re: Help with Debug

Posted: Tue Nov 20, 2012 11:36 pm
by fchirico
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!

Re: Help with Debug

Posted: Fri Mar 01, 2013 9:40 pm
by andyglezl
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.
--------------------------------------------------------------------------------------------

Re: Help with Debug

Posted: Sat Mar 02, 2013 3:31 am
by Rathinagiri
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.

Re: Help with Debug

Posted: Sat Mar 02, 2013 3:56 am
by Leopoldo Blancas
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