alan@hal.larc.nasa.gov (alan dare) (06/20/91)
Irix'ers, I have been looking at some of the "REACT" features and the demo program in section 14 volume II of the Iris-4D Programmers Guide. The program pins the signal handler into memory. Seems like a good idea. To find the length of the signal handling function the following is done during pinning: mpin((char *)catcher, (int)pinmem - (int)catcher); In the source code pinmem() is directly after catcher(). Thus, the size of the function is found. I would like to pin my signal handler in memory, but I have some questions about finding the function length. If i'm using O3 optimization or a Power compiler I think the locations of the functions could be changed (Correct ?). The problem could also arise if an engineer after me mods the program and changes the function location. I would like to find another solution to dynamicly determine the function length, but I don't know how. If I am off base here, please tell me what i'm missing. If not, anyone have any good ideas? Thanks -- ********************************************************************* Alan Dare | Internet : alan@hal.larc.nasa.gov NASA Langley Research Center |
blythe@sgi.com (David Blythe) (06/20/91)
In article <1991Jun19.172430.5654@news.larc.nasa.gov> alan@hal.larc.nasa.gov (alan dare) writes: > > >Irix'ers, > > I have been looking at some of the "REACT" features and the demo >program in section 14 volume II of the Iris-4D Programmers Guide. The program >pins the signal handler into memory. Seems like a good idea. To find the >length of the signal handling function the following is done during pinning: > > mpin((char *)catcher, (int)pinmem - (int)catcher); > > In the source code pinmem() is directly after catcher(). Thus, the >size of the function is found. I would like to pin my signal handler in >memory, but I have some questions about finding the function length. If i'm >using O3 optimization or a Power compiler I think the locations of the >functions could be changed (Correct ?). The problem could also arise if >an engineer after me mods the program and changes the function location. >I would like to find another solution to dynamicly determine the function >length, but I don't know how. > > If I am off base here, please tell me what i'm missing. If not, anyone >have any good ideas? Since mpin works in terms of pages and signal handlers shouldn't be *that* big, I would just make a reasonably generous guess at how big the code was and plug that in, we are talking about a couple of pages so overestimating by a page or two isn't going to hurt. Say 8096 bytes, and a comment indicating that if someone adds a lot to the signal handler to increase the size. You can also compile the signal handler in a separate .o file and use the size command to determine its real size. db