Process Enf hit
14 messages in this thread
I have a small program I run as a background process. I originally compiled it
with the registered version of Dice back in March and it worked fine with no
enforcer hits. I recompiled it with the new released version of Dice and it
now gets an enforcer hit. The problem seems to be caused by the startup
message since the program works fine if I start it from the CLI or WorkBench.
It only gets the hit when started from within another program. I'm setting
ReplyPort, Length, ArgList and ToolWindow before I PutMsg(). Can someone tell
me if I'm doing something wrong or forgettting something.
Jack,
A little more information would be helpful. Are you running
SegTracker so you can tell if the 'hit' occurs in YOUR code?
Vic, I am running SegTracker. Since I do not have a lot of experience with it,
I could be interpreting it wrong, but the Enforcer hit names the child as the
problem. But like I said before, I think, the same parent program runs fine
with a program compiled last March. I don't know if it is related, but I did
notice that when DME starts up, it to gets an Enforcer hit. I tried using
Dice's new debug utility to step through the code but I could not figure out
how to trace the child, assuming it is possible. Hope this gives you something
to help me with. Thanks, Jack
Jack,
You _should_ be able to find the offending code from the segment/offset
information given. That you cannot 'break' on it (maybe you can, I don't
know) wasn't what I was looking for. Quite often I find the problem just
knowing where it occurred.
Vic – I am almost certain the hit occurs right when the child starts. I realize
this could still be caused by the parent, but I have tried a lot of different
things and that seems to be where it occurs. I have uploaded the code under the
name of BadProc.lha. Hopefully if you, or someone else, can find the time to
take a look at it and point out what I am doing wrong. If you don't have the
time thanks for your feedback anyway. I do appreciate it. -Jack
Jack,
I have just made your upload public, so it should be visible by the morning
(Monday).
-larry
Jack,
I disassembled the code for the child process and came up with the
following snippet which may be of use:
movea.l -32758(a4),a6 (struct WBStartup *msg)
movea.l sm_ArgList(a6),a6
move.l (a6),-(a7) !! Enforcer hit: A6 = 0
bsr x14632 calls CurrentDir
addq.l #4,a7
move.l -32758(a4),-(a7) (struct WBStartup *msg)
bsr wbmain x10328
Knowing nothing of C, I fail to see how WBMAIN gets called in the source
code, or why there should be a call to CurrentDir immediately before it.
I hope though that I've helped narrow down the location of the problem.
Regards,
Shraddhan (via AP from Hertfordshire, England)
Thnaks for the effort Shraddhan. I don't know much about Assembler but the
info you supplied does give me a few ideas on where to start looking. Thanks,
Jack
Jack,
The problem is that there is no guarantee of the value of A4 when the
process starts. Further, it's not clear to me why you think the child
will get a WB message.
Vic – I'm not sure I understand your question about the child getting the WB
message. But if you are asking why I have the struct WBStartup *msg as an
argument, that is just for form. I tried it with a void *msg also but it did
not make a difference. I may be missing your question altogether so let me
know if I am. As far as the value of A4 is concerned, do you know how I go
about making sure it is set correctly? -Jack
Jack,
I notice that you are using the old CreateProc library routine. Have you
tried using the CreateNewProc routine?
When I looked at the code you uploaded, I had the impression that perhaps
DICE was at fault. Didn't you say that the code used to work?
As far as the value of A4 is concerned in the code fragment I posted, this
should have been set by the DICE initialisation code in the program.
As far as I remember, the enforcer hit was due to the fact that you did
not have a valid directory to CD to when the child process was launched.
Or, the WBStartup message didn't include a valid directory. I don't know
why the code would even call CurrentDir immediately before executing the
code of your child process. Is there some flag that you can set which
would prevent the call to CurrentDir being included?
Regards,
Shraddhan (via AP from Hertfordshire, England)
Shraddhan, I am using CreateProc on purpose since I want the resultant code to
be both 1.3 and 2.0 compatible. And yes, I am using Dice. As far as
preventing the call to currentdir is concerned, if there is a way to prevent it
I don't know it. Thanks for still looking into it. Jack
Jack,
Dunno how to do it with DICE. There is a GetA4() function in SAS.