Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

atom(1)

libst_intro(3)

st_addr_to_file(3)

st_file_lang(3)

st_obj_file_start(3)

st_obj_open(3)

st_objlist_append(3)

st_proc_addr(3)

st_sym_value(3)

st_obj_calls(3)  —  Subroutines

NAME

st_is_obj_call_shared, st_is_obj_shared, st_is_obj_stripped, st_obj_name, st_obj_text_start, st_obj_text_size, st_obj_data_start, st_obj_data_size, st_obj_bss_start, st_obj_bss_size, st_obj_mem_addr − General calls for accessing information about an object file. 

LIBRARY

Symbol Table and Object File Access Library (libst.a)

SYNOPSIS

#include <st.h>

st_status_t st_is_obj_call_shared (
        st_obj_t ∗obj,
        st_bool_t ∗cs);

st_status_t st_is_obj_shared (
        st_obj_t ∗obj,
        st_bool_t ∗shared);

st_status_t st_is_obj_stripped (
        st_obj_t ∗obj,
        st_bool_t ∗stripped);

st_status_t st_obj_name (
        st_obj_t ∗obj,
        char ∗∗name);

st_status_t st_obj_text_start (
        st_obj_t ∗obj,
        st_addr_t ∗text);

st_status_t st_obj_text_size (
        st_obj_t ∗obj,
        unsigned long ∗tsize);

st_status_t st_obj_data_start (
        st_obj_t ∗obj,
        st_addr_t ∗data);

st_status_t st_obj_data_size (
        st_obj_t ∗obj,
        unsigned long ∗dsize);

st_status_t st_obj_bss_start (
        st_obj_t ∗obj,
        st_addr_t ∗bss);

st_status_t st_obj_bss_size (
        st_obj_t ∗obj,
        unsigned long ∗bsize);

st_status_t st_obj_mem_addr (
        st_obj_t ∗obj,
        st_addr_t file_addr,
        st_addr_t ∗mem_addr);

PARAMETERS

objSpecifies an object handle, as returned by the st_obj_open function. 

csSpecifies the address to which st_is_obj_call_shared returns a Boolean value of TRUE if the specified object is call-shared or FALSE if it is a nonshared or shared library. 

sharedSpecifies the address to which st_is_obj_shared returns a Boolean value of TRUE if the specified object is a shared library (that is, a file with an .so suffix) or FALSE if it is a call-shared or nonshared object. 

strippedSpecifies the address to which st_is_obj_stripped returns a Boolean value of TRUE  if the symbol table has been stripped from the specified object. 

nameSpecifies the address to which st_obj_name returns a pointer to the null-terminated string of the object name specified in a prior st_obj_open call for the specified object. 

textSpecifies the address to which st_obj_text_start returns the starting address of the object’s text segment as it would reside in memory when the object is executing. 

tsizeSpecifies the address to which st_obj_text_size returns the size of the specified object’s text segment. 

dataSpecifies the address to which st_obj_data_start returns the starting address of the specified object’s data segment as it would reside in memory when the object is executing. 

dsizeSpecifies the address to which st_obj_data_size returns the size of the specified object’s data segment. 

bssSpecifies the address to which st_obj_bss_start returns the starting address of the specified object’s bss segment as it would reside in memory when the object is executing. 

bsizeSpecifies the address to which st_obj_bss_size returns size of the specified object’s bss segment. 

file_addrSpecifies an address in the specified object file.  st_obj_mem_addr translates this address to the equivalent address in memory to which libst has read the file. 

mem_addrSpecifies the address to which st_obj_mem_addr writes the address to which libst has read the file indicated by file_addr. 

DESCRIPTION

These routines return information about an object. 

st_is_obj_call_shared and st_is_obj_shared
Determine whether the specified object is a call-shared object, a nonshared object, or a shared library.

st_is_obj_stripped
Determines whether the symbol table has been stripped from the specified object.

st_obj_name
Returns the null-terminated string that was specified as the object’s name in a prior call to st_obj_open for the specified object. 

st_obj_text_start
Returns the starting address of the specified object’s text segment as it would reside in memory when the object is executing.  You can use the st_obj_mem_addr function to translate text addresses for the executable to the address in memory to which libst has loaded a copy of the file. 

st_obj_text_size
Returns the size of the specified object’s text segment.

st_obj_data_size
Returns the size of the specified object’s data segment.

st_obj_data_start
Returns the starting address of the specified object’s data segment as it would reside in memory when the object is executing.  You can use the st_obj_mem_addr function to translate data addresses for the executable to the address in memory to which libst has loaded a copy of the file. 

st_obj_bss_start
Returns the starting address of the specified object’s bss segment as it would reside in memory when the object is executing.  Because no space is allocated in the on-disk object file for the bss segment, you cannot translate the bss segment addresses using st_obj_mem_addr as you can use the function to translate text and data addresses. 

st_obj_bss_size
Returns the size that the specified object’s bss segment would have in the executing object.

st_obj_mem_addr
Translates an address from the specified object file to the equivalent address in memory to which libst has read the file.  You can then access the text and initialized data segments of a program.  You cannot access the bss segments and heap because the object is not executing. 

RETURN VALUES

All functions indicate success by returning a value of 0 (zero).  A positive return value is an errno value from a system call.  A negative return value is a library error or informational code.  The library codes are documented in st.h. 

Return parameters are set to 0 or −1 when an error occurs. Address parameters are set to 0 while file and procedure handles are set to −1.  An exception to this is if a NULL pointer for the object or other return parameter is input.  In these cases, the return parameters will be unchanged.  A non-zero return status is the recommended method for detecting an error return from a libst function. 

FILES

/usr/include/st.h
header file that contains all definitions and function prototypes for libst.a functions

RELATED INFORMATION

Commands: atom(1)

Functions: libst_intro(3), st_addr_to_file(3), st_file_lang(3), st_obj_file_start(3), st_obj_open(3), st_objlist_append(3), st_proc_addr(3), st_sym_value(3)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026