From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Thread: fa528,b4663bd38bccab9c,start X-Google-Attributes: gidfa528,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!l41g2000cwc.googlegroups.com!not-for-mail From: "RCX" Newsgroups: comp.unix.tru64 Subject: Instrumentation error Date: 7 Apr 2005 08:54:44 -0700 Organization: http://groups.google.com Message-ID: <1112889284.007353.52610@l41g2000cwc.googlegroups.com> NNTP-Posting-Host: 20.137.30.51 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1112889289 17758 127.0.0.1 (7 Apr 2005 15:54:49 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 7 Apr 2005 15:54:49 +0000 (UTC) User-Agent: G2/0.2 Complaints-To: groups-abuse@google.com Injection-Info: l41g2000cwc.googlegroups.com; posting-host=20.137.30.51; posting-account=y42J_gwAAACe6RMtbSSBIRMTjZjB_4m5 Xref: g2news1.google.com comp.unix.tru64:654 I am new to Compaq's Atom tools and am trying to get familiar with them. I have taken one of the example programs and added some code to see if I can understand the process. By taking the "ptrace" example program: // ptrace.inst.c #include #include static const char * SafeProcName(Proc *); Instrument(int argc, char **argv, Obj *obj) { Proc *p; AddCallProto("ProcTrace(char *)"); for (p = GetFirstObjProc(obj); p != NULL; p = GetNextProc(p)) { AddCallProc(p,ProcBefore,"ProcTrace",SafeProcName(p)); } } static const char *SafeProcName(Proc *p) { const char * name; static char buf[128]; name = ProcName(p); if (name) return(name); sprintf(buf, "proc_at_0x%lx", ProcPC(p)); return(buf); } // ptrace.anal.c #include #include void ProcTrace(char *name) { fprintf(stderr,"%s\n",name); } ...and adding a few lines of code in order to get a sense of what the Atom program is doing: // ptrace2.inst.c #include #include static const char* SafeProcName(Proc*); Instrument(int argc, char* argv[], Obj* obj) { Proc* p; AddCallProto("ProcTraceB(char*)"); AddCallProto("ProcTraceA(char*)"); for (p = GetFirstObjProc(obj); p != NULL; p = GetNextProc(p)) { AddCallProc(p, ProcBefore, "ProcTraceB", SafeProcName(p)); AddCallProc(p, ProcAfter, "ProcTraceA", SafeProcName(p)); } } static const char* SafeProcName(Proc* p) { const char* name; static char buf[128]; name = ProcName(p); if (name) { return(name); } sprintf(buf, "proc_at_0x%lx", ProcPC(p)); return(buf); } // ptrace2.anal.c #include #include void ProcTraceB(char* name) { fprintf(stderr,"Entering '%s'\n", name); } void ProcTraceA(char* name) { fprintf(stderr,"Leaving '%s'\n", name); } When I run the modified files against a VERY basic "Hello World" application, the resulting executable is much larger than the original and it produces the expected output. When I run the modified instrumentation files against a production application, I get an executable that is one third the size of the original and I receive an error message that states, "atom: Warning: Branch instruction overflowed. Executable may not work." Admittedly, the production application is huge. When compiled with debugging turned on, the executable is 44 Meg in size. It is also a threaded application which my "Hello World" application is not. Other than the few lines of code that I added to the instrumentation and analysis files, I also changed the code structure to conform to our coding standards. (I changed it back to see if that would make any difference and it did not.) The original "ptrace" example program runs against the production application without warnings or errors. It produces gigabytes of output. My ultimate goal is to further modify the instrumentation file using Atom's "GetProcInfo()" method to only output the local procedure names (GetProcInfo(p, ProcSymRes) != SYMRESEXTERN), but I can't even begin to attempt that until I get the simpler version working. Any help in getting a better understanding of why I'm getting a warning message would be appreciated. OS: OSF1 OS version: Tru64 V5.1B Command line: $> atom prog1 ptrace2.inst.c ptrace2.anal.c -L../libs BTW - I have read through "Program Analysis Using Atom Tools" without getting any information as to what might be happening.