Jump to content











Photo
- - - - -

Debugging Grub4dos

debug newbie

  • Please log in to reply
10 replies to this topic

#1 algancon

algancon
  • Members
  • 5 posts
  •  
    United States

Posted 22 June 2015 - 07:59 AM

I have installed grub4dos on a USB stick.

How would one go about debugging Grub4dos?

 

There are at least a couple of options that I am trying (have not got them to work yet):

- QEMU + gdb in a linux environment

- Virtualbox + Vboxgdb (in Windows - see http://sysprogs.com/VBoxGDB/tutorial/)

 

Is there  another more 'standard' way to debug the code?

I looked through this forum hoping to find a tutorial or example on this but no success yet.

 

/Newbie

 



#2 steve6375

steve6375

    Platinum Member

  • Developer
  • 7107 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films,guitars, www.easy2boot.com
  •  
    United Kingdom

Posted 22 June 2015 - 08:09 AM

You can debug grub4dos code from the command line of grub4dos.

 

The most convenient way, from a Windows system, is to use VBox+VMUB to set up a VM, make a grub4dos bootable USB stick (e.g. using RMPrepUSB) and then boot to grub4dos using VBox+VMUB.

 

Use grub4dos 0.4.6a from here  e.g. 2015-06-05  - (the site seems to be down at the moment!) - you can use the grldr file from Easy2Boot if you wish.

Look at the Tutorial here (see Debug section)

To debug grub4dos batch files, use the new debug command in grub4dos 0.4.6a.

 

You might also like to watch my RMPrepUSB YouTube videos which includes grub4dos.



#3 algancon

algancon
  • Members
  • 5 posts
  •  
    United States

Posted 22 June 2015 - 02:26 PM

Thanks!

I have a working USB stick and can debug the menu.lst file (the contents of that file is very simple).

But what I want to do is connect somehow the actual grub4dos code that I have managed to build.

E.g. the gunzip.c code. For that I need to connect a debugger, like dbg, from another VM.

 

I guess grub4dos contributors have well-tested methods to do this.

 

My setup is:

-a win7 host with virtualbox

-one virtualbox guest for the usb stick

- another guest for the debugger.

 

 

 

You can debug grub4dos code from the command line of grub4dos.

 

The most convenient way, from a Windows system, is to use VBox+VMUB to set up a VM, make a grub4dos bootable USB stick (e.g. using RMPrepUSB) and then boot to grub4dos using VBox+VMUB.

 

Use grub4dos 0.4.6a from here  e.g. 2015-06-05  - (the site seems to be down at the moment!) - you can use the grldr file from Easy2Boot if you wish.

Look at the Tutorial here (see Debug section)

To debug grub4dos batch files, use the new debug command in grub4dos 0.4.6a.

 

You might also like to watch my RMPrepUSB YouTube videos which includes grub4dos.



#4 steve6375

steve6375

    Platinum Member

  • Developer
  • 7107 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films,guitars, www.easy2boot.com
  •  
    United Kingdom

Posted 22 June 2015 - 02:54 PM

OK, sorry, I misunderstood. You are looking for a C/assembler debugger for grub4dos.



#5 tinybit

tinybit

    Gold Member

  • Developer
  • 1158 posts
  •  
    China

Posted 23 June 2015 - 02:32 AM

I heard Bochs can debug a boot loader and even an OS(I mean any boot loaders and any OSes). But I have never tried it yet.



#6 algancon

algancon
  • Members
  • 5 posts
  •  
    United States

Posted 23 June 2015 - 07:28 AM

I heard Bochs can debug a boot loader and even an OS(I mean any boot loaders and any OSes). But I have never tried it yet.

 

So, are you and other developers writing code in  Grub4dos without using a debugger?

What other methods do you use to check values of variables during execution?

I'd like to learn about the alternatives.



#7 tinybit

tinybit

    Gold Member

  • Developer
  • 1158 posts
  •  
    China

Posted 23 June 2015 - 10:44 AM

forgive me if I am not knowledgable. I mean I might know nothing and I might have been an ignoramus. I have never heard any developer of grub4dos who would have to use a debugger for writing or testing the code.

 

I usually test/debug my code by using printf to print messages on the screen.



#8 algancon

algancon
  • Members
  • 5 posts
  •  
    United States

Posted 23 June 2015 - 11:08 AM

forgive me if I am not knowledgable. I mean I might know nothing and I might have been an ignoramus. I have never heard any developer of grub4dos who would have to use a debugger for writing or testing the code.

 

I usually test/debug my code by using printf to print messages on the screen.

OK, good to know. Then I should maybe do the same.

 

PS: I was not implying anything in my previous mail. Trying to understand how things are done.



#9 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 15103 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 23 June 2015 - 12:02 PM

So, are you and other developers writing code in  Grub4dos without using a debugger?

For NO apparent reason ;):

http://forums.autosp...-greatest-ever/

You don’t need brakes to drive fast…


:duff:
Wonko

#10 algancon

algancon
  • Members
  • 5 posts
  •  
    United States

Posted 23 June 2015 - 12:39 PM

For NO apparent reason ;):

http://forums.autosp...-greatest-ever/

:duff:
Wonko

Well he won his race, so: good point! :)



#11 tinybit

tinybit

    Gold Member

  • Developer
  • 1158 posts
  •  
    China

Posted 23 June 2015 - 01:45 PM

OK, good to know. Then I should maybe do the same.
 
PS: I was not implying anything in my previous mail. Trying to understand how things are done.


Thank you very much for your encouragement, by which I become a bit more confident now.





Also tagged with one or more of these keywords: debug, newbie

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users