<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
On 11-08-04 08:18 AM, Jim Ianelli wrote:<br>
<br>
<br>
You might be able to find the spot as follows. The program probably
exits <br>
by calling<br>
<br>
extern "C" {<br>
void ad_boundf(int i)<br>
{<br>
// so we can stop here<br>
exit(i);<br>
}<br>
}<br>
<br>
you can create a null pointer exception here with something like<br>
<br>
void xxx(double x) {}<br>
<br>
<br>
extern "C" {<br>
void ad_boundf(int i)<br>
{<br>
// so we can stop here<br>
int * ptr=0;<br>
xxx(*ptr); // call a function so that it doesn't get
optimized out by the stupid compiler<br>
exit(i);<br>
}<br>
<br>
<br>
then it should crash there and create a core file. You can run then
run <br>
<br>
gdb tm corefile<br>
<br>
and do a stack strace. It appears that a check for crap either at
the beginning or end<br>
of the program name should first check to see if the name is longer
than say 2 characters.<br>
<br>
<br>
<br>
<br>
<blockquote cite="mid:000f01cc52b9$bd5b81e0$381285a0$@noaa.gov"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<meta name="Generator" content="Microsoft Word 14 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal">Recompiled ADMB from source code the other
day and things are working ok—except that adprogram_name seems
to be acting strangely.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">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):<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">tm <o:p></o:p></p>
<p class="MsoNormal">Error: Invalid index / used for array range
[1, 2] in "unsigned char & adstring::operator()(int i)".
Index out of bounds<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">If I run it outside with the following: <o:p></o:p></p>
<p class="MsoNormal">.\tm<o:p></o:p></p>
<p class="MsoNormal">It works.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Printing out the program name (to dig
deeper) I see that the above command (from within gdb) give:<o:p></o:p></p>
<p class="MsoNormal">C:\Users\jianelli\Desktop\fsct/tm.exe<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The classic windows vs unix slash war.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Oddly, if I switch to drive d: and run C:tm
it works fine.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">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.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Cheers,<o:p></o:p></p>
<p class="MsoNormal">Jim<o:p></o:p></p>
</div>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Developers@admb-project.org">Developers@admb-project.org</a>
<a class="moz-txt-link-freetext" href="http://lists.admb-project.org/mailman/listinfo/developers">http://lists.admb-project.org/mailman/listinfo/developers</a>
</pre>
</blockquote>
<br>
</body>
</html>