I was trying to set an IF slip given a csect name in an NFS module.  Since 
these modules are now program objects I was not getting the right offset from 
the beginning of the load module. The offsets listed in AMBLIST for the csects 
are not from the beginning of the load module.  

  Binder level 2 stepped into my PMR and made the following comments. Maybe 
this stuff is obvious to everyone else but I thought I'd post it just in case. 
Also note the comments at the bottom that since the format of program objects 
is not publicized even the methods documented here are subject to change.  He 
states the only method of getting the real offsets is from a compiler listing.  
Not much of a chance of a customer ever seeing those these days.


Mark

Excerpt from a PMR:


The issue here seems to have resulted because of differences between    
Load Modules and Program Objects. In Program Objects, unlike legacy Load
Modules, there can be many sections. Some sections contain code, some   
data, some meta information. Each of these sections is displayed        
separately in AMBLIST output.                                           
                                                                        
The primary purpose of LISTLOAD XREF output is to map cross references  
between Program Objects, and not locate offsets for certain code within 
the entire Program Object. We usually recommend Compiler listings with  
the OFFSET=NO parameter to force the compiler not to generate function  
offsets (aka OFFSET=YES) but instead use the offset column to list      
offsets from the beginning of the module.                               
                                                                        
With that said, AMBLIST LISTLOAD XREF output can get you the data you   
need, but it works differently than you'd expect.                       
                                                                        
To obtain the full offset from the beginning of the Object to the Symbol
at issue, you need to add the lengths of all Sections before the one    
containing your symbol, and then the offset to that symbol.             
                                                                        
For example from your output:                                           
The first section (class) is B_TEXT. At the very bottom of this Class is
the following line:                                                     
0      CLASS LENGTH             8377                                    
0---------------------------------------------------------------------- 
                                                                        
Followed by the next class C_Code which happens to contain your symbol. 
This is where the count starts over because offsets are only *within*   
each section. Your symbol is at offset D868.                            
                                                                        
Adding the two together will get the offset you desire (which you've    
already noticed). If you wish to locate other symbols in later class    
sections, you will need to add each preceeding class length together.   
                                                                        
It should be noted that this is not always completely guaranteed. In the
case above, the first element in class C_CODE is aligned on a Double    
Word Boundry. Luckily 8388 is such a boundry. Were it not, you would    
have to take that into account as well.                                 
                                                                        
Also important to note is that the format specification of a Program    
Object is not publicized. This data and the manner of determining it    
could change at any point in the future. The only officially sanctioned 
method of determining offsets within an entire Program Object (and not  
within each class) is to use the Compiler option listed above to        
generate an offset listing.                                             
                                                                        
I'm sorry for any confusion this may have caused. Hopefully this        
clarifies the situation. If there is any other way binder/amblist can   
assist, please don't hesitate to contact me.                            
                                                                        
--Mike Young                                                            
Binder Level 2     

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to