baxter_a@wehi.dn.mu.oz (06/26/91)
I am having a little trouble debugging something for the A3000.
I don't have one, so identifying the crook code is dificult, but
I think I've found it. To prevent the Lattice window opening
if starting from WB, I do:
if (argc == 0) /* running under workbench */
{
_ufbs[0].ufbfh = NULL;
_ufbs[1].ufbfh = _ufbs[0].ufbfh;
_ufbs[1].ufbflg = UFB_NC;
_ufbs[2].ufbfh = _ufbs[0].ufbfh;
_ufbs[2].ufbflg = UFB_NC;
handle = (struct FileHandle *)(_ufbs[0].ufbfh << 2);
process = (struct Process *)FindTask(0);
process->pr_ConsoleTask = (APTR)handle->fh_Type;
x = 0;
}
else /* running under CLI */
{
_ufbs[0].ufbfh = Input();
_ufbs[1].ufbfh = Output();
_ufbs[2].ufbfh = Open("*", MODE_OLDFILE);
x = UFB_NC; /* do not close CLI defaults */
}
_ufbs[0].ufbflg |= UFB_RA | O_RAW | x;
_ufbs[1].ufbflg |= UFB_WA | O_RAW | x;
_ufbs[2].ufbflg |= UFB_RA | UFB_WA | O_RAW;
Which replaces the similar code from Lattice umain.c.
This works fine on my A500, and has no problem when later I use:
Execute("failat >Nil: <Nil: 20 \n mount >Nil: <Nil: plt:",0,0);
However, on the A3000, under 1.3 or 2.0, it crashes.
Is this expected behaviour? Do I have to go back to having the little
window?
Regards Alancarolyn@cbmvax.commodore.com (Carolyn Scheppner - CATS) (06/27/91)
In article <1991Jun25.224054.24632@wehi.dn.mu.oz> baxter_a@wehi.dn.mu.oz writes: >I am having a little trouble debugging something for the A3000. >I don't have one, so identifying the crook code is dificult, but >I think I've found it. To prevent the Lattice window opening >if starting from WB, I do: > >if (argc == 0) /* running under workbench */ > { > _ufbs[0].ufbfh = NULL; > _ufbs[1].ufbfh = _ufbs[0].ufbfh; > _ufbs[1].ufbflg = UFB_NC; > _ufbs[2].ufbfh = _ufbs[0].ufbfh; > _ufbs[2].ufbflg = UFB_NC; > handle = (struct FileHandle *)(_ufbs[0].ufbfh << 2); > process = (struct Process *)FindTask(0); > process->pr_ConsoleTask = (APTR)handle->fh_Type; > x = 0; > } Blah - I skimmed that pretty fast but it looks to me like you are referencing off NULL POINTERS into low memory which is different on every model and OS version. Yuck. PLEASE - Either use the mechanism PROVIDED BY Lattice (ie - compile _main.c with the -dTINY flag and link with it) OR use Open("NIL:",MODE_OLDFILE) and place the returned handle in that first place where you are placing NULL !!!!!!!!!!!!!!!!!!!!!! Thanks you. BTW - If you had an 020/MMU or '030 and Enforcer, you woulda been beeping ! -- ========================================================================== Carolyn Scheppner -- Tech. Mgr. CATS - Commodore Amiga Technical Support PHONE 215-431-9180 {uunet,rutgers}!cbmvax!carolyn carolyn@commodore.com Signed characters are xenophobic. ==========================================================================
nix@rainbow.oulu.fi (Tero Manninen) (06/27/91)
On 25 Jun 91 22:40:54 GMT,
baxter_a@wehi.dn.mu.oz said:
[...]
baxter> if (argc == 0) /* running under workbench */
baxter> {
1.
baxter> _ufbs[0].ufbfh = NULL;
baxter> _ufbs[1].ufbfh = _ufbs[0].ufbfh;
baxter> _ufbs[1].ufbflg = UFB_NC;
baxter> _ufbs[2].ufbfh = _ufbs[0].ufbfh;
baxter> _ufbs[2].ufbflg = UFB_NC;
2.
baxter> handle = (struct FileHandle *)(_ufbs[0].ufbfh << 2);
baxter> process = (struct Process *)FindTask(0);
3.
baxter> process->pr_ConsoleTask = (APTR)handle->fh_Type;
baxter> x = 0;
baxter> }
baxter> else /* running under CLI */
[...]
baxter> Which replaces the similar code from Lattice umain.c.
baxter> This works fine on my A500, and has no problem when later I use:
baxter> Execute("failat >Nil: <Nil: 20 \n mount >Nil: <Nil: plt:",0,0);
baxter> However, on the A3000, under 1.3 or 2.0, it crashes.
I don't know about the cli part of your startup code, but clearly
in the workbench part you have an illegal memory reference:
- at point 1 you set stdin handle to zero
- at point 2 handle is set to (zero << 2) which is a null pointer.
- at point 3 you try to get pr_ConsoleTask from null filehandle
[ (struct FileHandle * 0)->fh_Type; ] !!
++Tero