Jump to content

Photo

Debugger integration in Virtual Jaguar

virtual jaguar debugger emulator

51 replies to this topic

#1 dilinger OFFLINE  

dilinger

    Space Invader

  • 46 posts
  • Location:Montreal

Posted Fri Sep 1, 2017 5:58 AM

Hi,
 
Just wanted to share my debugger integration in Virtual Jaguar. Screenshot shows an example about how it looks like.
Nothing can replace the real hardware but I wanted to give a try and modify the emulator.
I have added the support of ELF/DWARF format because my toolchain is based on it, and such format can operate at source code level.
 
If someone knows about QT and OpenGL integration, it can be helpful to me. Because, if I build the emulator under msys2 environement, I have a correct video output but if I build it with Visual Studio 2015, the output video remains black/empty.

Attached Thumbnails

  • 2017-09-01 07_29_04-Virtual Jaguar GIT - Debugger Mode.jpg


#2 TXG/MNX OFFLINE  

TXG/MNX

    River Patroller

  • 3,627 posts

Posted Sat Sep 2, 2017 11:16 AM

Nice can you also display a window for DSP RISC and GPU RISC so step support



#3 Otto1980 OFFLINE  

Otto1980

    Chopper Commander

  • 239 posts
  • Location:Poland

Posted Sat Sep 2, 2017 2:44 PM

Can You provide us your modifications for testing?

#4 dilinger OFFLINE  

dilinger

    Space Invader

  • Topic Starter
  • 46 posts
  • Location:Montreal

Posted Sat Sep 2, 2017 3:33 PM

Hi

 

Nice can you also display a window for DSP RISC and GPU RISC so step support

There are display for the GPU and DSP but no tracing for the moment. I add features when I feel the need or when I see "easy to do stuff".

 

Can You provide us your modifications for testing?

I can provide my current emulator version. But, you have to be aware my version need some DLLs (which I can provide), but no video output is displayed. As far, you do not need it, it won't be a big deal.

 

In the meantime, I have included my current Release notes for people interested to know more about my modifications.

Attached Files



#5 Zerosquare OFFLINE  

Zerosquare

    River Patroller

  • 2,391 posts
  • Location:France

Posted Sat Sep 2, 2017 6:11 PM

Have you contacted Shamus? Merging your work into the official VJ code would benefit a lot of people :)



#6 dilinger OFFLINE  

dilinger

    Space Invader

  • Topic Starter
  • 46 posts
  • Location:Montreal

Posted Sat Sep 2, 2017 6:28 PM

Have you contacted Shamus? Merging your work into the official VJ code would benefit a lot of people :)

Thank you for your kind word.

I have been in touch with Shamus in the middle of 2016. I told him I was going to add the support of the ELF format. After that, I slowly added features but forgot to keep him updated.

I have tried to be very low intrusive in the original source code (such as finding the best hooks to insert my calls stuff), and created specific sources codes for most of the new windows / features.

In theory, the integration should be smooth.



#7 rocky1138 OFFLINE  

rocky1138

    Space Invader

  • 41 posts
  • Location:Canada

Posted Sun Sep 3, 2017 9:10 AM

Very cool. In my spare time I've been using Virtual Jaguar to learn more about writing an emulator, assembly language, etc.

 

I forked Virtual Jaguar and created Chocolate Virtual Jaguar with the intention of basically removing the cruft from the codebase and using it as a huge learning project essentially for myself. If you ever release the code for this, I'd love to take a look to see what you did.

 

https://github.com/r...ar/tree/develop



#8 TXG/MNX OFFLINE  

TXG/MNX

    River Patroller

  • 3,627 posts

Posted Sun Sep 3, 2017 11:16 AM

Yes release this it looks great.



#9 dilinger OFFLINE  

dilinger

    Space Invader

  • Topic Starter
  • 46 posts
  • Location:Montreal

Posted Sun Sep 3, 2017 8:31 PM

Good evening,

I have shared the Virtual Jaguar and the DLLs in my Dropbox, in case of someone wants to have a look at the debugger.

I do not mind to share the source code, but I would prefer to make sure the version works properly outside my own environement.

 

Virtual Jaguar 64bits application
QT5 DLLs

Edited by dilinger, Sun Sep 3, 2017 11:46 PM.


#10 Otto1980 OFFLINE  

Otto1980

    Chopper Commander

  • 239 posts
  • Location:Poland

Posted Mon Sep 4, 2017 1:00 AM

thanks for sharing,

 

first feedback from my CMD:

This application failed to start because it could not find or load the Qt platform plugin "windows".
Reinstalling the application may fix this problem.

 

is there a dll missing? i placed all dlls in same folder as the VJ

 

fast goolge results: qwindowsd.dll ??


Edited by Otto1980, Mon Sep 4, 2017 1:02 AM.


#11 dilinger OFFLINE  

dilinger

    Space Invader

  • Topic Starter
  • 46 posts
  • Location:Montreal

Posted Mon Sep 4, 2017 1:54 AM

I do not have missing DLLs and I do not have qwindowsd.dll either.

I guess you have used my QT5 DLL package "Qt5.5.1_DLLs_x64_VS2015-Release".

I will try to dig your issue and, just in case of, have you installed the QT5 binaries for Windows? I think there are packages available in QT downloads section.

I have added the qwindows.dll in the QT package, feel free to check if it works.


Edited by dilinger, Mon Sep 4, 2017 8:52 AM.


#12 Luigi301 OFFLINE  

Luigi301

    Moonsweeper

  • 339 posts

Posted Mon Sep 4, 2017 4:54 PM

I got it to work but I had to install the whole Qt development package and run virtualjaguar from the MSVC2015 Qt command prompt.

 

edit: Well, it starts and runs my homebrew. The --debugger command line crashes the emu though.


Edited by Luigi301, Mon Sep 4, 2017 5:01 PM.


#13 dilinger OFFLINE  

dilinger

    Space Invader

  • Topic Starter
  • 46 posts
  • Location:Montreal

Posted Mon Sep 4, 2017 7:34 PM

Many thanks for your time to test it.

 

I got it to work but I had to install the whole Qt development package and run virtualjaguar from the MSVC2015 Qt command prompt.

I do not have this kind of environement requirement(s). I compiled the QT5 package for VS2015 by myself, so I guess the installation may greater differ.

I'm able to make the emulator under msys2, but still needs the msys2 setup and link in the windows path.

I "dream" to insert all DLLs in the executable and to be ride off of the install "mess".

 

edit: Well, it starts and runs my homebrew. The --debugger command line crashes the emu though.

Could you give me the format used by your homebrew? Have you used additional command line options? I have checked using elf and cof format executable.

If you want, you can send me your homebrew executable and will check the issue.


Edited by dilinger, Mon Sep 4, 2017 7:44 PM.


#14 Luigi301 OFFLINE  

Luigi301

    Moonsweeper

  • 339 posts

Posted Mon Sep 4, 2017 7:50 PM

Many thanks for your time to test it.
 
I do not have this kind of environement requirement(s). I compiled the QT5 package for VS2015 by myself, so I guess the installation may greater differ.
I'm able to make the emulator under msys2, but still needs the msys2 setup and link in the windows path.
I "dream" to insert all DLLs in the executable and to be ride off of the install "mess".
 
Could you give me the format used by your homebrew? Have you used additional command line options? I have checked using elf and cof format executable.
If you want, you can send me your homebrew executable and will check the issue.


It’s a Jaguar server executable - I’m going to say that’s the problem now that I think about it. How can I make a Jaguar ELF with VBCC?


Sent from my iPhone using Tapatalk

#15 JagChris ONLINE  

JagChris

    River Patroller

  • 3,290 posts
  • Location:Oregon

Posted Mon Sep 4, 2017 8:23 PM

Its a Jaguar server executable - Im going to say thats the problem now that I think about it. How can I make a Jaguar ELF with VBCC?


Sent from my iPhone using Tapatalk

It's been a while but I think vbcc has to be recompiled. Might be mistaken. But I don't believe so.

Though Vlink can convert back and forth between a.out and elf. And probably jagserv.

Edited by JagChris, Mon Sep 4, 2017 8:24 PM.


#16 JagChris ONLINE  

JagChris

    River Patroller

  • 3,290 posts
  • Location:Oregon

Posted Mon Sep 4, 2017 8:32 PM

Oh wait vlink is creating the Jag serve format isn't it? Just tell it not to do that and tell it to produce elf.

#17 JagChris ONLINE  

JagChris

    River Patroller

  • 3,290 posts
  • Location:Oregon

Posted Mon Sep 4, 2017 8:37 PM

You'll probably want debug and all that from the compiler I see okay.

It shouldn't be too hard to have your source recompile under GCC m68k elf.

http://www.3do.cdint...php?f=35&t=3371

I think you just need -fleadingunderscore and -c, and -68000 to make sure it produces 68000 asm. And it should work pretty smooth.

Sorry if I'm rambling on. Me and Tursi and Frank Wille put a lot of time into working all that out.

Hope it helps.

Edited by JagChris, Mon Sep 4, 2017 8:48 PM.


#18 Luigi301 OFFLINE  

Luigi301

    Moonsweeper

  • 339 posts

Posted Mon Sep 4, 2017 8:48 PM

I changed the vlink config to output elf32jag instead of jagsrv and it's erroring out now on the startup lib?

 

vlink -belf32jag -t -x -minalign 1 -Bstatic -Cvbcc -nostdlib $VBCC/targets/m68k-jaguar/lib/startup.o "obj/hello.o" "obj/screen.o" "obj/cube.o" "obj/mobj.o" "obj/images.o"   -s -L$VBCC/targets/m68k-jaguar/lib/ -ljag -lvc -o bin/hello.jag failed
 
startup.o: In "startup":
Error 21: startup.o (CODE+0x42): Reference to undefined symbol _BSS_END.
libjag.a(debug.o): In "showoffset":
Error 21: libjag.a(debug.o) (CODE+0x318): Reference to undefined symbol _BSS_END.

 

Unfortunately the attachments don't seem to exist on that thread anymore. I have a m68k-elf-gcc but it's set up for Amiga so I'd need a Jaguar linker script.



#19 JagChris ONLINE  

JagChris

    River Patroller

  • 3,290 posts
  • Location:Oregon

Posted Mon Sep 4, 2017 8:55 PM

Hmm, undefined-symbol sounds like an underscore problem.

Like the names aren't matching anymore between the startup code and the main code.

Check the subsequent posts in the linked to thread for ideas and just look at the names and see if you can fix it.

And you really might want to consider just downloading the m68k gcc elf for Windows because a.out debug is rather primitive though Willie says that the conversion will honor any of the debug info.

Edited by JagChris, Mon Sep 4, 2017 8:57 PM.


#20 JagChris ONLINE  

JagChris

    River Patroller

  • 3,290 posts
  • Location:Oregon

Posted Mon Sep 4, 2017 8:59 PM

And it's recommended to use -minalign 4.

#21 Luigi301 OFFLINE  

Luigi301

    Moonsweeper

  • 339 posts

Posted Mon Sep 4, 2017 9:11 PM

I have the compiler but I need a Jaguar linker script. Do you have one?


Sent from my iPhone using Tapatalk

#22 JagChris ONLINE  

JagChris

    River Patroller

  • 3,290 posts
  • Location:Oregon

Posted Mon Sep 4, 2017 9:29 PM

Whoops. After thinking about it my logic is wrong. There's nothing to fix in the source codes. It might be something in the linker options that's adding and underscored during the link. Best guess on my part.

#23 JagChris ONLINE  

JagChris

    River Patroller

  • 3,290 posts
  • Location:Oregon

Posted Mon Sep 4, 2017 9:29 PM

Yeah I think I have the Linker script at home let me get home and I'll check my sources.

#24 JagChris ONLINE  

JagChris

    River Patroller

  • 3,290 posts
  • Location:Oregon

Posted Mon Sep 4, 2017 10:24 PM

jagElf linker script

Attached Files



#25 toarnold OFFLINE  

toarnold

    Space Invader

  • 35 posts

Posted Tue Sep 5, 2017 2:00 AM

@Luigi301

 

In case of -bjagsrv vlink uses a default linker script if nothing else is provided it looks like:

SECTIONS {
    . = 0x4000;
    .text: {
      *(.text CODE text)
    }
    . = ALIGN(32);
    .data: {
      VBCC_CONSTRUCTORS
      *(.data DATA data)
    }
    . = ALIGN(32);
    .bss: {
      *(.bss BSS bss)
      *(COMMON)
      _BSS_END = ALIGN(32);
    }
  };

The _BSS_END symbol ist used by the vbcc vclib to determine free RAM for malloc/free operations.

 

-toarnold







Also tagged with one or more of these keywords: virtual jaguar, debugger, emulator

0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users