[Developers] adprogram_name

dave fournier davef at otter-rsch.com
Sat Aug 6 08:15:52 PDT 2011


On 11-08-04 08:18 AM, Jim Ianelli wrote:


You might be able to find the spot as follows. The program probably exits
by calling

extern "C"  {
   void ad_boundf(int i)
   {
     // so we can stop here
     exit(i);
   }
}

you can create a null pointer exception here with something like

void xxx(double x) {}


extern "C"  {
   void ad_boundf(int i)
   {
     // so we can stop here
     int * ptr=0;
     xxx(*ptr);    // call a function so that it doesn't get optimized 
out by the stupid compiler
     exit(i);
   }


then it should crash there and create a core file.  You can run then run

            gdb tm corefile

and do a stack strace.  It appears that a check for crap either at the 
beginning or end
of the program name should first check to see if the name is longer than 
say 2 characters.




> Recompiled ADMB from source code the other day and things are working 
> ok---except that adprogram_name seems to be acting strangely.
>
> A model called "tm" (for transcendental mindlessness) that compiles 
> fine and runs from within gdb perfectly gives the following message 
> when run outside of gdb (i.e., normally):
>
> tm
>
> Error: Invalid index / used for array range [1, 2] in "unsigned char & 
> adstring::operator()(int i)". Index out of bounds
>
> If I run it outside with the following:
>
> .\tm
>
> It works.
>
> Printing out the program name (to dig deeper) I see that the above 
> command (from within gdb) give:
>
> C:\Users\jianelli\Desktop\fsct/tm.exe
>
> The classic windows vs unix slash war.
>
> Oddly, if I switch to drive d: and run C:tm it works fine.
>
> Not sure if this is something that is an easy fix but it is sure a 
> lame error that will turn people away quickly if not fixable (or maybe 
> I'm alone with this issue?)  I recall Buck Stockhausen had a similar 
> naming convention issue that changed the behavior in a recent email.
>
> Cheers,
>
> Jim
>
>
> _______________________________________________
> Developers mailing list
> Developers at admb-project.org
> http://lists.admb-project.org/mailman/listinfo/developers

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.admb-project.org/pipermail/developers/attachments/20110806/50765cf3/attachment.html>


More information about the Developers mailing list