Welcome, Guest. Please login or register.

Author Topic: We need an iBrowse replacement for 68k!!!  (Read 75289 times)

Description:

0 Members and 2 Guests are viewing this topic.

Offline matthey

  • Hero Member
  • *****
  • Join Date: Aug 2007
  • Posts: 1294
    • Show all replies
Re: We need an iBrowse replacement for 68k!!!
« on: January 21, 2015, 07:18:09 PM »
Quote from: chris;781979
OK guys, I spent some time fixing up the 68k toolchain for NetSurf, so it now builds again and all the dependent libraries build too.

I've also spent quite a while fixing all the compiler and linker errors for the OS4 build, when passed through the 68k toolchain.  It now builds and runs (don't get too excited) as far as errorneously displaying the splash window as a long thin window at the top of the screen.  It then crashes, probably somewhere between initialising the DataTypes handler and initialising NetSurf.  If I run it on OS4 (yes, that earlier test was on OS3.5, just to check I got the same thing) I can ignore past the crash, and then it crashes creating the main window.

I should probably try to build a simple ReAction example to check that side of things is working, as the splash window couldn't be much simpler so it makes me think the macros are somehow screwed up.

I'll probably keep poking it with my stick but it would progress a lot quicker if I had some help.  Anybody?


Thanks for the work Chris. You have made a lot of Amiga changes and the C source code appears to be in good shape. It looks like you need help from someone with an AmigaOS 4 or Linux environment and with good cross-compiling skills using a newer version of GCC. That's not me but if you could build an executable that is close with SAS/C style debug and symbols then I might be able to help debug NetSurf. I doubt there is any way to get the SAS/C debug and symbols when compiling with a newer version of GCC (STABS or DWARF?) and compiling with vbcc would be more work. Do you use an ELF2HUNK utility to convert the new GCC output from 68k ELF to Amiga Hunk format? What version of GCC are you using?
 

Offline matthey

  • Hero Member
  • *****
  • Join Date: Aug 2007
  • Posts: 1294
    • Show all replies
Re: We need an iBrowse replacement for 68k!!!
« Reply #1 on: January 22, 2015, 02:54:10 AM »
Quote from: chris;782089
I'm using GCC 3.4.6, it creates Hunk binaries without running through any utilities. I think I'm building with -gstabs already (hangover from OS4), and don't have a clue about debugging under 68k.


The best GUI debugger for the Amiga 68k is BDebug in the Barfly package.

http://aminet.net/dev/asm/BarflyDisk2_00.lha

The docs say that it supports STABS as well as the SAS/C (SAS D1) debug info. It might be worth a try to open a source window. BDebug can catch an exception from a crash and allow you to debug from the crash location.

Quote from: chris;782089

At the moment I just want to know why creating bitmap.image objects is failing. I suspect there's something broken in the NDK includes I'm using.


First, make sure you are using the 3.9 NDK as Novacoder suggests. Next, you might try these fixed NDK 3.9 includes:

http://www.heywheel.com/matthey/Amiga/fixed-includes-ndk39.lha

They are from the dead AWeb web site. AWeb uses ClassACT/Reaction also and these were probably fixed by Andy Broad (broadblues).

There is a list of some Reaction bugs in the following text:

http://www.heywheel.com/matthey/Amiga/ami-code.txt

I didn't see anything related to bitmap.image though. Let me know if you find a bug and I may be able to patch it.

Edit: I read the bitmap_ic_relnotes from the NDK 3.9 and it sounds like the old bitmap.image was problematic:

bitmap.image 45.1 (03.02.2001)

ยท complete rewrite, as H&P don't have the sources of
  the original class. this one supports transparent
  blits to interleaved screens. The corrupted nav.-
  buttons of AWeb are gone, now.

My version with AmigaOS 3.9 is bitmap.image 45.1 (03/03/01).
« Last Edit: January 22, 2015, 03:06:57 AM by matthey »
 

Offline matthey

  • Hero Member
  • *****
  • Join Date: Aug 2007
  • Posts: 1294
    • Show all replies
Re: We need an iBrowse replacement for 68k!!!
« Reply #2 on: January 22, 2015, 04:51:32 PM »
Quote from: Heiroglyph;782137
I've got to get a source level debugger set up somehow though. Working on something as big as a browser with only assembly debugging and printf's is like building a ship in a bottle when you just want a ship.


BDebug is not a true source level debugger but it can display the current source line as you step through the 68k assembler executable. You do have to get to the main() function before it will work and it does have to be able to find your source code. BDebug is in the Barfly package.

http://aminet.net/dev/asm/BarflyDisk2_00.lha

The docs say that it supports STABS as well as the SAS/C (SAS D1) debug info. GCC can output STABS with a switch which Chris has selected in the makefile of the NetSurf /amiga directory. Vbcc with a 68k target outputs SAS/C debug by default (with -g in vbcc 0.9d).
 

Offline matthey

  • Hero Member
  • *****
  • Join Date: Aug 2007
  • Posts: 1294
    • Show all replies
Re: We need an iBrowse replacement for 68k!!!
« Reply #3 on: January 22, 2015, 09:52:47 PM »
Quote from: Heiroglyph;782147

I'm spoiled to the Visual Studio and even the SAS/C debuggers. Normally I'd use vbcc and the SAS/C debugger.


SAS/C's debugger CPR is another good GUI debugger and better than BDebug in some ways. I think BDebug is better overall though. Either will work with SAS/C debug info giving the choice of 2 powerful tools.

Quote from: Heiroglyph;782147

I sure wish this would build with vbcc. At some point I'm going to see how gcc specific this codebase is.


From my quick view, most of the code does not use GCCisms (there was an ASM define which I did not track down where it was used though). The build system does uses GCC specific switches. Some lib dependencies may be a problem also. It would take some work to compile with vbcc because it's enough different but then that difference or lack of some bug in GCC or its setup could allow the current problem to be avoided. Compiling with more than one compiler helps to find some problems.

Quote from: wawrzon;782148
please share the debugging methods as i have now to get at it myself. winuae has a built in debugger that can be accessed via shift+f12 or something like that. also i came over this:http://eab.abime.net/showthread.php?t=60759
still i didnt come to how to idenfify offending source line as yet.


Remote debugging is usually only necessary for low level debugging, driver debugging and debugging while booting where the system is in a delicate state or execution can't be stopped. I believe SAS/C's CPR also has a remote debugging feature and is friendlier than GCC's debugger for the monitoring computer.

Both BDebug and CPR can stop within a few instructions of an Enforcer/MuForce hit and can display the source line with SAS/C debug info. It's very helpful to know a little 68k assembler at this point but the values in variables and symbols can be observed. Sometimes the system will crash or freeze after a hit. In that case, use the hit hunk offset with GCCFindHit or FindHunkOffset with vbcc.

http://sun.hasenbraten.de/~frank/projects/download/FindHunkOffset.lha

Without a hit, debugging is trickier and there are several methods of dealing with it.

Quote from: chris;782158
Unfortunately they appear to be no better than the ones I was using :(


Bummer. I looked at the reaction includes for vbcc to see if there are any fixes but there are none. If there is a problem with the includes then it doesn't seem to be well known.

I'm out of ideas for now.
 

Offline matthey

  • Hero Member
  • *****
  • Join Date: Aug 2007
  • Posts: 1294
    • Show all replies
Re: We need an iBrowse replacement for 68k!!!
« Reply #4 on: January 25, 2015, 02:17:47 AM »
Quote from: chris;782260
I've spotted a typo (of no real consequence) in images/bitmap.h:
#ifndef REACTRION_REACTION_H

Nice. It's surprising know one else noticed.

It's definitely my BitMap object which isn't being created, so I'm missing something:
(2.551870) amiga/gui.c ami_gui_splash_open 5189: WindowBase = 0x5be15860
(2.642908) amiga/gui.c ami_gui_splash_open 5190: WindowObject = 0x539a7ba4
(2.712036) amiga/gui.c ami_gui_splash_open 5191: BitMapBase = 0x579b52c0
(2.784028) amiga/gui.c ami_gui_splash_open 5192: BitMapObject = 0x000000

The creation code is this:
Code: [Select]
struct Screen *wbscreen = LockPubScreen("Workbench");
BitMapObject,
 BITMAP_SourceFile, "PROGDIR:Resources/splash.png",
 BITMAP_Screen, wbscreen,
 BITMAP_Precision, PRECISION_IMAGE,
#ifndef __amigaos4__
 BITMAP_Width, 400,
 BITMAP_Height, 250,
#endif
BitMapEnd,


Here is what the old ClassAct example code using the default pub screen looks like:

Code: [Select]

      if(screen=LockPubScreen(NULL))
      {  
         /* Make an image out of an IFF file.
          * The image will be included in the window layout, and is
          * used to clip two other images from
          */
         image1=BitMapObject,
            BITMAP_SourceFile,"PROGDIR:buttons.iff",
            BITMAP_OffsetX, 0,
            BITMAP_OffsetY, 0,
            BITMAP_Width, 577,
            BITMAP_Height, 30,
            BITMAP_Screen,screen,
         EndImage;

         if(image1)
         {  
            /* Get the bitmap of the image
             */
            GetAttr(BITMAP_BitMap,image1,(ULONG *)&bitmap);


Have you tried converting splash.png to splash.iff? Maybe the OS3 version of bitmap.image can only handle iff.
 

Offline matthey

  • Hero Member
  • *****
  • Join Date: Aug 2007
  • Posts: 1294
    • Show all replies
Re: We need an iBrowse replacement for 68k!!!
« Reply #5 on: January 26, 2015, 04:22:14 AM »
Quote from: chris;782346
Yes, no change.  Snoopy isn't even showing that the file is being attempted to be opened - it's like the tag values are completely wrong or something.


Yea, bitmap.image should be able to use anything you have a datatype for but I thought your png datatype might be failing or corrupting the image.

I wouldn't think the following would be a problem since the code works for OS4 but sometimes it's good to cover the basics.

Code: [Select]

BitMapObject,


This should really be:

Code: [Select]

myImage = BitMapObject,


reaction_macros.h defines:

Code: [Select]

#define BitMapObject        NewObject( BITMAP_GetClass(), NULL


This would expand to:

Code: [Select]

myImage = NewObject( BITMAP_GetClass(), NULL,


Next, your:

Code: [Select]

BitMapEnd,


should probably be:

Code: [Select]

BitMapEnd;


I spotted a potential problem in the reaction_macros.h include file.

Code: [Select]

#ifndef End
#define End                 TAG_END)
#endif


This is after the first use of "End". I moved this before the first use of "End" as well as converting some tabs to spaces where it would help consistency and readability. Let me know if this modified reaction_macros.h causes any problems:

http://www.heywheel.com/matthey/Amiga/reaction_macros.h

It's a longshot that this would be the problem but reaction_macros.h should be better this way if I didn't mess something up ;).
 

Offline matthey

  • Hero Member
  • *****
  • Join Date: Aug 2007
  • Posts: 1294
    • Show all replies
Re: We need an iBrowse replacement for 68k!!!
« Reply #6 on: January 26, 2015, 08:48:40 PM »
Quote from: utri007;782386
This might be stupid suggestion, but maybe there is something wrong in your Reaction installation? Other words, them problem is not in code? Has you tried Aweb or some other proggies wich uses Reaction?


Not a bad idea at all. The simplest test would be to download this:

http://aminet.net/dev/gui/ClassAct2Demo.lha

and execute ClassAct/Examples/BitMap/BitMapExample in the archive. For me with AmigaOS 3.9, this opens a window titled "Bitmap Example" containing 2 images of buttons with text below them saying "Buttons by Supernov". The code generated in this example could be compared to that in NetSurf as well as testing the Reaction installation.
 

Offline matthey

  • Hero Member
  • *****
  • Join Date: Aug 2007
  • Posts: 1294
    • Show all replies
Re: We need an iBrowse replacement for 68k!!!
« Reply #7 on: January 26, 2015, 10:47:02 PM »
Quote from: chris;782391
Yes, loads. I'm running the 68k code I'm compiling under OS4, and if I try on an OS3.5 install (which runs AWeb fine) I'm getting exactly the same thing. It's related to the build environment, not the execution environment.


@Chris
Is it possible to archive your AmigaOS 3 build with needed relative directory structure so I could make a single NetSurf assign and try it? The archive would probably be rather large so a link might be best but I could PM you my e-mail address for an attachment too. The zone on http://eab.abime.net/ is a possibility but I don't know if you have an account on EAB (English Amiga Board).
 

Offline matthey

  • Hero Member
  • *****
  • Join Date: Aug 2007
  • Posts: 1294
    • Show all replies
Re: We need an iBrowse replacement for 68k!!!
« Reply #8 on: January 27, 2015, 02:05:05 AM »
Quote from: wawrzon;782400
this archive must be somehow os4 specific.. i couldnt decompress it properly neither under win or amiga..


Lha didn't work for me either but it decompressed with xadUnFile on the Amiga.

@Chris
I get the same result as you. BitMapObject = 0x000000 and the splash window is a narrow strip at the top of the Workbench screen. I'll check it out with the debugger and see what I can see ;).
 

Offline matthey

  • Hero Member
  • *****
  • Join Date: Aug 2007
  • Posts: 1294
    • Show all replies
Re: We need an iBrowse replacement for 68k!!!
« Reply #9 on: January 27, 2015, 02:31:54 AM »
Quote from: NovaCoder;782404
To ask a stupid question, are we sure the image is actually in that folder?

Can we try and open it first and check that we get a valid file pointer?

splash.png displays fine with my datatypes using Multiview. I don't see anything wrong with the path. Chris has it nice and simply set up so everything is PROGDIR: relative.

Edit: There are no MuForce/MuGuardianAngel problems with the splash screen but there are some after which should be fixed. NetSurf runs and exits without crashing when I am using MuForce. The links below are the complete MuForce/MuGuardianAngel output and the Netsuf debug output.

http://www.heywheel.com/matthey/Amiga/NetSurf_MuHits.txt
http://www.heywheel.com/matthey/Amiga/NetSurf_debug.txt

It looks like GCCFindHit should locate most of the problems in the source :).
« Last Edit: January 27, 2015, 04:03:45 AM by matthey »
 

Offline matthey

  • Hero Member
  • *****
  • Join Date: Aug 2007
  • Posts: 1294
    • Show all replies
Re: We need an iBrowse replacement for 68k!!!
« Reply #10 on: January 27, 2015, 09:08:53 PM »
Quote from: chris;782447
Scratch that, it helps if I don't immediately overwrite the flags I've just saved.  I'm amazed nobody suggested this.
Getting somewhere :)

I've debugged it and it does look like a compiler problem.

ami_gui_splash_open() from amiga/gui.c

Code: [Select]
$0993927a: _ami_gui_splas LINK       A5,#-$0028 ; Allocate temp storage on stack
$0993927e:                MOVEM.L    D2-D5/A2-A4/A6,-(A7) ; Save registers
$09939282:                MOVE.L     _IntuitionBase,A6 ; A6 = ->IntuitionBase
$09939288:                LEA        $09932413(PC),A0 ; A0 = ->"Workbench"
$0993928c:                JSR        LockPubScreen(A6) ; D0 = LockPubScreen()
$09939290:                MOVE.L     D0,D5
$09939292:                CLR.L      -$0020(A5) ; top? = 0
$09939296:                CLR.L      -$001c(A5) ; left? = 0
$0993929a:                MOVE.L     _WindowClass,D3 ; D3 = ->WindowClass
$099392a0:                MOVE.L     #$80000066,-$0018(A5) ; WA_Width tag
$099392a8:                MOVE.L     _LayoutClass,D2 ; D2 = ->LayoutClass
$099392ae:                MOVE.L     #$85007001,-$0014(A5) ; LAYOUT_Orientation tag ???
$099392b6:                MOVE.L     #$85019001,-$0010(A5) ; BITMAP_SourceFile tag
$099392be:                MOVE.L     _IntuitionBase,A6 ; A6 = ->IntuitionBase (unnecessary)
$099392c4:                MOVE.L     _BitMapClass,A0 ; A0 = ->BitMapClass
$099392ca:                SUBA.L     A1,A1 ; A1 = 0
$099392cc:                LEA        -$0010(A5),A2 ; A2 = ->tag list
$099392d0:                JSR        NewObjectA(A6) ; NewObject()

* My particular tag list for NewObjectA() ends up being:
*
* A2-> 0x85019001,0x09f9bebc or BITMAP_SourceFile,""
*      0x09939c2a,0x00000000 or unitialized data on stack,TAG_END
*
* However, all the tags after the first are unitialized data on the stack :(.

The pointer to "PROGDIR:Resources/splash.png" is never written nor is any part of the taglist after that. GCC appears to be very confused here and I don't think it has anything to do with the include files (although LAYOUT_Orientation instead of LAYOUT_AddImage is strange but the includes look correct and that tag is not used for the bitmap.image tag list).

Quote from: chris;782449
I can't get gccfindhit to work here :(

(I tried both versions on Aminet and I built my own out of a piece of string and some slightly newer source code I found)

I'll see if I can find you the source functions. Symbols loaded for NetSurf with BDebug but line debug for sources didn't seem to work. It's usually the line debug type info that gives the source location but I don't know about STABS.
« Last Edit: January 27, 2015, 09:22:14 PM by matthey »
 

Offline matthey

  • Hero Member
  • *****
  • Join Date: Aug 2007
  • Posts: 1294
    • Show all replies
Re: We need an iBrowse replacement for 68k!!!
« Reply #11 on: January 28, 2015, 01:45:52 AM »
Quote from: chris;782469
Well, that explains why it doesn't work.  Something must be screwed up with GCC's optimisation in the version I'm using.  I'll have to try to get 4.5.4 working, but since I have a no optimisation workaround, and that's probably better for debugging, it can wait.

Sometimes less optimization is better up to a point. GCC generates aweful 68k code below -O1 or without optimizations making it tedious to read (in comparison, vbcc is nice, simple and readable with -O1) . Using registers is easier for me to read than using a stack frame also.

Quote from: chris;782469
That would be very useful, I guess it needs a different -g option.

GCCFindHit did not work for me either so I assume that it doesn't have the debug info it needs. It should say in the docs for GCCFindHit how it needs to be compiled. I have used GCCFindHit before with success.

Quote from: chris;782469
I've managed to get it as far as opening up the main browser window, but it's crashy crashy crashy and never loads the page.  I've uploaded a new build in the same place if you want to try it under real OS3 (still testing under OS4 here as it's easier).  I have noticed that you probably need to create a directory called "Users" in the NetSurf directory, as NetSurf itself never creates it (I was using CreateDirTree under OS4 but simply translated that to CreateDir for OS3 - so it misses this directory.  Something to fix later.)

Some line numbers for Enforcer hits would be incredibly useful now, as I don't have a clue where to start looking to get this working further, beyond fixing the font code which I'm pretty sure is making it assert.

The first hit (byte read from 0) comes from the locale.library patch of Stricmp() in the utility.library. This is called from the asl.library which is called from NetSurf in ami_file_req_init() of amiga/file.c. The problem occurs in the second AllocAslRequest(). It looks like D0=ASL_FileRequest=0 which is correct and A0 points at the tag list which is:

Code: [Select]
A0-> 0x8008002c,0x00000001 or ASLFR_DoSaveMode,TRUE
        0x8008003c,0x00000001 or ASLFR_RejectIcons,TRUE
        0x80080009,0x00000000 or ASLFR_InitialDrawer,NULL
        0x00000000 or TAG_DONE

The code does move your nsopt_charp to the tag list:

Code: [Select]
  move.l _nsoptions,a0
   move.l ($73c,a0),(-8,a5)

I believe GCC is creating the tags correctly here but a NULL pointer is moved to the data for the ASLFR_InitialDrawer tag item.

This is from the first archive. Note that hits after the first hit may be caused by earlier hits.

The second hit is a byte read from 0x85030001 which occurs in Libs:arexx.class as called from Intuition. The call originates from ami_arexx_init() in amiga/arexx.c. The second and last NewObjectA() or ARexxObject in your source is the problem. The tag list looks like:

Code: [Select]
A2-> 0x85030001,0x85030001 or AREXX_HostName,AREXX_HostName?
        0x093ada24,0x095352c8 or garbage,garbage
        0x000f4240,0x00000001 or garbage,garbage
        0x00000014,0x234be05 or garbage,garbage
        0x0230f2b7,0x0952488c or garbage,garbage
        0x099ad2f0,0x091b64b8 or garbage,garbage
        0x00000000 or TAG_DONE

NewObjectA() returns 0 (object creation failure?). This appears to be GCC having problems with tag lists again. ARexxClass is moved into A0 and A1 is cleared like this is a NewObjectA but then GCC seems to optimize away part of the tag list creation.

I'm going to try the new archive now as we can see that your version of GCC has a bug with tag lists.

Wtih the second archive, I'm still getting the ami_file_req_init() byte read from address 0 as described above. I then get to the screen mode requestor. I've tried a 32 bit little endian and big endian screen mode which both opened and some of the visuals were displayed before the system froze. MuForce recorded a long read from 0x12 buried (probably several functions) deep in intutition.library. This is going to be tricky to debug.
« Last Edit: January 28, 2015, 04:21:11 AM by matthey »
 

Offline matthey

  • Hero Member
  • *****
  • Join Date: Aug 2007
  • Posts: 1294
    • Show all replies
Re: We need an iBrowse replacement for 68k!!!
« Reply #12 on: January 28, 2015, 02:25:53 PM »
Quote from: chris;782486

If you can track it down that will be really helpful.  Make sure it isn't just an assertion though - they usually result in everything freezing.  NetSurf will show "assertion failed" in the debug output if it is.


I was able to debug past opening the screen and the window which are stable despite the minor text corruption. There was a call to hlcache_handle_retrieve() the function before the freeze which I did not step into. Maybe the freeze is from an assert but I still get the long read from 0x12 deep in intuition. I have BDebug set to stop on MuForce hits which it does on the first but hit on this one. I'll try once more paying better attention to the debug output and try stepping into that minor looking function.
 

Offline matthey

  • Hero Member
  • *****
  • Join Date: Aug 2007
  • Posts: 1294
    • Show all replies
Re: We need an iBrowse replacement for 68k!!!
« Reply #13 on: January 28, 2015, 09:57:58 PM »
It looks like the freeze is from intuition.library OffMenu() where A0=Window=0x09f20374 and D0=MenuNumber=0x00000100 (AMI_MENU_CLOSE_TAB?). There must have been several inlined functions without symbols so I can't tell the exact location. I was stepping along in browser_window_navigate() of /desptop/browser.c. Toward the end of browser_window_navigate, hlcache_handle_retrieve() is called returning error=0 (NSERROR_OK?). It looks like browser_window_start_throbber() is called without a problem and then we call browser_window_refresh_url_bar_internal(). Somewhere along in hear there was a call to RefreshSetGadgetAttrs() and RefreshSetGadgetAttrsA() and then the OffMenu(). It makes sense with the deep intuition hit that there is a bad pointer (probably a NULL pointer accessing offset 0x12 of some structure). The last debug entry I received was:

Code: [Select]
desktop/browser.c browser_window_navigate 1994: Loading 'about:welcome'

The freeze was a long time after the last message though. If you can't figure out which OffMenu() then I can get back fairly close easily. Too bad that GCCFindHit is not working or I could probably tell you the exact source line. Let me know if you need more info.

Edit: If I am correct that OffMenu() is using AMI_MENU_CLOSETAB, then the function calling OffMenu() which freezes would be ami_update_buttons() in /amiga/gui.c. This makes sense as I don't get a symbol (no function name to see) for "static" functions. Do I win a new build of NetSurf?
« Last Edit: January 29, 2015, 12:02:46 AM by matthey »
 

Offline matthey

  • Hero Member
  • *****
  • Join Date: Aug 2007
  • Posts: 1294
    • Show all replies
Re: We need an iBrowse replacement for 68k!!!
« Reply #14 on: January 29, 2015, 01:01:25 AM »
Quote from: chris;782539
Yes :)

It's still freezing for me so unless I haven't removed the On/OffMenu properly (I've #defined them out of existance) then there's something new to find.


O.k. I have something else I need to work on so I probably won't be able to test until tomorrow. Did you place a new build at the same location as the others?