Newbie porting help
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    boot_wb
    Posts: 874 from 2007/4/9
    From: Kingston upon ...
    I'm trying to recompile a Unix package (Aladdin2.d v2.1).

    It seems to compile with no errors or warnings (after installing byacc) from the unaltered makefile, but on running the executable I usually get a requester with:

    Quote:

    ixemul.library message
    free: start of block corrupt


    It's a shell tool, (a collection of mathematical functions for solving differential equations and structural analysis problems) so there's no GUI dependence.

    Occasionally, the program gets to its own command prompt allowing user input, but crashes later when calculating a result.

    I'm running the latest SDK environment, installed using Grunch, with the addition of byacc installed into the usr/local/bin .

    Are there any common/obvious things which could cause this, or any useful tools/guides to help me on my way?
    Have tried logtool filtering the ramdebug log but whilst it filters out the extraneous data, and highlights the good stuff, it doesn't help me to understand what it actually means.

    Highlighted Extract: Quote:

    SRR0 -> MOSSYS:LIBS/ixemul.library Hunk 1 Offset 0x0001665c
    LR -> aladdin Hunk 1 Offset 0x0002af14
    CTR -> MOSSYS:LIBS/ixemul.library Hunk 1 Offset 0x0000084c
    PPCStackFrame History:
    StackFrame[ 0].LR-> Address 0x3451bd04 -> aladdin Hunk 1 Offset 0x0002af14
    StackFrame[ 1].LR-> Address 0x34518998 -> aladdin Hunk 1 Offset 0x00027ba8
    StackFrame[ 2].LR-> Address 0x34518e30 -> aladdin Hunk 1 Offset 0x00028040
    StackFrame[ 3].LR-> Address 0x344f13e4 -> aladdin Hunk 1 Offset 0x000005f4
    StackFrame[ 4].LR-> Address 0x208b91b0 -> MOSSYS:LIBS/ixemul.library Hunk 1 Offset 0x00008640
    StackFrame[ 5].LR-> Address 0x208b86e8 -> MOSSYS:LIBS/ixemul.library Hunk 1 Offset 0x00007b78
    StackFrame[ 6].LR-> Address 0x208cc2dc -> MOSSYS:LIBS/ixemul.library Hunk 1 Offset 0x0001b76c


    Thanks for any help.
    www.hullchimneyservices.co.uk

    UI: Powerbook 5,6 (1.67GHz, 128MB VRam): OS3.1, OSX 10.5.8
    HTPC: Mac Mini G4 (1,5GHz, 64MB VRam): OS3.1 (ZVNC)
    Audiophile: Efika 5200b (SB Audigy): OS3.1 (VNC + Virtual Monitor)

    Windows free since 2011!
  • »15.07.12 - 19:32
    Profile Visit Website
  • MorphOS Developer
    CISC
    Posts: 619 from 2005/8/27
    From: the land with ...
    That error means memory allocated by your application was corrupted, usually this is due to a buffer over/underflow, ie a bug. However it could also be caused by too little stack, try increasing it (start with something obscene like 10000000, then try reducing it if it helps) with ixstack (which will permanently set specified amount of stack for the binary):

    ixstack <stacksize> <path/to/binary>


    - CISC
  • »15.07.12 - 20:20
    Profile
  • MorphOS Developer
    itix
    Posts: 1516 from 2003/2/24
    From: Finland
    Is this a command line tool that requires linuxish runtime environment? If not you should try to compile executable using -noixemul switch.

    I dont think it solves your problem, though.
    1 + 1 = 3 with very large values of 1
  • »15.07.12 - 21:07
    Profile
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    boot_wb
    Posts: 874 from 2007/4/9
    From: Kingston upon ...
    Thanks CISC but alas, no effect. I've even tried setting stack up to 50,000,000 but still no change.

    Seems to have been run on Sparc and Mips systems mainly (whether that has any bearing on its portability), may just be buggy.
    www.hullchimneyservices.co.uk

    UI: Powerbook 5,6 (1.67GHz, 128MB VRam): OS3.1, OSX 10.5.8
    HTPC: Mac Mini G4 (1,5GHz, 64MB VRam): OS3.1 (ZVNC)
    Audiophile: Efika 5200b (SB Audigy): OS3.1 (VNC + Virtual Monitor)

    Windows free since 2011!
  • »15.07.12 - 21:13
    Profile Visit Website
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    boot_wb
    Posts: 874 from 2007/4/9
    From: Kingston upon ...
    Thanks Itix,

    Just tried remaking form scratch, adding the -noixemul flag into the makefile.

    Stupid me, hadn't noticed several warnings relating to 'initialization from incompatible pointer types' whilst building the object files. Will have a look further...

    Thanks
    www.hullchimneyservices.co.uk

    UI: Powerbook 5,6 (1.67GHz, 128MB VRam): OS3.1, OSX 10.5.8
    HTPC: Mac Mini G4 (1,5GHz, 64MB VRam): OS3.1 (ZVNC)
    Audiophile: Efika 5200b (SB Audigy): OS3.1 (VNC + Virtual Monitor)

    Windows free since 2011!
  • »15.07.12 - 21:25
    Profile Visit Website
  • MorphOS Developer
    CISC
    Posts: 619 from 2005/8/27
    From: the land with ...
    In case you didn't know you can easily find out where it crashed by using the information in the debug log. The SRR0 refers to the address of the hit (it's in ixemul in your case (probably free()), and LR refers to the address it will return to afterwards (this should be right after the free() call, so you should be able to tell what memory was corrupted).

    See Henes' debugging guide (though some info is outdated chapter 3 and 4 should be very helpful)...


    - CISC
  • »16.07.12 - 06:07
    Profile
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    boot_wb
    Posts: 874 from 2007/4/9
    From: Kingston upon ...
    Thanks CISC, useful link. I had referred to that guide once regarding logtool use, but had borked at the idea of scrolling through disassembled code - seemed a bit out of my depth, but it's not that intimidating once you get going with a good reference to hand (Thanks Henes).

    I've recompiled the package successfully adding the -noixemul flag into the makefile, which seems to have helped a lot. I'm now able to invoke the package from the command line every time and run the test files. There is still a 50/50 chance of crashing whilst processing, but I've managed to (iteratively) run all of the test-cases so far, including solving some FE problems for stress/strain and vibration modes.

    I'll investigate the crashes further and see if I can find a common cause. Thanks for your help so far, it's a learning experience. :-)
    www.hullchimneyservices.co.uk

    UI: Powerbook 5,6 (1.67GHz, 128MB VRam): OS3.1, OSX 10.5.8
    HTPC: Mac Mini G4 (1,5GHz, 64MB VRam): OS3.1 (ZVNC)
    Audiophile: Efika 5200b (SB Audigy): OS3.1 (VNC + Virtual Monitor)

    Windows free since 2011!
  • »16.07.12 - 14:15
    Profile Visit Website
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    boot_wb
    Posts: 874 from 2007/4/9
    From: Kingston upon ...
    I'm now playing around creating a simple GUI. It's not tied into the functionality (yet), just playing around with the GUI elements initially. (Thanks to Krashan for the endless hours of hard work creating documentation in the library. scimark is an excellent example to learn from.)

    I've created an MUI GUI with two child goups: 1) a text box 2) a row of 3 buttons.

    I'd like to add a file requester as a 3rd child group (eventually this will pass filename as arguement, but I just want it to appear in the GUI for now).

    Currently I'm trying to use:

    MUIA_Group_Child, MUI_NewObject(MUIC_Group,
    MUIA_Group_Child, create_aslpopup(),
    TAG_END),

    in the build_gui loop, with:

    Object* create_aslpopup(void)
    {
    Object *obj;
    obj = MUI_NewObject(MUIC_Popasl,
    MUIA_Popasl_Active, TRUE,
    MUIA_Popasl_Type, ASL_FileRequest,
    ASLFR_InitialShowVolumes, TRUE,
    TAG_END);
    return obj;
    }

    as a subclass in the same source file.
    (I have also included <proto/asl.h>)

    As I understand from the autodocs (Scribble rules!), there should be no need to specify starthook/stophook for a filerequest.

    When I add this into the code, it compiles with no errors/warnings, but the UI fails to build upon execution.

    Guidance would be helpful wrt:
    What am I missing? Am I misunderstanding/oversimplifying the use of Popasl class? Is there a better way to accomplish this (allowing user to select file from GUI).

    Thanks for any help


    Rich
    www.hullchimneyservices.co.uk

    UI: Powerbook 5,6 (1.67GHz, 128MB VRam): OS3.1, OSX 10.5.8
    HTPC: Mac Mini G4 (1,5GHz, 64MB VRam): OS3.1 (ZVNC)
    Audiophile: Efika 5200b (SB Audigy): OS3.1 (VNC + Virtual Monitor)

    Windows free since 2011!
  • »18.07.12 - 10:28
    Profile Visit Website
  • MorphOS Developer
    itix
    Posts: 1516 from 2003/2/24
    From: Finland
    Here is how I have created Popasl in one of my projects:

    Child, VGroup,
    GroupFrame,
    MUIA_FrameTitle, "CDDA Save Directory",
    Child, PopaslObject,
    ASLFR_DrawersOnly, TRUE,
    MUIA_Popstring_Button, PopButton(MUII_PopDrawer),
    MUIA_Popstring_String, prefs->savepath = StringObject, End,
    MUIA_Popasl_Type, ASL_FileRequest,
    End,
    End,
    End;
    </pre>

    (It is part of other GUI creation code and it might be good idea leave out GroupFrame and group title.)

    What your code is missing is a button to open ASL requester. Usually it is PopButton() but it could be any MUI object (TextObject, ImageObject and so on). You also need a string container. You should use StringObject there although TextObject could be used.

    Instead of MUII_PopDrawer you can use MUII_PopFile or MUII_PopUp or any other MUI image defined in libraries/mui.h (MUII_#? definitions).

    MUIA_Popasl_Active

    From autodocs;

    MUIA_Popasl_Active -- (V7 ) [..G], BOOL, 0x80421b37

    Short explanation of this [..G] definition:

    I - the attribute is settable at object initialization (OM_NEW/NewObject/MUI_NewObject)
    S - the attribute is settable
    G - the attribute is gettable

    Since only G is implied in autodocs this attribute is only gettable (you can check if requester is active or not). You cant set this attribute when creating object or at any time later. It will not do harm: it is just ignored.



    [ Edited by itix 18.07.2012 - 12:25 ]
    1 + 1 = 3 with very large values of 1
  • »18.07.12 - 11:19
    Profile
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    boot_wb
    Posts: 874 from 2007/4/9
    From: Kingston upon ...
    Thanks Itix, will have a play with that.

    I misunderstood the class, and thought the button and string field were implicit in the aslpopup.

    Regards



    Rich
    www.hullchimneyservices.co.uk

    UI: Powerbook 5,6 (1.67GHz, 128MB VRam): OS3.1, OSX 10.5.8
    HTPC: Mac Mini G4 (1,5GHz, 64MB VRam): OS3.1 (ZVNC)
    Audiophile: Efika 5200b (SB Audigy): OS3.1 (VNC + Virtual Monitor)

    Windows free since 2011!
  • »18.07.12 - 18:10
    Profile Visit Website
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    boot_wb
    Posts: 874 from 2007/4/9
    From: Kingston upon ...
    Did have a couple of quick questions re looking at other people's code, but have answered them from the MUI main header file:

    'TAG_END' == 'TAG_DONE'
    'End' == 'TAG_DONE)'
    'child' == 'MUIA_Group_Child'
    'popaslobject' = MUI_NewObject(MUIC_Popasl

    etc

    I have to say, before scribble this would have been so much more difficult to find the relevent information. Now, just highlight a class name, attribute name in the code and and select 'documentation' or 'declaration' and the information is all at your fingertips. More or less.

    One thing I have noticed is End not always appearing where I would expect, but that's just a matter of getting used to the format of some substitions (eg popaslobject where brackets are opened but not closed).

    Thanks, that's unravelled a few misunderstandings for me, and my GUI now has a working popstring :-)
    www.hullchimneyservices.co.uk

    UI: Powerbook 5,6 (1.67GHz, 128MB VRam): OS3.1, OSX 10.5.8
    HTPC: Mac Mini G4 (1,5GHz, 64MB VRam): OS3.1 (ZVNC)
    Audiophile: Efika 5200b (SB Audigy): OS3.1 (VNC + Virtual Monitor)

    Windows free since 2011!
  • »19.07.12 - 14:00
    Profile Visit Website