public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: optimization/3809: gcc-3.0 (release): array subscripting error (-1) in loop_p() in alias.c
@ 2002-04-02  3:00 rth
  0 siblings, 0 replies; 2+ messages in thread
From: rth @ 2002-04-02  3:00 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, jseward, nobody, v-julsew

Synopsis: gcc-3.0 (release): array subscripting error (-1) in loop_p() in alias.c

State-Changed-From-To: open->closed
State-Changed-By: rth
State-Changed-When: Tue Apr  2 03:00:24 2002
State-Changed-Why:
    Actually, the condition described can never happen legitimately;
    Index -1 is ENTRY_BLOCK, which would indicate that there is
    an edge from entry to exit that flows through no block, which
    is illegal.  So the bug is whereever created such a CFG.
    
    That said, all this has been completely rewritten for gcc 3.1.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=3809


^ permalink raw reply	[flat|nested] 2+ messages in thread

* optimization/3809: gcc-3.0 (release): array subscripting error (-1) in loop_p() in alias.c
@ 2001-07-25  1:46 jseward
  0 siblings, 0 replies; 2+ messages in thread
From: jseward @ 2001-07-25  1:46 UTC (permalink / raw)
  To: gcc-gnats; +Cc: v-julsew

>Number:         3809
>Category:       optimization
>Synopsis:       gcc-3.0 (release): array subscripting error (-1) in loop_p() in alias.c
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 25 01:46:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Julian Seward
>Release:        gcc-3.0 as released
>Organization:
>Environment:
x86 RedHat 7.1
>Description:
Arrays pre and post are xcalloc'd at the start of loop_p().
Valid indices are 0 .. n_basic_blocks-1 inclusive.

Line 2051 contains:

	  if (dest != EXIT_BLOCK_PTR
	      && pre[src->index] >= pre[dest->index]
	      && post[dest->index] == 0)
	    break;

but sometimes dest == EXIT_BLOCK_PTR and src->index == -1.

>How-To-Repeat:

Change the abovementioned conditional (alias.c:2051) to read

	  if (dest != EXIT_BLOCK_PTR) {

if (dest->index < 0 || dest->index >= n_basic_blocks)
  fprintf(stderr, "dest->index of %d out of range %d .. %d\n", 
	  dest->index, 0, n_basic_blocks-1);
if (src->index < 0 || src->index >= n_basic_blocks)
  fprintf(stderr, "src->index of %d out of range %d .. %d\n", 
	  src->index, 0, n_basic_blocks-1);

	      if (pre[src->index] >= pre[dest->index]
                  && post[dest->index] == 0)
                 break;
	}

and do

 <installation_dir>/lib/gcc-lib/i586-pc-linux-gnu/3.0/cc1 -fpreprocessed ut_symtab.i -quiet -dumpbase ut_symtab.i -version -o ut_symtab.s -O 

You should get 5 complaints identical to this:

src->index of -1 out of range 0 .. 0
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="ut_symtab.i"
Content-Disposition: inline; filename="ut_symtab.i"

# 33 "ut_symtab.c"
# 1 "ut_include.h" 1
# 37 "ut_include.h"
# 1 "/mnt/pima/jrs/gcc-3.0-20010614-Inst/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stdarg.h" 1 3
# 43 "/mnt/pima/jrs/gcc-3.0-20010614-Inst/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stdarg.h" 3
typedef __builtin_va_list __gnuc_va_list;
# 110 "/mnt/pima/jrs/gcc-3.0-20010614-Inst/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stdarg.h" 3
typedef __gnuc_va_list va_list;
# 38 "ut_include.h" 2
# 1 "/usr/include/setjmp.h" 1 3
# 26 "/usr/include/setjmp.h" 3
# 1 "/usr/include/features.h" 1 3
# 283 "/usr/include/features.h" 3
# 1 "/usr/include/sys/cdefs.h" 1 3
# 284 "/usr/include/features.h" 2 3
# 311 "/usr/include/features.h" 3
# 1 "/usr/include/gnu/stubs.h" 1 3
# 312 "/usr/include/features.h" 2 3
# 27 "/usr/include/setjmp.h" 2 3



# 1 "/usr/include/bits/setjmp.h" 1 3
# 36 "/usr/include/bits/setjmp.h" 3
typedef int __jmp_buf[6];
# 31 "/usr/include/setjmp.h" 2 3
# 1 "/usr/include/bits/sigset.h" 1 3
# 23 "/usr/include/bits/sigset.h" 3
typedef int __sig_atomic_t;




typedef struct
  {
    unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))];
  } __sigset_t;
# 32 "/usr/include/setjmp.h" 2 3


typedef struct __jmp_buf_tag
  {




    __jmp_buf __jmpbuf;
    int __mask_was_saved;
    __sigset_t __saved_mask;
  } jmp_buf[1];




extern int setjmp (jmp_buf __env) ;



extern int _setjmp (jmp_buf __env) ;




extern int __sigsetjmp (jmp_buf __env, int __savemask) ;
# 73 "/usr/include/setjmp.h" 3
extern void longjmp (jmp_buf __env, int __val)
             __attribute__ ((__noreturn__));




extern void _longjmp (jmp_buf __env, int __val)
             __attribute__ ((__noreturn__));







typedef jmp_buf sigjmp_buf;
# 98 "/usr/include/setjmp.h" 3
extern void siglongjmp (sigjmp_buf __env, int __val)
             __attribute__ ((__noreturn__));
# 39 "ut_include.h" 2







# 1 "ut_constants.h" 1
# 47 "ut_include.h" 2
# 94 "ut_include.h"
typedef unsigned char UChar;
typedef unsigned short UShort;
typedef unsigned int UInt;
typedef unsigned long long int ULong;

typedef signed char Char;
typedef signed short Short;
typedef signed int Int;
typedef signed long long int Long;

typedef unsigned int Addr;

typedef unsigned char Bool;
# 128 "ut_include.h"
extern Bool utPlain_clo_demangle;

extern Bool utPlain_clo_bad_addr_value;

extern Bool utPlain_clo_bitfield_hacks;

extern Bool utPlain_clo_leak_check;

extern Bool utPlain_clo_sloppy_malloc;

extern Bool utPlain_clo_trace_children;

extern Int utPlain_clo_logfile_fd;

extern Int utPlain_clo_freelist_vol;

extern Char* utPlain_clo_suppressions;

extern Bool utPlain_clo_single_step;

extern Bool utPlain_clo_optimise;

extern Bool utPlain_clo_instrument;

extern Bool utPlain_clo_cleanup;

extern Int utPlain_clo_smc_check;

extern Bool utPlain_clo_trace_syscalls;

extern Bool utPlain_clo_trace_signals;

extern Bool utPlain_clo_trace_symtab;

extern Bool utPlain_clo_trace_malloc;

extern ULong utPlain_clo_stop_after;

extern Int utPlain_clo_dump_error;
# 177 "ut_include.h"
typedef
   enum { Ut_UserMsg, Ut_DebugMsg, Ut_DebugExtraMsg }
   UtMsgKind;

extern void utPlain_start_msg ( UtMsgKind kind );
extern void utPlain_add_to_msg ( Char* format, ... );
extern void utPlain_end_msg ( void );


extern void utPlain_message ( UtMsgKind kind, Char* format, ... );


extern void utPlain_startup_logging ( void );
extern void utPlain_shutdown_logging ( void );
# 238 "ut_include.h"
extern void exit ( Int status );

extern void utPlain_printf ( Char *format, ... );

extern void utPlain_sprintf ( Char* buf, Char *format, ... );

extern void utPlain_vprintf ( void(*send)(Char),
                          const Char *format, va_list vargs );

extern Bool utPlain_isspace ( Char c );

extern Int utPlain_strlen ( Char* str );

extern Long utPlain_atoll ( Char* str );

extern Char* utPlain_strcat ( Char* dest, const Char* src );

extern Char* utPlain_strcpy ( Char* dest, const Char* src );

extern Int utPlain_strcmp ( const Char* s1, const Char* s2 );
extern Int utPlain_strcmp_ws ( const Char* s1, const Char* s2 );

extern Int utPlain_strncmp ( const Char* s1, const Char* s2, Int nmax );
extern Int utPlain_strncmp_ws ( const Char* s1, const Char* s2, Int nmax );

extern Char* utPlain_strstr ( Char* haystack, Char* needle );

extern Char* utPlain_getenv ( Char* name );
extern Int utPlain_getpid ( void );


extern Char utPlain_toupper ( Char c );

extern void utPlain_strncpy_safely ( Char* dest, Char* src, Int ndest );
# 283 "ut_include.h"
extern void utPlain_assert_fail ( Char* expr, Char* file, Int line, Char* fn )
            __attribute__ ((__noreturn__));



extern void* utPlain_malloc ( UInt nbytes );
extern void utPlain_free ( void* ptr );
extern void* utPlain_calloc ( UInt nmemb, UInt nbytes );
extern void* utPlain_realloc ( void* ptr, UInt size );


extern Int utPlain_open_read ( Char* pathname );
extern void utPlain_close ( Int fd );
extern Int utPlain_read ( Int fd, void* buf, Int count);
extern Int utPlain_write ( Int fd, void* buf, Int count);



extern void utPlain_panic ( Char* str )
            __attribute__ ((__noreturn__));
# 311 "ut_include.h"
typedef
   enum { TempReg=0, ArchReg, RealReg, SpillNo, Literal, NoValue }
   Tag;


typedef
   enum {
      NOP,
      GET,
      PUT,
      LOAD,
      STORE,
      MOV,
      CMOV,
      WIDEN,
      JMP,

      ADD, ADC, AND, OR, XOR, SUB, SBB,
      SHL, SHR, SAR, ROL, ROR, RCL, RCR,
      NOT, NEG, INC, DEC,
      SET,



      LEA1,
      LEA2,


      PUSH, POP, CALL, CLEAR,



      JIFZ,


      FPU_R,
      FPU_W,
      FPU,



      LDandV,
      STandV,
      GETandV,
      PUTandV,
      WIDENV,
      TESTV,
      SETV
   }
   Opcode;



typedef
   enum {
      CondO = 0,
      CondNO = 1,
      CondB = 2,
      CondNB = 3,
      CondZ = 4,
      CondNZ = 5,
      CondBE = 6,
      CondNBE = 7,
      CondS = 8,
      ConsNS = 9,
      CondP = 10,
      CondNP = 11,
      CondL = 12,
      CondNL = 13,
      CondLE = 14,
      CondNLE = 15,
      CondAlways = 16
   }
   Condcode;


typedef
   struct {
      UInt val1;
      UInt val2;
      UInt val3;

      UChar opcode;
      UChar tag1;
      UChar tag2;
      UChar tag3;

      UChar size;
      UChar cond;
      UChar extra1;


      UInt lea_const;

      Bool cc:1;
      Bool smc_check:1;
      Bool signed_widen:1;
      Bool ret_dispatch:1;
      Bool call_dispatch:1;
      Bool annul_vcheck:1;


   }
   UInstr;


typedef
   struct {
      Int used;
      Int size;
      UInstr* instrs;
      Int nextTemp;
   }
   UCodeBlock;
# 438 "ut_include.h"
extern void utPlain_demangle ( Char* orig, Char* result, Int result_size );






extern UChar* utPlain_emit_code ( UCodeBlock* cb, Int* nbytes );






extern Int utPlain_disBB ( UCodeBlock* cb, Addr eip0 );
extern Char* utPlain_nameOfIntReg ( Int size, Int reg );
extern Char utPlain_nameOfIntSize ( Int size );
extern UInt utPlain_extend_s_8to32 ( UInt x );
extern Int utPlain_getNewTemp ( UCodeBlock* cb );






extern void utPlain_translate ( Addr orig_addr,
                               UInt* orig_size,
                               Addr* trans_addr,
                               UInt* trans_size );

extern void utPlain_newUInstr1 ( UCodeBlock* cb, Opcode opcode, Int sz,
                               Tag tag1, UInt val1 );
extern void utPlain_newUInstr2 ( UCodeBlock* cb, Opcode opcode, Int sz,
                               Tag tag1, UInt val1,
                               Tag tag2, UInt val2 );
extern void utPlain_newUInstr3 ( UCodeBlock* cb, Opcode opcode, Int sz,
                               Tag tag1, UInt val1,
                               Tag tag2, UInt val2,
                               Tag tag3, UInt val3 );

extern void utPlain_ppUInstr ( Int instrNo, UInstr* u );
extern Char* utPlain_nameCondcode ( Condcode cond );
extern Bool utPlain_saneUInstr ( Bool beforeRA, UInstr* u );
extern Char* utPlain_nameUOpcode ( Bool upper, Opcode opc );
extern Int utPlain_rankToRealRegNo ( Int rank );
extern Bool utPlain_disassemble;

void* utPlain_jitmalloc ( Int nbytes );
void utPlain_jitfree ( void* ptr );






extern void utPlain_load_suppressions ( void );
extern void utPlain_show_all_errors ( void );
extern void utPlain_record_value_error ( Int size );
extern void utPlain_record_free_error ( Addr a );
extern void utPlain_record_address_error ( Addr a, Int size,
                                        Bool isWrite );
extern void utPlain_record_param_err ( Addr a,
                                    Bool isWriteLack,
                                    Char* msg );


typedef
   struct {
      Addr caller0;
      Addr caller1;
      Addr caller2;
      Addr caller3;
   }
   ExeContext;

extern Bool utPlain_eq_ExeContext ( ExeContext* e1, ExeContext* e2 );
extern void utPlain_pp_ExeContext ( ExeContext* );
extern void utPlain_set_ExeContext ( ExeContext* e, Bool skip_top_frame );


typedef
   enum { Stack, Unknown, Freed, Mallocd }
   AddrKind;


typedef
   struct {

      AddrKind akind;

      Int blksize;

      Int rwoffset;

      ExeContext lastchange;
   }
   AddrInfo;
# 547 "ut_include.h"
extern void utPlain_read_symbols ( void );
extern void utPlain_mini_stack_dump ( ExeContext* ec );
extern void utPlain_what_fn_or_object_is_this ( Addr a, Char* buf, Int nbuf );







typedef
   struct _ShadowChunk {
      struct _ShadowChunk* next;
      ExeContext where;
      UInt size;
      Addr data;
   }
   ShadowChunk;

extern void utPlain_clientmalloc_done ( void );
extern void utPlain_describe_addr ( Addr a, AddrInfo* ai );
extern ShadowChunk** utPlain_get_malloc_shadows ( UInt* n_shadows );
# 585 "ut_include.h"
extern UInt utPlain_m_state_static [8
                                 + 1
                                 + 1
                                 + ((108 +3)/4)
                                ];


extern void utPlain_copy_baseBlock_to_m_state_static ( void );
extern void utPlain_copy_m_state_static_to_baseBlock ( void );
# 603 "ut_include.h"
typedef
   struct _SegInfo {
      struct _SegInfo* next;
      Addr start;
      Addr end;
      Char* name;
   }
   SegInfo;


extern SegInfo* utPlain_seginfo;

extern void utMem_init_memory_audit ( void );
extern void utPlain_mem_sanity_check ( void );
extern Addr utMem_curr_dataseg_end;
extern void utPlain_show_reg_tags ( UInt* shadows );
extern void utPlain_detect_memory_leaks ( void );


extern void utMem_make_noaccess ( Addr a, UInt len );
extern void utMem_make_writable ( Addr a, UInt len );
extern void utMem_make_readable ( Addr a, UInt len );
extern void utMem_copy_address_range_perms ( Addr src, Addr dst, UInt len );


extern Bool utMem_check_writable ( Addr a, UInt len );
extern Bool utMem_check_readable ( Addr a, UInt len );
extern Bool utMem_check_readable_asciiz ( Addr a );



extern void utPlain_shutdown;
extern void utPlain_request_normal_exit;


extern void utPlain_helper_smc_check4;


extern void utPlain_dispatch;

extern void utPlain_helper_do_syscall;
extern void utPlain_do_syscall ( void );
extern void utPlain_dispatch_when_RET;
extern void utPlain_dispatch_when_CALL;


extern UInt utProf_cache_misses;

extern UInt utPlain_translations_done;

extern UInt utPlain_translated_bytes_in;

extern UInt utPlain_translated_bytes_out;

extern UInt utPlain_uinstrs_prealloc;

extern UInt utPlain_uinstrs_spill;

extern UInt utPlain_translations_needing_spill;

extern UInt utPlain_total_reg_rank;



extern ULong utPlain_bbs_done;

extern ULong utPlain_bbs_to_go;

extern UInt utPlain_dispatch_ctr_SAVED;
extern UInt utPlain_dispatch_ctr;
extern UInt utPlain_interrupt_reason;






extern Bool utPlain_oldmap[];

extern void utPlain_init_transtab_and_SMC ( void );
extern void utPlain_shutdown_transtab_and_SMC ( void );

extern void utPlain_run_innerloop ( void );

extern void utPlain_add_to_transtab ( Addr original_addr, Int original_size,
                                   Addr trans_addr, Int trans_size );

extern void utPlain_flush_transtab ( void );

extern void utPlain_smc_mark_original ( Addr original_addr,
                                     Int original_len );



extern void utPlain_deliver_signals ( void );
extern void utPlain_unblock_host_signal ( Int sigNo );
extern void utPlain_sigstartup_actions ( void );
extern void utPlain_sigshutdown_actions ( void );

extern UInt utPlain_interrupt_reason;


extern jmp_buf utPlain_toploop_jmpbuf;

extern Int utPlain_longjmpd_on_signal;
# 722 "ut_include.h"
extern Bool utPlain_is_plausible_stack_addr ( Addr a );
# 737 "ut_include.h"
typedef
   struct { UInt ws[2]; }
   k_sigset_t;
# 765 "ut_include.h"
struct k_sigaction {
   void* ksa_handler;
   unsigned long ksa_flags;
   void (*ksa_restorer)(void);
   k_sigset_t ksa_mask;
};


extern void utPlain_do__NR_sigaction ( void );
extern void utPlain_do__NR_sigprocmask ( Int how, k_sigset_t* set );


extern void utPlain_switch_to_real_CPU ( void );


extern Bool utPlain_running_on_simd_CPU;
# 823 "ut_include.h"
extern UInt utPlain_baseBlock[200];







extern Int utOff_m_eax;
extern Int utOff_m_ecx;
extern Int utOff_m_edx;
extern Int utOff_m_ebx;
extern Int utOff_m_esp;
extern Int utOff_m_ebp;
extern Int utOff_m_esi;
extern Int utOff_m_edi;
extern Int utOff_m_eflags;
extern Int utOff_m_fpustate;
extern Int utOff_m_eip;


extern Int utOff_spillslots;


extern Int utOff_sh_eax;
extern Int utOff_sh_ecx;
extern Int utOff_sh_edx;
extern Int utOff_sh_ebx;
extern Int utOff_sh_esp;
extern Int utOff_sh_ebp;
extern Int utOff_sh_esi;
extern Int utOff_sh_edi;
# 864 "ut_include.h"
extern Int utOff_helper_idiv_64_32;
extern Int utOff_helper_div_64_32;
extern Int utOff_helper_idiv_32_16;
extern Int utOff_helper_div_32_16;
extern Int utOff_helper_idiv_16_8;
extern Int utOff_helper_div_16_8;

extern Int utOff_helper_imul_32_64;
extern Int utOff_helper_mul_32_64;
extern Int utOff_helper_imul_16_32;
extern Int utOff_helper_mul_16_32;
extern Int utOff_helper_imul_8_16;
extern Int utOff_helper_mul_8_16;

extern Int utOff_helper_CLD;
extern Int utOff_helper_STD;
extern Int utOff_helper_get_dirflag;

extern Int utOff_helper_shldl;
extern Int utOff_helper_shldw;
extern Int utOff_helper_shrdl;
extern Int utOff_helper_shrdw;

extern Int utOff_helper_RDTSC;
extern Int utOff_helper_BSWAP;

extern Int utOff_helper_bt;
extern Int utOff_helper_bts;
extern Int utOff_helper_btr;
extern Int utOff_helper_btc;

extern Int utOff_helper_bsf;
extern Int utOff_helper_bsr;

extern Int utOff_helper_fstsw_AX;
extern Int utOff_helper_SAHF;

extern Int utOff_helper_value_check4_fail;
extern Int utOff_helper_value_check2_fail;
extern Int utOff_helper_value_check1_fail;

extern Int utOff_helper_do_syscall;

extern Int utOff_helper_LDV4_FAST_eax;
extern Int utOff_helper_LDV4_FAST_ebx;
extern Int utOff_helper_LDV4_FAST_ecx;
extern Int utOff_helper_LDV4_FAST_edx;
extern Int utOff_helper_LDV4_FAST_esi;
extern Int utOff_helper_LDV4_FAST_edi;

extern Int utOff_helper_LDV2_FAST_eax;
extern Int utOff_helper_LDV2_FAST_ebx;
extern Int utOff_helper_LDV2_FAST_ecx;
extern Int utOff_helper_LDV2_FAST_edx;
extern Int utOff_helper_LDV2_FAST_esi;
extern Int utOff_helper_LDV2_FAST_edi;

extern Int utOff_helper_LDV1_FAST_eax;
extern Int utOff_helper_LDV1_FAST_ebx;
extern Int utOff_helper_LDV1_FAST_ecx;
extern Int utOff_helper_LDV1_FAST_edx;
extern Int utOff_helper_LDV1_FAST_esi;
extern Int utOff_helper_LDV1_FAST_edi;

extern Int utOff_helperc_STV4;
extern Int utOff_helperc_STV2;
extern Int utOff_helperc_STV1;

extern Int utOff_handle_esp_assignment;
extern Int utOff_fpu_write_check;
extern Int utOff_fpu_read_check;

extern Int utOff_helper_request_normal_exit;

extern Int utOff_dispatch_when_RET;
extern Int utOff_dispatch_when_CALL;

extern Int utOff_helper_vbits_AND;
extern Int utOff_helper_vbits_OR;







extern void utMem_make_noaccess ( Addr a, UInt len );
extern void utMem_make_writable ( Addr a, UInt len );
extern void utMem_make_readable ( Addr a, UInt len );
extern void utMem_copy_address_range_perms
                                ( Addr src, Addr dst, UInt len );


extern Bool utMem_check_writable ( Addr a, UInt len );
extern Bool utMem_check_readable ( Addr a, UInt len );
extern Bool utMem_check_readable_asciiz ( Addr a );


extern UInt utPlain_helper_LDV4_FAST_eax ( Addr );
extern UInt utPlain_helper_LDV4_FAST_ebx ( Addr );
extern UInt utPlain_helper_LDV4_FAST_ecx ( Addr );
extern UInt utPlain_helper_LDV4_FAST_edx ( Addr );
extern UInt utPlain_helper_LDV4_FAST_esi ( Addr );
extern UInt utPlain_helper_LDV4_FAST_edi ( Addr );

extern UInt utPlain_helper_LDV2_FAST_eax ( Addr );
extern UInt utPlain_helper_LDV2_FAST_ebx ( Addr );
extern UInt utPlain_helper_LDV2_FAST_ecx ( Addr );
extern UInt utPlain_helper_LDV2_FAST_edx ( Addr );
extern UInt utPlain_helper_LDV2_FAST_esi ( Addr );
extern UInt utPlain_helper_LDV2_FAST_edi ( Addr );

extern UInt utPlain_helper_LDV1_FAST_eax ( Addr );
extern UInt utPlain_helper_LDV1_FAST_ebx ( Addr );
extern UInt utPlain_helper_LDV1_FAST_ecx ( Addr );
extern UInt utPlain_helper_LDV1_FAST_edx ( Addr );
extern UInt utPlain_helper_LDV1_FAST_esi ( Addr );
extern UInt utPlain_helper_LDV1_FAST_edi ( Addr );

extern void utPlain_helperc_STV4 ( UInt, Addr );
extern void utPlain_helperc_STV2 ( UInt, Addr );
extern void utPlain_helperc_STV1 ( UInt, Addr );

extern UInt utPlain_helperc_LDV1 ( Addr );
extern UInt utPlain_helperc_LDV2 ( Addr );
extern UInt utPlain_helperc_LDV4 ( Addr );

extern void utMem_handle_esp_assignment ( Addr new_espA );
extern void utMem_fpu_write_check ( Addr addr, Int size );
extern void utMem_fpu_read_check ( Addr addr, Int size );



extern void utPlain_helper_shutdown;
extern void utPlain_helper_request_normal_exit;


extern void utPlain_helper_smc_check4;


extern void utPlain_dispatch;

extern void utPlain_helper_idiv_64_32;
extern void utPlain_helper_div_64_32;
extern void utPlain_helper_idiv_32_16;
extern void utPlain_helper_div_32_16;
extern void utPlain_helper_idiv_16_8;
extern void utPlain_helper_div_16_8;

extern void utPlain_helper_imul_32_64;
extern void utPlain_helper_mul_32_64;
extern void utPlain_helper_imul_16_32;
extern void utPlain_helper_mul_16_32;
extern void utPlain_helper_imul_8_16;
extern void utPlain_helper_mul_8_16;

extern void utPlain_helper_CLD;
extern void utPlain_helper_STD;
extern void utPlain_helper_get_dirflag;

extern void utPlain_helper_shldl;
extern void utPlain_helper_shldw;
extern void utPlain_helper_shrdl;
extern void utPlain_helper_shrdw;

extern void utPlain_helper_RDTSC;
extern void utPlain_helper_BSWAP;

extern void utPlain_helper_bt;
extern void utPlain_helper_bts;
extern void utPlain_helper_btr;
extern void utPlain_helper_btc;

extern void utPlain_helper_bsf;
extern void utPlain_helper_bsr;

extern void utPlain_helper_fstsw_AX;
extern void utPlain_helper_SAHF;

extern void utPlain_helper_value_check4_fail;
extern void utPlain_helper_value_check2_fail;
extern void utPlain_helper_value_check1_fail;

extern void utPlain_helper_do_syscall;
extern void utPlain_do_syscall ( void );
extern void utPlain_dispatch_when_RET;
extern void utPlain_dispatch_when_CALL;

extern void utPlain_helper_vbits_AND;
extern void utPlain_helper_vbits_OR;
# 34 "ut_symtab.c" 2
# 1 "ut_unsafe.h" 1
# 37 "ut_unsafe.h"
# 1 "/usr/include/asm/unistd.h" 1 3
# 38 "ut_unsafe.h" 2
# 1 "/usr/include/sys/mman.h" 1 3
# 23 "/usr/include/sys/mman.h" 3
# 1 "/usr/include/features.h" 1 3
# 24 "/usr/include/sys/mman.h" 2 3
# 1 "/usr/include/bits/types.h" 1 3
# 26 "/usr/include/bits/types.h" 3
# 1 "/usr/include/features.h" 1 3
# 27 "/usr/include/bits/types.h" 2 3


# 1 "/mnt/pima/jrs/gcc-3.0-20010614-Inst/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stddef.h" 1 3
# 199 "/mnt/pima/jrs/gcc-3.0-20010614-Inst/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stddef.h" 3
typedef unsigned int size_t;
# 30 "/usr/include/bits/types.h" 2 3


typedef unsigned char __u_char;
typedef unsigned short __u_short;
typedef unsigned int __u_int;
typedef unsigned long __u_long;

__extension__ typedef unsigned long long int __u_quad_t;
__extension__ typedef long long int __quad_t;
# 49 "/usr/include/bits/types.h" 3
typedef signed char __int8_t;
typedef unsigned char __uint8_t;
typedef signed short int __int16_t;
typedef unsigned short int __uint16_t;
typedef signed int __int32_t;
typedef unsigned int __uint32_t;

__extension__ typedef signed long long int __int64_t;
__extension__ typedef unsigned long long int __uint64_t;

typedef __quad_t *__qaddr_t;

typedef __u_quad_t __dev_t;
typedef __u_int __uid_t;
typedef __u_int __gid_t;
typedef __u_long __ino_t;
typedef __u_int __mode_t;
typedef __u_int __nlink_t;
typedef long int __off_t;
typedef __quad_t __loff_t;
typedef int __pid_t;
typedef int __ssize_t;
typedef __u_long __rlim_t;
typedef __u_quad_t __rlim64_t;
typedef __u_int __id_t;

typedef struct
  {
    int __val[2];
  } __fsid_t;


typedef int __daddr_t;
typedef char *__caddr_t;
typedef long int __time_t;
typedef unsigned int __useconds_t;
typedef long int __suseconds_t;
typedef long int __swblk_t;

typedef long int __clock_t;


typedef int __clockid_t;


typedef int __timer_t;






typedef int __key_t;


typedef unsigned short int __ipc_pid_t;



typedef long int __blksize_t;




typedef long int __blkcnt_t;
typedef __quad_t __blkcnt64_t;


typedef __u_long __fsblkcnt_t;
typedef __u_quad_t __fsblkcnt64_t;


typedef __u_long __fsfilcnt_t;
typedef __u_quad_t __fsfilcnt64_t;


typedef __u_quad_t __ino64_t;


typedef __loff_t __off64_t;


typedef long int __t_scalar_t;
typedef unsigned long int __t_uscalar_t;


typedef int __intptr_t;


typedef unsigned int __socklen_t;




# 1 "/usr/include/bits/pthreadtypes.h" 1 3
# 23 "/usr/include/bits/pthreadtypes.h" 3
# 1 "/usr/include/bits/sched.h" 1 3
# 68 "/usr/include/bits/sched.h" 3
struct __sched_param
  {
    int __sched_priority;
  };
# 24 "/usr/include/bits/pthreadtypes.h" 2 3


struct _pthread_fastlock
{
  long int __status;
  int __spinlock;

};



typedef struct _pthread_descr_struct *_pthread_descr;





typedef struct __pthread_attr_s
{
  int __detachstate;
  int __schedpolicy;
  struct __sched_param __schedparam;
  int __inheritsched;
  int __scope;
  size_t __guardsize;
  int __stackaddr_set;
  void *__stackaddr;
  size_t __stacksize;
} pthread_attr_t;



typedef struct
{
  struct _pthread_fastlock __c_lock;
  _pthread_descr __c_waiting;
} pthread_cond_t;



typedef struct
{
  int __dummy;
} pthread_condattr_t;


typedef unsigned int pthread_key_t;





typedef struct
{
  int __m_reserved;
  int __m_count;
  _pthread_descr __m_owner;
  int __m_kind;
  struct _pthread_fastlock __m_lock;
} pthread_mutex_t;



typedef struct
{
  int __mutexkind;
} pthread_mutexattr_t;



typedef int pthread_once_t;
# 140 "/usr/include/bits/pthreadtypes.h" 3
typedef unsigned long int pthread_t;
# 144 "/usr/include/bits/types.h" 2 3
# 25 "/usr/include/sys/mman.h" 2 3

# 1 "/mnt/pima/jrs/gcc-3.0-20010614-Inst/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stddef.h" 1 3
# 27 "/usr/include/sys/mman.h" 2 3



typedef __off_t off_t;







typedef __mode_t mode_t;



# 1 "/usr/include/bits/mman.h" 1 3
# 43 "/usr/include/sys/mman.h" 2 3
# 58 "/usr/include/sys/mman.h" 3
extern void *mmap (void *__addr, size_t __len, int __prot,
                   int __flags, int __fd, __off_t __offset) ;
# 77 "/usr/include/sys/mman.h" 3
extern int munmap (void *__addr, size_t __len) ;




extern int mprotect (void *__addr, size_t __len, int __prot) ;




extern int msync (void *__addr, size_t __len, int __flags) ;




extern int madvise (void *__addr, size_t __len, int __advice) ;
# 101 "/usr/include/sys/mman.h" 3
extern int mlock (__const void *__addr, size_t __len) ;


extern int munlock (__const void *__addr, size_t __len) ;




extern int mlockall (int __flags) ;



extern int munlockall (void) ;





extern void *mremap (void *__addr, size_t __old_len, size_t __new_len,
                     int __may_move) ;






extern int mincore (void *__start, size_t __len, unsigned char *__vec);




extern int shm_open (__const char *__name, int __oflag, mode_t __mode);


extern int shm_unlink (__const char *__name);
# 39 "ut_unsafe.h" 2
# 1 "/usr/include/sys/utsname.h" 1 3
# 26 "/usr/include/sys/utsname.h" 3
# 1 "/usr/include/features.h" 1 3
# 27 "/usr/include/sys/utsname.h" 2 3



# 1 "/usr/include/bits/utsname.h" 1 3
# 31 "/usr/include/sys/utsname.h" 2 3






struct utsname
  {

    char sysname[65];


    char nodename[65];


    char release[65];

    char version[65];


    char machine[65];






    char __domainname[65];


  };







extern int uname (struct utsname *__name) ;
# 40 "ut_unsafe.h" 2
# 1 "/usr/include/sys/time.h" 1 3
# 22 "/usr/include/sys/time.h" 3
# 1 "/usr/include/features.h" 1 3
# 23 "/usr/include/sys/time.h" 2 3

# 1 "/usr/include/bits/types.h" 1 3
# 25 "/usr/include/sys/time.h" 2 3

# 1 "/usr/include/time.h" 1 3
# 67 "/usr/include/time.h" 3
# 1 "/usr/include/bits/types.h" 1 3
# 68 "/usr/include/time.h" 2 3


typedef __time_t time_t;
# 27 "/usr/include/sys/time.h" 2 3

# 1 "/usr/include/bits/time.h" 1 3
# 63 "/usr/include/bits/time.h" 3
# 1 "/usr/include/bits/types.h" 1 3
# 64 "/usr/include/bits/time.h" 2 3



struct timeval
  {
    __time_t tv_sec;
    __suseconds_t tv_usec;
  };
# 29 "/usr/include/sys/time.h" 2 3

# 1 "/usr/include/sys/select.h" 1 3
# 25 "/usr/include/sys/select.h" 3
# 1 "/usr/include/features.h" 1 3
# 26 "/usr/include/sys/select.h" 2 3


# 1 "/usr/include/bits/types.h" 1 3
# 29 "/usr/include/sys/select.h" 2 3


# 1 "/usr/include/bits/select.h" 1 3
# 32 "/usr/include/sys/select.h" 2 3


# 1 "/usr/include/bits/sigset.h" 1 3
# 35 "/usr/include/sys/select.h" 2 3



typedef __sigset_t sigset_t;




# 1 "/usr/include/time.h" 1 3
# 106 "/usr/include/time.h" 3
struct timespec
  {
    long int tv_sec;
    long int tv_nsec;
  };
# 44 "/usr/include/sys/select.h" 2 3

# 1 "/usr/include/bits/time.h" 1 3
# 46 "/usr/include/sys/select.h" 2 3



typedef long int __fd_mask;







typedef struct
  {






    __fd_mask __fds_bits[1024 / (8 * sizeof (__fd_mask))];


  } fd_set;






typedef __fd_mask fd_mask;
# 96 "/usr/include/sys/select.h" 3
extern int select (int __nfds, fd_set *__restrict __readfds,
                   fd_set *__restrict __writefds,
                   fd_set *__restrict __exceptfds,
                   struct timeval *__restrict __timeout) ;
# 31 "/usr/include/sys/time.h" 2 3


typedef __suseconds_t suseconds_t;
# 56 "/usr/include/sys/time.h" 3
struct timezone
  {
    int tz_minuteswest;
    int tz_dsttime;
  };

typedef struct timezone *__restrict __timezone_ptr_t;
# 72 "/usr/include/sys/time.h" 3
extern int gettimeofday (struct timeval *__restrict __tv,
                         __timezone_ptr_t __tz) ;




extern int settimeofday (__const struct timeval *__tv,
                         __const struct timezone *__tz) ;





extern int adjtime (__const struct timeval *__delta,
                    struct timeval *__olddelta) ;




enum __itimer_which
  {

    ITIMER_REAL = 0,


    ITIMER_VIRTUAL = 1,



    ITIMER_PROF = 2

  };



struct itimerval
  {

    struct timeval it_interval;

    struct timeval it_value;
  };




typedef int __itimer_which_t;




extern int getitimer (__itimer_which_t __which,
                      struct itimerval *__value) ;




extern int setitimer (__itimer_which_t __which,
                      __const struct itimerval *__restrict __new,
                      struct itimerval *__restrict __old) ;



extern int utimes (__const char *__file, __const struct timeval __tvp[2])
            ;
# 41 "ut_unsafe.h" 2
# 1 "/usr/include/linux/net.h" 1 3
# 21 "/usr/include/linux/net.h" 3
# 1 "/usr/include/linux/config.h" 1 3



# 1 "/usr/include/linux/autoconf.h" 1 3
# 1 "/usr/include/linux/rhconfig.h" 1 3
# 13 "/usr/include/linux/rhconfig.h" 3
# 1 "/boot/kernel.h" 1 3
# 14 "/usr/include/linux/rhconfig.h" 2 3
# 2 "/usr/include/linux/autoconf.h" 2 3
# 5 "/usr/include/linux/config.h" 2 3
# 22 "/usr/include/linux/net.h" 2 3
# 1 "/usr/include/linux/socket.h" 1 3
# 23 "/usr/include/linux/net.h" 2 3
# 1 "/usr/include/linux/wait.h" 1 3
# 24 "/usr/include/linux/net.h" 2 3

struct poll_table_struct;
# 49 "/usr/include/linux/net.h" 3
typedef enum {
  SS_FREE = 0,
  SS_UNCONNECTED,
  SS_CONNECTING,
  SS_CONNECTED,
  SS_DISCONNECTING
} socket_state;
# 42 "ut_unsafe.h" 2
# 1 "/usr/include/sys/resource.h" 1 3
# 22 "/usr/include/sys/resource.h" 3
# 1 "/usr/include/features.h" 1 3
# 23 "/usr/include/sys/resource.h" 2 3


# 1 "/usr/include/bits/resource.h" 1 3
# 24 "/usr/include/bits/resource.h" 3
# 1 "/usr/include/bits/types.h" 1 3
# 25 "/usr/include/bits/resource.h" 2 3







enum __rlimit_resource
{

  RLIMIT_CPU = 0,



  RLIMIT_FSIZE = 1,



  RLIMIT_DATA = 2,



  RLIMIT_STACK = 3,



  RLIMIT_CORE = 4,






  RLIMIT_RSS = 5,



  RLIMIT_NOFILE = 7,
  RLIMIT_OFILE = RLIMIT_NOFILE,




  RLIMIT_AS = 9,



  RLIMIT_NPROC = 6,



  RLIMIT_MEMLOCK = 8,



  RLIMIT_LOCKS = 10,


  RLIMIT_NLIMITS = 11,
  RLIM_NLIMITS = RLIMIT_NLIMITS


};
# 107 "/usr/include/bits/resource.h" 3
typedef __rlim_t rlim_t;







struct rlimit
  {

    rlim_t rlim_cur;

    rlim_t rlim_max;
  };
# 134 "/usr/include/bits/resource.h" 3
enum __rusage_who
{

  RUSAGE_SELF = 0,



  RUSAGE_CHILDREN = -1,



  RUSAGE_BOTH = -2

};


# 1 "/usr/include/bits/time.h" 1 3
# 151 "/usr/include/bits/resource.h" 2 3


struct rusage
  {

    struct timeval ru_utime;

    struct timeval ru_stime;

    long int ru_maxrss;


    long int ru_ixrss;

    long int ru_idrss;

    long int ru_isrss;


    long int ru_minflt;

    long int ru_majflt;

    long int ru_nswap;


    long int ru_inblock;

    long int ru_oublock;

    long int ru_msgsnd;

    long int ru_msgrcv;

    long int ru_nsignals;



    long int ru_nvcsw;


    long int ru_nivcsw;
  };







enum __priority_which
{
  PRIO_PROCESS = 0,

  PRIO_PGRP = 1,

  PRIO_USER = 2

};
# 26 "/usr/include/sys/resource.h" 2 3


typedef __id_t id_t;
# 43 "/usr/include/sys/resource.h" 3
typedef int __rlimit_resource_t;
typedef int __rusage_who_t;
typedef int __priority_which_t;





extern int getrlimit (__rlimit_resource_t __resource,
                      struct rlimit *__rlimits) ;
# 71 "/usr/include/sys/resource.h" 3
extern int setrlimit (__rlimit_resource_t __resource,
                      __const struct rlimit *__rlimits) ;
# 89 "/usr/include/sys/resource.h" 3
extern int getrusage (__rusage_who_t __who, struct rusage *__usage) ;





extern int getpriority (__priority_which_t __which, id_t __who) ;



extern int setpriority (__priority_which_t __which, id_t __who, int __prio)
            ;
# 43 "ut_unsafe.h" 2


# 1 "/usr/include/sys/stat.h" 1 3
# 26 "/usr/include/sys/stat.h" 3
# 1 "/usr/include/features.h" 1 3
# 27 "/usr/include/sys/stat.h" 2 3

# 1 "/usr/include/bits/types.h" 1 3
# 29 "/usr/include/sys/stat.h" 2 3
# 98 "/usr/include/sys/stat.h" 3
# 1 "/usr/include/bits/stat.h" 1 3
# 36 "/usr/include/bits/stat.h" 3
struct stat
  {
    __dev_t st_dev;
    unsigned short int __pad1;

    __ino_t st_ino;



    __mode_t st_mode;
    __nlink_t st_nlink;
    __uid_t st_uid;
    __gid_t st_gid;
    __dev_t st_rdev;
    unsigned short int __pad2;

    __off_t st_size;



    __blksize_t st_blksize;


    __blkcnt_t st_blocks;



    __time_t st_atime;
    unsigned long int __unused1;
    __time_t st_mtime;
    unsigned long int __unused2;
    __time_t st_ctime;
    unsigned long int __unused3;

    unsigned long int __unused4;
    unsigned long int __unused5;



  };


struct stat64
  {
    __dev_t st_dev;
    unsigned int __pad1;

    __ino_t __st_ino;
    __mode_t st_mode;
    __nlink_t st_nlink;
    __uid_t st_uid;
    __gid_t st_gid;
    __dev_t st_rdev;
    unsigned int __pad2;
    __off64_t st_size;
    __blksize_t st_blksize;

    __blkcnt64_t st_blocks;
    __time_t st_atime;
    unsigned long int __unused1;
    __time_t st_mtime;
    unsigned long int __unused2;
    __time_t st_ctime;
    unsigned long int __unused3;
    __ino64_t st_ino;
  };
# 99 "/usr/include/sys/stat.h" 2 3
# 200 "/usr/include/sys/stat.h" 3
extern int stat (__const char *__restrict __file,
                 struct stat *__restrict __buf) ;



extern int fstat (int __fd, struct stat *__buf) ;
# 219 "/usr/include/sys/stat.h" 3
extern int stat64 (__const char *__restrict __file,
                   struct stat64 *__restrict __buf) ;
extern int fstat64 (int __fd, struct stat64 *__buf) ;






extern int lstat (__const char *__restrict __file,
                  struct stat *__restrict __buf) ;
# 241 "/usr/include/sys/stat.h" 3
extern int lstat64 (__const char *__restrict __file,
                    struct stat64 *__restrict __buf) ;






extern int chmod (__const char *__file, __mode_t __mode) ;



extern int fchmod (int __fd, __mode_t __mode) ;





extern __mode_t umask (__mode_t __mask) ;
# 268 "/usr/include/sys/stat.h" 3
extern int mkdir (__const char *__path, __mode_t __mode) ;





extern int mknod (__const char *__path, __mode_t __mode, __dev_t __dev)
            ;




extern int mkfifo (__const char *__path, __mode_t __mode) ;
# 306 "/usr/include/sys/stat.h" 3
extern int __fxstat (int __ver, int __fildes, struct stat *__stat_buf) ;
extern int __xstat (int __ver, __const char *__filename,
                    struct stat *__stat_buf) ;
extern int __lxstat (int __ver, __const char *__filename,
                     struct stat *__stat_buf) ;
# 330 "/usr/include/sys/stat.h" 3
extern int __fxstat64 (int __ver, int __fildes, struct stat64 *__stat_buf)
            ;
extern int __xstat64 (int __ver, __const char *__filename,
                      struct stat64 *__stat_buf) ;
extern int __lxstat64 (int __ver, __const char *__filename,
                       struct stat64 *__stat_buf) ;

extern int __xmknod (int __ver, __const char *__path, __mode_t __mode,
                     __dev_t *__dev) ;




extern __inline__ int stat (__const char *__path,
                            struct stat *__statbuf)
{
  return __xstat (3, __path, __statbuf);
}


extern __inline__ int lstat (__const char *__path,
                             struct stat *__statbuf)
{
  return __lxstat (3, __path, __statbuf);
}


extern __inline__ int fstat (int __fd, struct stat *__statbuf)
{
  return __fxstat (3, __fd, __statbuf);
}


extern __inline__ int mknod (__const char *__path, __mode_t __mode,
                             __dev_t __dev)
{
  return __xmknod (1, __path, __mode, &__dev);
}





extern __inline__ int stat64 (__const char *__path,
                              struct stat64 *__statbuf)
{
  return __xstat64 (3, __path, __statbuf);
}


extern __inline__ int lstat64 (__const char *__path,
                               struct stat64 *__statbuf)
{
  return __lxstat64 (3, __path, __statbuf);
}


extern __inline__ int fstat64 (int __fd, struct stat64 *__statbuf)
{
  return __fxstat64 (3, __fd, __statbuf);
}
# 46 "ut_unsafe.h" 2


# 1 "/usr/include/asm/ioctls.h" 1 3



# 1 "/usr/include/asm/ioctl.h" 1 3
# 5 "/usr/include/asm/ioctls.h" 2 3
# 49 "ut_unsafe.h" 2

# 1 "/usr/include/termios.h" 1 3
# 26 "/usr/include/termios.h" 3
# 1 "/usr/include/features.h" 1 3
# 27 "/usr/include/termios.h" 2 3
# 40 "/usr/include/termios.h" 3
# 1 "/usr/include/bits/termios.h" 1 3
# 24 "/usr/include/bits/termios.h" 3
typedef unsigned char cc_t;
typedef unsigned int speed_t;
typedef unsigned int tcflag_t;


struct termios
  {
    tcflag_t c_iflag;
    tcflag_t c_oflag;
    tcflag_t c_cflag;
    tcflag_t c_lflag;
    cc_t c_line;
    cc_t c_cc[32];
    speed_t c_ispeed;
    speed_t c_ospeed;
  };
# 41 "/usr/include/termios.h" 2 3
# 49 "/usr/include/termios.h" 3
extern speed_t cfgetospeed (__const struct termios *__termios_p) ;


extern speed_t cfgetispeed (__const struct termios *__termios_p) ;


extern int cfsetospeed (struct termios *__termios_p, speed_t __speed) ;


extern int cfsetispeed (struct termios *__termios_p, speed_t __speed) ;



extern int cfsetspeed (struct termios *__termios_p, speed_t __speed) ;




extern int tcgetattr (int __fd, struct termios *__termios_p) ;



extern int tcsetattr (int __fd, int __optional_actions,
                      __const struct termios *__termios_p) ;




extern void cfmakeraw (struct termios *__termios_p) ;



extern int tcsendbreak (int __fd, int __duration) ;


extern int tcdrain (int __fd) ;



extern int tcflush (int __fd, int __queue_selector) ;



extern int tcflow (int __fd, int __action) ;
# 102 "/usr/include/termios.h" 3
# 1 "/usr/include/sys/ttydefaults.h" 1 3
# 103 "/usr/include/termios.h" 2 3
# 51 "ut_unsafe.h" 2
# 1 "/usr/include/pty.h" 1 3
# 23 "/usr/include/pty.h" 3
# 1 "/usr/include/features.h" 1 3
# 24 "/usr/include/pty.h" 2 3

# 1 "/usr/include/termios.h" 1 3
# 26 "/usr/include/pty.h" 2 3
# 1 "/usr/include/sys/ioctl.h" 1 3
# 22 "/usr/include/sys/ioctl.h" 3
# 1 "/usr/include/features.h" 1 3
# 23 "/usr/include/sys/ioctl.h" 2 3




# 1 "/usr/include/bits/ioctls.h" 1 3
# 24 "/usr/include/bits/ioctls.h" 3
# 1 "/usr/include/asm/ioctls.h" 1 3
# 25 "/usr/include/bits/ioctls.h" 2 3
# 28 "/usr/include/sys/ioctl.h" 2 3


# 1 "/usr/include/bits/ioctl-types.h" 1 3
# 25 "/usr/include/bits/ioctl-types.h" 3
# 1 "/usr/include/asm/ioctls.h" 1 3
# 26 "/usr/include/bits/ioctl-types.h" 2 3


struct winsize
  {
    unsigned short int ws_row;
    unsigned short int ws_col;
    unsigned short int ws_xpixel;
    unsigned short int ws_ypixel;
  };


struct termio
  {
    unsigned short int c_iflag;
    unsigned short int c_oflag;
    unsigned short int c_cflag;
    unsigned short int c_lflag;
    unsigned char c_line;
    unsigned char c_cc[8];
};
# 31 "/usr/include/sys/ioctl.h" 2 3






# 1 "/usr/include/sys/ttydefaults.h" 1 3
# 38 "/usr/include/sys/ioctl.h" 2 3




extern int ioctl (int __fd, unsigned long int __request, ...) ;
# 27 "/usr/include/pty.h" 2 3







extern int openpty (int *__amaster, int *__aslave, char *__name,
                    struct termios *__termp, struct winsize *__winp) ;



extern int forkpty (int *__amaster, char *__name,
                    struct termios *__termp, struct winsize *__winp) ;
# 52 "ut_unsafe.h" 2


# 1 "/usr/include/sys/uio.h" 1 3
# 22 "/usr/include/sys/uio.h" 3
# 1 "/usr/include/features.h" 1 3
# 23 "/usr/include/sys/uio.h" 2 3

# 1 "/usr/include/sys/types.h" 1 3
# 26 "/usr/include/sys/types.h" 3
# 1 "/usr/include/features.h" 1 3
# 27 "/usr/include/sys/types.h" 2 3



# 1 "/usr/include/bits/types.h" 1 3
# 31 "/usr/include/sys/types.h" 2 3


typedef __u_char u_char;
typedef __u_short u_short;
typedef __u_int u_int;
typedef __u_long u_long;
typedef __quad_t quad_t;
typedef __u_quad_t u_quad_t;
typedef __fsid_t fsid_t;


typedef __loff_t loff_t;



typedef __ino_t ino_t;
# 58 "/usr/include/sys/types.h" 3
typedef __dev_t dev_t;




typedef __gid_t gid_t;
# 73 "/usr/include/sys/types.h" 3
typedef __nlink_t nlink_t;




typedef __uid_t uid_t;
# 96 "/usr/include/sys/types.h" 3
typedef __pid_t pid_t;
# 106 "/usr/include/sys/types.h" 3
typedef __ssize_t ssize_t;




typedef __daddr_t daddr_t;
typedef __caddr_t caddr_t;



typedef __key_t key_t;
# 126 "/usr/include/sys/types.h" 3
# 1 "/usr/include/time.h" 1 3
# 79 "/usr/include/time.h" 3
# 1 "/usr/include/bits/types.h" 1 3
# 80 "/usr/include/time.h" 2 3


typedef __clockid_t clockid_t;
# 91 "/usr/include/time.h" 3
# 1 "/usr/include/bits/types.h" 1 3
# 92 "/usr/include/time.h" 2 3


typedef __timer_t timer_t;
# 127 "/usr/include/sys/types.h" 2 3
# 140 "/usr/include/sys/types.h" 3
# 1 "/mnt/pima/jrs/gcc-3.0-20010614-Inst/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stddef.h" 1 3
# 141 "/usr/include/sys/types.h" 2 3



typedef unsigned long int ulong;
typedef unsigned short int ushort;
typedef unsigned int uint;
# 184 "/usr/include/sys/types.h" 3
typedef int int8_t __attribute__ ((__mode__ (__QI__)));
typedef int int16_t __attribute__ ((__mode__ (__HI__)));
typedef int int32_t __attribute__ ((__mode__ (__SI__)));
typedef int int64_t __attribute__ ((__mode__ (__DI__)));


typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__)));
typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__)));
typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__)));
typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__)));

typedef int register_t __attribute__ ((__mode__ (__word__)));
# 206 "/usr/include/sys/types.h" 3
# 1 "/usr/include/endian.h" 1 3
# 22 "/usr/include/endian.h" 3
# 1 "/usr/include/features.h" 1 3
# 23 "/usr/include/endian.h" 2 3
# 37 "/usr/include/endian.h" 3
# 1 "/usr/include/bits/endian.h" 1 3
# 38 "/usr/include/endian.h" 2 3
# 207 "/usr/include/sys/types.h" 2 3


# 1 "/usr/include/sys/select.h" 1 3
# 210 "/usr/include/sys/types.h" 2 3


# 1 "/usr/include/sys/sysmacros.h" 1 3
# 213 "/usr/include/sys/types.h" 2 3
# 224 "/usr/include/sys/types.h" 3
typedef __blkcnt_t blkcnt_t;



typedef __fsblkcnt_t fsblkcnt_t;



typedef __fsfilcnt_t fsfilcnt_t;
# 25 "/usr/include/sys/uio.h" 2 3




# 1 "/usr/include/bits/uio.h" 1 3
# 24 "/usr/include/bits/uio.h" 3
# 1 "/usr/include/sys/types.h" 1 3
# 25 "/usr/include/bits/uio.h" 2 3
# 42 "/usr/include/bits/uio.h" 3
struct iovec
  {
    void *iov_base;
    size_t iov_len;
  };
# 30 "/usr/include/sys/uio.h" 2 3







extern ssize_t readv (int __fd, __const struct iovec *__vector, int __count)
            ;






extern ssize_t writev (int __fd, __const struct iovec *__vector, int __count)
            ;
# 55 "ut_unsafe.h" 2


# 1 "/usr/include/utime.h" 1 3
# 26 "/usr/include/utime.h" 3
# 1 "/usr/include/features.h" 1 3
# 27 "/usr/include/utime.h" 2 3



# 1 "/usr/include/bits/types.h" 1 3
# 31 "/usr/include/utime.h" 2 3







struct utimbuf
  {
    __time_t actime;
    __time_t modtime;
  };



extern int utime (__const char *__file,
                  __const struct utimbuf *__file_times) ;
# 58 "ut_unsafe.h" 2
# 1 "/usr/include/sys/times.h" 1 3
# 26 "/usr/include/sys/times.h" 3
# 1 "/usr/include/features.h" 1 3
# 27 "/usr/include/sys/times.h" 2 3


# 1 "/usr/include/time.h" 1 3
# 56 "/usr/include/time.h" 3
# 1 "/usr/include/bits/types.h" 1 3
# 57 "/usr/include/time.h" 2 3


typedef __clock_t clock_t;
# 30 "/usr/include/sys/times.h" 2 3





struct tms
  {
    clock_t tms_utime;
    clock_t tms_stime;

    clock_t tms_cutime;
    clock_t tms_cstime;
  };






extern clock_t times (struct tms *__buffer) ;
# 59 "ut_unsafe.h" 2

# 1 "/usr/include/signal.h" 1 3
# 29 "/usr/include/signal.h" 3
# 1 "/usr/include/features.h" 1 3
# 30 "/usr/include/signal.h" 2 3



# 1 "/usr/include/bits/sigset.h" 1 3
# 103 "/usr/include/bits/sigset.h" 3
extern int __sigismember (__const __sigset_t *, int);
extern int __sigaddset (__sigset_t *, int);
extern int __sigdelset (__sigset_t *, int);
# 34 "/usr/include/signal.h" 2 3






typedef __sig_atomic_t sig_atomic_t;
# 55 "/usr/include/signal.h" 3
# 1 "/usr/include/bits/types.h" 1 3
# 56 "/usr/include/signal.h" 2 3
# 1 "/usr/include/bits/signum.h" 1 3
# 57 "/usr/include/signal.h" 2 3
# 71 "/usr/include/signal.h" 3
typedef void (*__sighandler_t) (int);




extern __sighandler_t __sysv_signal (int __sig, __sighandler_t __handler)
            ;
# 87 "/usr/include/signal.h" 3
extern __sighandler_t signal (int __sig, __sighandler_t __handler) ;
# 110 "/usr/include/signal.h" 3
extern int kill (__pid_t __pid, int __sig) ;






extern int killpg (__pid_t __pgrp, int __sig) ;



extern int raise (int __sig) ;



extern __sighandler_t ssignal (int __sig, __sighandler_t __handler) ;
extern int gsignal (int __sig) ;




extern void psignal (int __sig, __const char *__s) ;
# 140 "/usr/include/signal.h" 3
extern int __sigpause (int __sig_or_mask, int __is_sig) ;




extern int sigpause (int __mask) ;
# 168 "/usr/include/signal.h" 3
extern int sigblock (int __mask) ;


extern int sigsetmask (int __mask) ;


extern int siggetmask (void) ;
# 188 "/usr/include/signal.h" 3
typedef __sighandler_t sig_t;







# 1 "/usr/include/time.h" 1 3
# 197 "/usr/include/signal.h" 2 3


# 1 "/usr/include/bits/siginfo.h" 1 3
# 25 "/usr/include/bits/siginfo.h" 3
# 1 "/usr/include/bits/wordsize.h" 1 3
# 26 "/usr/include/bits/siginfo.h" 2 3







typedef union sigval
  {
    int sival_int;
    void *sival_ptr;
  } sigval_t;
# 51 "/usr/include/bits/siginfo.h" 3
typedef struct siginfo
  {
    int si_signo;
    int si_errno;

    int si_code;

    union
      {
        int _pad[((128 / sizeof (int)) - 3)];


        struct
          {
            __pid_t si_pid;
            __uid_t si_uid;
          } _kill;


        struct
          {
            unsigned int _timer1;
            unsigned int _timer2;
          } _timer;


        struct
          {
            __pid_t si_pid;
            __uid_t si_uid;
            sigval_t si_sigval;
          } _rt;


        struct
          {
            __pid_t si_pid;
            __uid_t si_uid;
            int si_status;
            __clock_t si_utime;
            __clock_t si_stime;
          } _sigchld;


        struct
          {
            void *si_addr;
          } _sigfault;


        struct
          {
            long int si_band;
            int si_fd;
          } _sigpoll;
      } _sifields;
  } siginfo_t;
# 128 "/usr/include/bits/siginfo.h" 3
enum
{
  SI_ASYNCNL = -6,

  SI_SIGIO,

  SI_ASYNCIO,

  SI_MESGQ,

  SI_TIMER,

  SI_QUEUE,

  SI_USER,

  SI_KERNEL = 0x80

};



enum
{
  ILL_ILLOPC = 1,

  ILL_ILLOPN,

  ILL_ILLADR,

  ILL_ILLTRP,

  ILL_PRVOPC,

  ILL_PRVREG,

  ILL_COPROC,

  ILL_BADSTK

};


enum
{
  FPE_INTDIV = 1,

  FPE_INTOVF,

  FPE_FLTDIV,

  FPE_FLTOVF,

  FPE_FLTUND,

  FPE_FLTRES,

  FPE_FLTINV,

  FPE_FLTSUB

};


enum
{
  SEGV_MAPERR = 1,

  SEGV_ACCERR

};


enum
{
  BUS_ADRALN = 1,

  BUS_ADRERR,

  BUS_OBJERR

};


enum
{
  TRAP_BRKPT = 1,

  TRAP_TRACE

};


enum
{
  CLD_EXITED = 1,

  CLD_KILLED,

  CLD_DUMPED,

  CLD_TRAPPED,

  CLD_STOPPED,

  CLD_CONTINUED

};


enum
{
  POLL_IN = 1,

  POLL_OUT,

  POLL_MSG,

  POLL_ERR,

  POLL_PRI,

  POLL_HUP

};
# 271 "/usr/include/bits/siginfo.h" 3
struct __pthread_attr_s;

typedef struct sigevent
  {
    sigval_t sigev_value;
    int sigev_signo;
    int sigev_notify;

    union
      {
        int _pad[((64 / sizeof (int)) - 3)];

        struct
          {
            void (*_function) (sigval_t);
            struct __pthread_attr_s *_attribute;
          } _sigev_thread;
      } _sigev_un;
  } sigevent_t;






enum
{
  SIGEV_SIGNAL = 0,

  SIGEV_NONE,

  SIGEV_THREAD

};
# 200 "/usr/include/signal.h" 2 3



extern int sigemptyset (sigset_t *__set) ;


extern int sigfillset (sigset_t *__set) ;


extern int sigaddset (sigset_t *__set, int __signo) ;


extern int sigdelset (sigset_t *__set, int __signo) ;


extern int sigismember (__const sigset_t *__set, int __signo) ;
# 232 "/usr/include/signal.h" 3
# 1 "/usr/include/bits/sigaction.h" 1 3
# 25 "/usr/include/bits/sigaction.h" 3
struct sigaction
  {


    union
      {

        __sighandler_t sa_handler;

        void (*sa_sigaction) (int, siginfo_t *, void *);
      }
    __sigaction_handler;







    __sigset_t sa_mask;


    int sa_flags;


    void (*sa_restorer) (void);
  };
# 233 "/usr/include/signal.h" 2 3


extern int sigprocmask (int __how, __const sigset_t *__restrict __set,
                        sigset_t *__restrict __oset) ;



extern int sigsuspend (__const sigset_t *__set) ;


extern int sigaction (int __sig, __const struct sigaction *__restrict __act,
                      struct sigaction *__restrict __oact) ;


extern int sigpending (sigset_t *__set) ;



extern int sigwait (__const sigset_t *__restrict __set, int *__restrict __sig)
            ;



extern int sigwaitinfo (__const sigset_t *__restrict __set,
                        siginfo_t *__restrict __info) ;



extern int sigtimedwait (__const sigset_t *__restrict __set,
                         siginfo_t *__restrict __info,
                         __const struct timespec *__restrict __timeout)
            ;



extern int sigqueue (__pid_t __pid, int __sig, __const union sigval __val)
            ;
# 278 "/usr/include/signal.h" 3
extern __const char *__const _sys_siglist[64];
extern __const char *__const sys_siglist[64];


struct sigvec
  {
    __sighandler_t sv_handler;
    int sv_mask;

    int sv_flags;

  };
# 302 "/usr/include/signal.h" 3
extern int sigvec (int __sig, __const struct sigvec *__vec,
                   struct sigvec *__ovec) ;



# 1 "/usr/include/bits/sigcontext.h" 1 3
# 28 "/usr/include/bits/sigcontext.h" 3
# 1 "/usr/include/asm/sigcontext.h" 1 3
# 18 "/usr/include/asm/sigcontext.h" 3
struct _fpreg {
        unsigned short significand[4];
        unsigned short exponent;
};

struct _fpxreg {
        unsigned short significand[4];
        unsigned short exponent;
        unsigned short padding[3];
};

struct _xmmreg {
        unsigned long element[4];
};

struct _fpstate {

        unsigned long cw;
        unsigned long sw;
        unsigned long tag;
        unsigned long ipoff;
        unsigned long cssel;
        unsigned long dataoff;
        unsigned long datasel;
        struct _fpreg _st[8];
        unsigned short status;
        unsigned short magic;


        unsigned long _fxsr_env[6];
        unsigned long mxcsr;
        unsigned long reserved;
        struct _fpxreg _fxsr_st[8];
        struct _xmmreg _xmm[8];
        unsigned long padding[56];
};



struct sigcontext {
        unsigned short gs, __gsh;
        unsigned short fs, __fsh;
        unsigned short es, __esh;
        unsigned short ds, __dsh;
        unsigned long edi;
        unsigned long esi;
        unsigned long ebp;
        unsigned long esp;
        unsigned long ebx;
        unsigned long edx;
        unsigned long ecx;
        unsigned long eax;
        unsigned long trapno;
        unsigned long err;
        unsigned long eip;
        unsigned short cs, __csh;
        unsigned long eflags;
        unsigned long esp_at_signal;
        unsigned short ss, __ssh;
        struct _fpstate * fpstate;
        unsigned long oldmask;
        unsigned long cr2;
};
# 29 "/usr/include/bits/sigcontext.h" 2 3
# 308 "/usr/include/signal.h" 2 3


extern int sigreturn (struct sigcontext *__scp) ;
# 320 "/usr/include/signal.h" 3
extern int siginterrupt (int __sig, int __interrupt) ;

# 1 "/usr/include/bits/sigstack.h" 1 3
# 26 "/usr/include/bits/sigstack.h" 3
struct sigstack
  {
    void *ss_sp;
    int ss_onstack;
  };



enum
{
  SS_ONSTACK = 1,

  SS_DISABLE

};
# 50 "/usr/include/bits/sigstack.h" 3
typedef struct sigaltstack
  {
    void *ss_sp;
    int ss_flags;
    size_t ss_size;
  } stack_t;
# 323 "/usr/include/signal.h" 2 3







extern int sigstack (struct sigstack *__ss, struct sigstack *__oss) ;



extern int sigaltstack (__const struct sigaltstack *__restrict __ss,
                        struct sigaltstack *__restrict __oss) ;
# 358 "/usr/include/signal.h" 3
# 1 "/usr/include/bits/sigthread.h" 1 3
# 31 "/usr/include/bits/sigthread.h" 3
extern int pthread_sigmask (int __how,
                            __const __sigset_t *__restrict __newmask,
                            __sigset_t *__restrict __oldmask);


extern int pthread_kill (pthread_t __thread, int __signo) ;
# 359 "/usr/include/signal.h" 2 3






extern int __libc_current_sigrtmin (void) ;

extern int __libc_current_sigrtmax (void) ;
# 61 "ut_unsafe.h" 2


# 1 "/usr/include/sys/types.h" 1 3
# 64 "ut_unsafe.h" 2

# 1 "/usr/include/sys/statfs.h" 1 3
# 23 "/usr/include/sys/statfs.h" 3
# 1 "/usr/include/features.h" 1 3
# 24 "/usr/include/sys/statfs.h" 2 3


# 1 "/usr/include/bits/statfs.h" 1 3
# 23 "/usr/include/bits/statfs.h" 3
# 1 "/usr/include/bits/types.h" 1 3
# 24 "/usr/include/bits/statfs.h" 2 3

struct statfs
  {
    int f_type;
    int f_bsize;

    __fsblkcnt_t f_blocks;
    __fsblkcnt_t f_bfree;
    __fsblkcnt_t f_bavail;
    __fsfilcnt_t f_files;
    __fsfilcnt_t f_ffree;







    __fsid_t f_fsid;
    int f_namelen;
    int f_spare[6];
  };
# 27 "/usr/include/sys/statfs.h" 2 3





extern int statfs (__const char *__file, struct statfs *__buf) ;
# 49 "/usr/include/sys/statfs.h" 3
extern int fstatfs (int __fildes, struct statfs *__buf) ;
# 66 "ut_unsafe.h" 2

# 1 "/usr/include/sys/sysinfo.h" 1 3
# 22 "/usr/include/sys/sysinfo.h" 3
# 1 "/usr/include/features.h" 1 3
# 23 "/usr/include/sys/sysinfo.h" 2 3


# 1 "/usr/include/linux/kernel.h" 1 3
# 115 "/usr/include/linux/kernel.h" 3
struct sysinfo {
        long uptime;
        unsigned long loads[3];
        unsigned long totalram;
        unsigned long freeram;
        unsigned long sharedram;
        unsigned long bufferram;
        unsigned long totalswap;
        unsigned long freeswap;
        unsigned short procs;
        unsigned long totalhigh;
        unsigned long freehigh;
        unsigned int mem_unit;
        char _f[20-2*sizeof(long)-sizeof(int)];
};
# 26 "/usr/include/sys/sysinfo.h" 2 3




extern int sysinfo (struct sysinfo *__info) ;



extern int get_nprocs_conf (void) ;


extern int get_nprocs (void) ;



extern long int get_phys_pages (void) ;


extern long int get_avphys_pages (void) ;
# 68 "ut_unsafe.h" 2

# 1 "/usr/include/sys/poll.h" 1 3
# 23 "/usr/include/sys/poll.h" 3
# 1 "/usr/include/features.h" 1 3
# 24 "/usr/include/sys/poll.h" 2 3


# 1 "/usr/include/bits/poll.h" 1 3
# 27 "/usr/include/sys/poll.h" 2 3



typedef unsigned long int nfds_t;


struct pollfd
  {
    int fd;
    short int events;
    short int revents;
  };
# 48 "/usr/include/sys/poll.h" 3
extern int poll (struct pollfd *__fds, nfds_t __nfds, int __timeout) ;
# 70 "ut_unsafe.h" 2
# 35 "ut_symtab.c" 2

# 1 "/usr/include/link.h" 1 3
# 24 "/usr/include/link.h" 3
# 1 "/usr/include/features.h" 1 3
# 25 "/usr/include/link.h" 2 3
# 1 "/usr/include/elf.h" 1 3
# 23 "/usr/include/elf.h" 3
# 1 "/usr/include/features.h" 1 3
# 24 "/usr/include/elf.h" 2 3





# 1 "/usr/include/stdint.h" 1 3
# 26 "/usr/include/stdint.h" 3
# 1 "/usr/include/features.h" 1 3
# 27 "/usr/include/stdint.h" 2 3

# 1 "/mnt/pima/jrs/gcc-3.0-20010614-Inst/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stddef.h" 1 3
# 287 "/mnt/pima/jrs/gcc-3.0-20010614-Inst/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stddef.h" 3
typedef long int wchar_t;
# 29 "/usr/include/stdint.h" 2 3
# 1 "/usr/include/bits/wchar.h" 1 3
# 30 "/usr/include/stdint.h" 2 3
# 1 "/usr/include/bits/wordsize.h" 1 3
# 31 "/usr/include/stdint.h" 2 3
# 51 "/usr/include/stdint.h" 3
typedef unsigned char uint8_t;
typedef unsigned short int uint16_t;

typedef unsigned int uint32_t;





__extension__
typedef unsigned long long int uint64_t;






typedef signed char int_least8_t;
typedef short int int_least16_t;
typedef int int_least32_t;



__extension__
typedef long long int int_least64_t;



typedef unsigned char uint_least8_t;
typedef unsigned short int uint_least16_t;
typedef unsigned int uint_least32_t;



__extension__
typedef unsigned long long int uint_least64_t;






typedef signed char int_fast8_t;





typedef int int_fast16_t;
typedef int int_fast32_t;
__extension__
typedef long long int int_fast64_t;



typedef unsigned char uint_fast8_t;





typedef unsigned int uint_fast16_t;
typedef unsigned int uint_fast32_t;
__extension__
typedef unsigned long long int uint_fast64_t;
# 128 "/usr/include/stdint.h" 3
typedef int intptr_t;


typedef unsigned int uintptr_t;
# 140 "/usr/include/stdint.h" 3
__extension__
typedef long long int intmax_t;
__extension__
typedef unsigned long long int uintmax_t;
# 30 "/usr/include/elf.h" 2 3


typedef uint16_t Elf32_Half;
typedef uint16_t Elf64_Half;


typedef uint32_t Elf32_Word;
typedef int32_t Elf32_Sword;
typedef uint32_t Elf64_Word;
typedef int32_t Elf64_Sword;


typedef uint64_t Elf32_Xword;
typedef int64_t Elf32_Sxword;
typedef uint64_t Elf64_Xword;
typedef int64_t Elf64_Sxword;


typedef uint32_t Elf32_Addr;
typedef uint64_t Elf64_Addr;


typedef uint32_t Elf32_Off;
typedef uint64_t Elf64_Off;


typedef uint16_t Elf32_Section;
typedef uint16_t Elf64_Section;


typedef Elf32_Half Elf32_Versym;
typedef Elf64_Half Elf64_Versym;






typedef struct
{
  unsigned char e_ident[(16)];
  Elf32_Half e_type;
  Elf32_Half e_machine;
  Elf32_Word e_version;
  Elf32_Addr e_entry;
  Elf32_Off e_phoff;
  Elf32_Off e_shoff;
  Elf32_Word e_flags;
  Elf32_Half e_ehsize;
  Elf32_Half e_phentsize;
  Elf32_Half e_phnum;
  Elf32_Half e_shentsize;
  Elf32_Half e_shnum;
  Elf32_Half e_shstrndx;
} Elf32_Ehdr;

typedef struct
{
  unsigned char e_ident[(16)];
  Elf64_Half e_type;
  Elf64_Half e_machine;
  Elf64_Word e_version;
  Elf64_Addr e_entry;
  Elf64_Off e_phoff;
  Elf64_Off e_shoff;
  Elf64_Word e_flags;
  Elf64_Half e_ehsize;
  Elf64_Half e_phentsize;
  Elf64_Half e_phnum;
  Elf64_Half e_shentsize;
  Elf64_Half e_shnum;
  Elf64_Half e_shstrndx;
} Elf64_Ehdr;
# 254 "/usr/include/elf.h" 3
typedef struct
{
  Elf32_Word sh_name;
  Elf32_Word sh_type;
  Elf32_Word sh_flags;
  Elf32_Addr sh_addr;
  Elf32_Off sh_offset;
  Elf32_Word sh_size;
  Elf32_Word sh_link;
  Elf32_Word sh_info;
  Elf32_Word sh_addralign;
  Elf32_Word sh_entsize;
} Elf32_Shdr;

typedef struct
{
  Elf64_Word sh_name;
  Elf64_Word sh_type;
  Elf64_Xword sh_flags;
  Elf64_Addr sh_addr;
  Elf64_Off sh_offset;
  Elf64_Xword sh_size;
  Elf64_Word sh_link;
  Elf64_Word sh_info;
  Elf64_Xword sh_addralign;
  Elf64_Xword sh_entsize;
} Elf64_Shdr;
# 350 "/usr/include/elf.h" 3
typedef struct
{
  Elf32_Word st_name;
  Elf32_Addr st_value;
  Elf32_Word st_size;
  unsigned char st_info;
  unsigned char st_other;
  Elf32_Section st_shndx;
} Elf32_Sym;

typedef struct
{
  Elf64_Word st_name;
  unsigned char st_info;
  unsigned char st_other;
  Elf64_Section st_shndx;
  Elf64_Addr st_value;
  Elf64_Xword st_size;
} Elf64_Sym;




typedef struct
{
  Elf32_Half si_boundto;
  Elf32_Half si_flags;
} Elf32_Syminfo;

typedef struct
{
  Elf64_Half si_boundto;
  Elf64_Half si_flags;
} Elf64_Syminfo;
# 466 "/usr/include/elf.h" 3
typedef struct
{
  Elf32_Addr r_offset;
  Elf32_Word r_info;
} Elf32_Rel;






typedef struct
{
  Elf64_Addr r_offset;
  Elf64_Xword r_info;
} Elf64_Rel;



typedef struct
{
  Elf32_Addr r_offset;
  Elf32_Word r_info;
  Elf32_Sword r_addend;
} Elf32_Rela;

typedef struct
{
  Elf64_Addr r_offset;
  Elf64_Xword r_info;
  Elf64_Sxword r_addend;
} Elf64_Rela;
# 511 "/usr/include/elf.h" 3
typedef struct
{
  Elf32_Word p_type;
  Elf32_Off p_offset;
  Elf32_Addr p_vaddr;
  Elf32_Addr p_paddr;
  Elf32_Word p_filesz;
  Elf32_Word p_memsz;
  Elf32_Word p_flags;
  Elf32_Word p_align;
} Elf32_Phdr;

typedef struct
{
  Elf64_Word p_type;
  Elf64_Word p_flags;
  Elf64_Off p_offset;
  Elf64_Addr p_vaddr;
  Elf64_Addr p_paddr;
  Elf64_Xword p_filesz;
  Elf64_Xword p_memsz;
  Elf64_Xword p_align;
} Elf64_Phdr;
# 582 "/usr/include/elf.h" 3
typedef struct
{
  Elf32_Sword d_tag;
  union
    {
      Elf32_Word d_val;
      Elf32_Addr d_ptr;
    } d_un;
} Elf32_Dyn;

typedef struct
{
  Elf64_Sxword d_tag;
  union
    {
      Elf64_Xword d_val;
      Elf64_Addr d_ptr;
    } d_un;
} Elf64_Dyn;
# 729 "/usr/include/elf.h" 3
typedef struct
{
  Elf32_Half vd_version;
  Elf32_Half vd_flags;
  Elf32_Half vd_ndx;
  Elf32_Half vd_cnt;
  Elf32_Word vd_hash;
  Elf32_Word vd_aux;
  Elf32_Word vd_next;

} Elf32_Verdef;

typedef struct
{
  Elf64_Half vd_version;
  Elf64_Half vd_flags;
  Elf64_Half vd_ndx;
  Elf64_Half vd_cnt;
  Elf64_Word vd_hash;
  Elf64_Word vd_aux;
  Elf64_Word vd_next;

} Elf64_Verdef;
# 765 "/usr/include/elf.h" 3
typedef struct
{
  Elf32_Word vda_name;
  Elf32_Word vda_next;

} Elf32_Verdaux;

typedef struct
{
  Elf64_Word vda_name;
  Elf64_Word vda_next;

} Elf64_Verdaux;




typedef struct
{
  Elf32_Half vn_version;
  Elf32_Half vn_cnt;
  Elf32_Word vn_file;

  Elf32_Word vn_aux;
  Elf32_Word vn_next;

} Elf32_Verneed;

typedef struct
{
  Elf64_Half vn_version;
  Elf64_Half vn_cnt;
  Elf64_Word vn_file;

  Elf64_Word vn_aux;
  Elf64_Word vn_next;

} Elf64_Verneed;
# 812 "/usr/include/elf.h" 3
typedef struct
{
  Elf32_Word vna_hash;
  Elf32_Half vna_flags;
  Elf32_Half vna_other;
  Elf32_Word vna_name;
  Elf32_Word vna_next;

} Elf32_Vernaux;

typedef struct
{
  Elf64_Word vna_hash;
  Elf64_Half vna_flags;
  Elf64_Half vna_other;
  Elf64_Word vna_name;
  Elf64_Word vna_next;

} Elf64_Vernaux;
# 846 "/usr/include/elf.h" 3
typedef struct
{
  int a_type;
  union
    {
      long int a_val;
      void *a_ptr;
      void (*a_fcn) (void);
    } a_un;
} Elf32_auxv_t;

typedef struct
{
  long int a_type;
  union
    {
      long int a_val;
      void *a_ptr;
      void (*a_fcn) (void);
    } a_un;
} Elf64_auxv_t;
# 900 "/usr/include/elf.h" 3
typedef struct
{
  Elf32_Word n_namesz;
  Elf32_Word n_descsz;
  Elf32_Word n_type;
} Elf32_Nhdr;

typedef struct
{
  Elf64_Word n_namesz;
  Elf64_Word n_descsz;
  Elf64_Word n_type;
} Elf64_Nhdr;
# 947 "/usr/include/elf.h" 3
typedef struct
{
  Elf32_Xword m_value;
  Elf32_Word m_info;
  Elf32_Word m_poffset;
  Elf32_Half m_repeat;
  Elf32_Half m_stride;
} Elf32_Move;

typedef struct
{
  Elf64_Xword m_value;
  Elf64_Xword m_info;
  Elf64_Xword m_poffset;
  Elf64_Half m_repeat;
  Elf64_Half m_stride;
} Elf64_Move;
# 1230 "/usr/include/elf.h" 3
typedef union
{
  struct
    {
      Elf32_Word gt_current_g_value;
      Elf32_Word gt_unused;
    } gt_header;
  struct
    {
      Elf32_Word gt_g_value;
      Elf32_Word gt_bytes;
    } gt_entry;
} Elf32_gptab;



typedef struct
{
  Elf32_Word ri_gprmask;
  Elf32_Word ri_cprmask[4];
  Elf32_Sword ri_gp_value;
} Elf32_RegInfo;



typedef struct
{
  unsigned char kind;

  unsigned char size;
  Elf32_Section section;

  Elf32_Word info;
} Elf_Options;
# 1306 "/usr/include/elf.h" 3
typedef struct
{
  Elf32_Word hwp_flags1;
  Elf32_Word hwp_flags2;
} Elf_Options_Hw;
# 1445 "/usr/include/elf.h" 3
typedef struct
{
  Elf32_Word l_name;
  Elf32_Word l_time_stamp;
  Elf32_Word l_checksum;
  Elf32_Word l_version;
  Elf32_Word l_flags;
} Elf32_Lib;

typedef struct
{
  Elf64_Word l_name;
  Elf64_Word l_time_stamp;
  Elf64_Word l_checksum;
  Elf64_Word l_version;
  Elf64_Word l_flags;
} Elf64_Lib;
# 1476 "/usr/include/elf.h" 3
typedef Elf32_Addr Elf32_Conflict;
# 26 "/usr/include/link.h" 2 3
# 1 "/usr/include/dlfcn.h" 1 3
# 23 "/usr/include/dlfcn.h" 3
# 1 "/usr/include/features.h" 1 3
# 24 "/usr/include/dlfcn.h" 2 3


# 1 "/usr/include/bits/dlfcn.h" 1 3
# 27 "/usr/include/dlfcn.h" 2 3
# 45 "/usr/include/dlfcn.h" 3
extern void *dlopen (__const char *__file, int __mode) ;



extern int dlclose (void *__handle) ;



extern void *dlsym (void *__restrict __handle,
                    __const char *__restrict __name) ;
# 67 "/usr/include/dlfcn.h" 3
extern char *dlerror (void) ;
# 27 "/usr/include/link.h" 2 3
# 1 "/usr/include/sys/types.h" 1 3
# 28 "/usr/include/link.h" 2 3







# 1 "/usr/include/bits/elfclass.h" 1 3
# 9 "/usr/include/bits/elfclass.h" 3
# 1 "/usr/include/bits/wordsize.h" 1 3
# 10 "/usr/include/bits/elfclass.h" 2 3




typedef uint32_t Elf_Symndx;
# 36 "/usr/include/link.h" 2 3






struct r_debug
  {
    int r_version;

    struct link_map *r_map;






    Elf32_Addr r_brk;
    enum
      {


        RT_CONSISTENT,
        RT_ADD,
        RT_DELETE
      } r_state;

    Elf32_Addr r_ldbase;
  };


extern struct r_debug _r_debug;
# 76 "/usr/include/link.h" 3
extern Elf32_Dyn _DYNAMIC[];







struct link_map
  {



    Elf32_Addr l_addr;
    char *l_name;
    Elf32_Dyn *l_ld;
    struct link_map *l_next, *l_prev;
  };
# 37 "ut_symtab.c" 2
# 1 "/usr/include/elf.h" 1 3
# 38 "ut_symtab.c" 2
# 1 "/usr/include/a.out.h" 1 3



# 1 "/mnt/pima/jrs/gcc-3.0-20010614-Inst/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/linux/a.out.h" 1 3
# 17 "/mnt/pima/jrs/gcc-3.0-20010614-Inst/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/linux/a.out.h" 3
# 1 "/usr/include/asm/a.out.h" 1 3



struct exec
{
  unsigned long a_info;
  unsigned a_text;
  unsigned a_data;
  unsigned a_bss;
  unsigned a_syms;
  unsigned a_entry;
  unsigned a_trsize;
  unsigned a_drsize;
};
# 18 "/mnt/pima/jrs/gcc-3.0-20010614-Inst/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/linux/a.out.h" 2 3




enum machine_type {



  M_OLDSUN2 = 0,




  M_68010 = 1,




  M_68020 = 2,




  M_SPARC = 3,


  M_386 = 100,
  M_MIPS1 = 151,
  M_MIPS2 = 152
};
# 140 "/mnt/pima/jrs/gcc-3.0-20010614-Inst/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/linux/a.out.h" 3
# 1 "/usr/include/asm/page.h" 1 3
# 141 "/mnt/pima/jrs/gcc-3.0-20010614-Inst/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/linux/a.out.h" 2 3
# 166 "/mnt/pima/jrs/gcc-3.0-20010614-Inst/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/linux/a.out.h" 3
struct nlist {
  union {
    char *n_name;
    struct nlist *n_next;
    long n_strx;
  } n_un;
  unsigned char n_type;
  char n_other;
  short n_desc;
  unsigned long n_value;
};
# 244 "/mnt/pima/jrs/gcc-3.0-20010614-Inst/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/linux/a.out.h" 3
struct relocation_info
{

  int r_address;

  unsigned int r_symbolnum:24;



  unsigned int r_pcrel:1;


  unsigned int r_length:2;






  unsigned int r_extern:1;







  unsigned int r_pad:4;

};
# 5 "/usr/include/a.out.h" 2 3
# 39 "ut_symtab.c" 2






typedef
   struct {
      Addr addr;
      UInt size;
      Bool isdata;
      Int nmoff;
   }
   UtSym;

typedef
   struct {
      Addr addr;
      UInt size;
      UInt lineno;
      Int fnmoff;
      Bool confident;
   }
   UtLoc;
# 71 "ut_symtab.c"
typedef
   struct _UtLibInfo {
      Int libnameoff;
      Addr base_addr;
      Addr link_map;
      UInt offset;
      struct _UtLibInfo* next;
   }
   UtLibInfo;






static UtSym* ut_symtab = ((void*)0);
static UInt ut_symtab_used = 0;
static UInt ut_symtab_size = 0;


static Char* ut_strtab = ((void*)0);
static UInt ut_strtab_used = 0;
static UInt ut_strtab_size = 0;


static UtLoc* ut_loctab = ((void*)0);
static UInt ut_loctab_used = 0;
static UInt ut_loctab_size = 0;


static UtLibInfo* ut_libinfo = ((void*)0);
# 110 "ut_symtab.c"
static Int addStr ( Char* str )
{
   Char* new_tab;
   Int new_sz, i, space_needed;

   space_needed = 1 + utPlain_strlen(str);
   if (ut_strtab_used + space_needed > ut_strtab_size) {
      new_sz = 2 * ut_strtab_size;
      if (new_sz == 0) new_sz = 1000;
      new_tab = utPlain_malloc(new_sz);
      if (ut_strtab != ((void*)0)) {
         for (i = 0; i < ut_strtab_used; i++)
            new_tab[i] = ut_strtab[i];
         utPlain_free(ut_strtab);
      }
      ut_strtab = new_tab;
      ut_strtab_size = new_sz;
   }

   for (i = 0; i < space_needed; i++)
      ut_strtab[ut_strtab_used+i] = str[i];

   ut_strtab_used += space_needed;
   ((void) ((ut_strtab_used <= ut_strtab_size) ? 0 : (utPlain_assert_fail ("ut_strtab_used <= ut_strtab_size", "ut_symtab.c", 133, __PRETTY_FUNCTION__), 0)));
   return ut_strtab_used - space_needed;
}



static void addSym ( UtSym* sym )
{
   Int new_sz, i;
   UtSym* new_tab;

   if (ut_symtab_used == ut_symtab_size) {
      new_sz = 2 * ut_symtab_size;
      if (new_sz == 0) new_sz = 10;
      new_tab = utPlain_malloc(new_sz * sizeof(UtSym) );
      if (ut_symtab != ((void*)0)) {
         for (i = 0; i < ut_symtab_used; i++)
            new_tab[i] = ut_symtab[i];
         utPlain_free(ut_symtab);
      }
      ut_symtab = new_tab;
      ut_symtab_size = new_sz;
   }

   ut_symtab[ut_symtab_used] = *sym;
   ut_symtab_used++;
   ((void) ((ut_symtab_used <= ut_symtab_size) ? 0 : (utPlain_assert_fail ("ut_symtab_used <= ut_symtab_size", "ut_symtab.c", 159, __PRETTY_FUNCTION__), 0)));
}



static void addLoc ( UtLoc* sym )
{
   Int new_sz, i;
   UtLoc* new_tab;

   if (ut_loctab_used == ut_loctab_size) {
      new_sz = 2 * ut_loctab_size;
      if (new_sz == 0) new_sz = 10;
      new_tab = utPlain_malloc(new_sz * sizeof(UtLoc) );
      if (ut_loctab != ((void*)0)) {
         for (i = 0; i < ut_loctab_used; i++)
            new_tab[i] = ut_loctab[i];
         utPlain_free(ut_loctab);
      }
      ut_loctab = new_tab;
      ut_loctab_size = new_sz;
   }

   ut_loctab[ut_loctab_used] = *sym;
   ut_loctab_used++;
   ((void) ((ut_loctab_used <= ut_loctab_size) ? 0 : (utPlain_assert_fail ("ut_loctab_used <= ut_loctab_size", "ut_symtab.c", 184, __PRETTY_FUNCTION__), 0)));
}




static void pp_LibInfo ( UtLibInfo* info )
{
   utPlain_printf("base_addr %p  linkmap %p  offset %p    %s\n",
               info->base_addr, info->link_map, info->offset,
               & ut_strtab[info->libnameoff] );
}

static void addLibInfo ( UtLibInfo* libinfo )
{
   UtLibInfo* copy = utPlain_malloc( sizeof(UtLibInfo) );
   *copy = *libinfo;
   copy->next = ut_libinfo;
   ut_libinfo = copy;
   if (0) pp_LibInfo ( copy );
}







static
void ut_symerr ( Char* msg )
{
   utPlain_message(Ut_UserMsg,"%s", msg );
}



static
void printSym ( Int i )
{
   utPlain_printf( "%5d:  %8p .. %8p (%d)  %c   %s\n",
                i,
                ut_symtab[i].addr,
                ut_symtab[i].addr + ut_symtab[i].size - 1, ut_symtab[i].size,
                ut_symtab[i].isdata ? 'D' : 'F',
                &ut_strtab[ut_symtab[i].nmoff] );
}





static
void sortSymtab ( void )
{
   Int incs[14] = { 1, 4, 13, 40, 121, 364, 1093, 3280,
                      9841, 29524, 88573, 265720,
                      797161, 2391484 };
   Int lo = 0;
   Int hi = ut_symtab_used-1;
   Int i, j, h, bigN, hp;
   UtSym v;
   Int n_merged;

   bigN = hi - lo + 1; if (bigN < 2) return;
   hp = 0; while (incs[hp] < bigN) hp++; hp--;

   for (; hp >= 0; hp--) {
      h = incs[hp];
      i = lo + h;
      while (1) {
         if (i > hi) break;
         v = ut_symtab[i];
         j = i;
         while (ut_symtab[j-h].addr > v.addr) {
            ut_symtab[j] = ut_symtab[j-h];
            j = j - h;
            if (j <= (lo + h - 1)) break;
         }
         ut_symtab[j] = v;
         i++;
      }
   }




   do {
      n_merged = 0;
      j = ut_symtab_used;
      ut_symtab_used = 0;
      for (i = 0; i < j; i++) {
         if (i < j-1
             && ut_symtab[i].addr == ut_symtab[i+1].addr
             && ut_symtab[i].size == ut_symtab[i+1].size
             && ut_symtab[i].isdata == ut_symtab[i+1].isdata) {
            n_merged++;

            if (utPlain_strlen(&ut_strtab[ut_symtab[i].nmoff])
                > utPlain_strlen(&ut_strtab[ut_symtab[i+1].nmoff])) {
               ut_symtab[ut_symtab_used++] = ut_symtab[i];
            } else {
               ut_symtab[ut_symtab_used++] = ut_symtab[i+1];
            }
            i++;
         } else {
            ut_symtab[ut_symtab_used++] = ut_symtab[i];
         }
      }
      if (utPlain_clo_trace_symtab)
         utPlain_printf( "%d merged\n", n_merged);
   }
   while (n_merged > 0);


   for (i = 0; i < ut_symtab_used-1; i++) {
      ((void) ((ut_symtab[i].addr <= ut_symtab[i+1].addr) ? 0 : (utPlain_assert_fail ("ut_symtab[i].addr <= ut_symtab[i+1].addr", "ut_symtab.c", 299, __PRETTY_FUNCTION__), 0)));
      if (ut_symtab[i].addr + ut_symtab[i].size > ut_symtab[i+1].addr) {
         if (utPlain_clo_trace_symtab) {
            utPlain_printf("overlapping address ranges in symbol table\n\t");
            printSym(i);
            utPlain_printf("\t");
            printSym(i+1);
            utPlain_printf("\n");
         }
      }
   }
}


static __attribute__ ((unused))
void printSymtab ( void )
{
   Int i;
   utPlain_printf("\n------ BEGIN ut_symtab ------\n");
   for (i = 0; i < ut_symtab_used; i++)
      printSym(i);
   utPlain_printf("------ BEGIN ut_symtab ------\n");
}


static
void addLineInfo ( Int fnmoff,
                   Addr start,
                   Addr end,
                   UInt lineno,
                   Bool confident )
{
   UtLoc loc;






   loc.addr = start;
   loc.size = end - start + 1;
   loc.lineno = lineno;
   loc.fnmoff = fnmoff;
   loc.confident = confident;
   addLoc ( &loc );
}




static
void ut_read_lib_symbols ( UtLibInfo* lib_info )
{
   Elf32_Ehdr* ehdr;
   Elf32_Shdr* shdr;
   UChar* sh_strtab;
   struct nlist* stab;
   UChar* stabstr;
   Int stab_sz;
   Int stabstr_sz;
   Int fd;
   Int i;
   Bool ok;
   Addr oimage;
   Int n_oimage;
   struct stat stat_buf;


   Int curr_filenmoff;
   Addr curr_fnbaseaddr;
   Addr range_startAddr;
   Int range_lineno;

   oimage = (Addr)((void*)0);
   utPlain_message(Ut_UserMsg, "reading syms from %s",
                          &ut_strtab[lib_info->libnameoff]);

   i = stat((Char*)&ut_strtab[lib_info->libnameoff], &stat_buf);
   if (i != 0) {
      ut_symerr("Can't stat .so/.exe (to determine its size)?!");
      return;
   }
   n_oimage = stat_buf.st_size;

   fd = utPlain_open_read(&ut_strtab[lib_info->libnameoff]);
   if (fd == -1) {
      ut_symerr("Can't open .so/.exe to read symbols?!");
      return;
   }


   oimage = (Addr)mmap( ((void*)0), n_oimage, 0x1, 0x02, fd, 0 );
   if (oimage == (Addr)((void *) -1)) {
      utPlain_message(Ut_UserMsg,
                 "mmap failed on %s", &ut_strtab[lib_info->libnameoff] );
      utPlain_close(fd);
      return;
   }
# 409 "ut_symtab.c"
   utPlain_close(fd);





   ok = (n_oimage >= sizeof(Elf32_Ehdr));
   ehdr = (Elf32_Ehdr*)oimage;

   if (ok) {
      ok &= (ehdr->e_ident[0] == 0x7F
             && ehdr->e_ident[1] == 'E'
             && ehdr->e_ident[2] == 'L'
             && ehdr->e_ident[3] == 'F');
      ok &= (ehdr->e_ident[4] == 1
             && ehdr->e_ident[5] == 1
             && ehdr->e_ident[6] == 1);
      ok &= (ehdr->e_type == 2 || ehdr->e_type == 3);
      ok &= (ehdr->e_machine == 3);
      ok &= (ehdr->e_version == 1);
      ok &= (ehdr->e_shstrndx != 0);
      ok &= (ehdr->e_shoff != 0 && ehdr->e_shnum != 0);
   }

   if (!ok) {
      ut_symerr("Invalid ELF header, or missing stringtab/sectiontab.");

      munmap ( (void*)oimage, n_oimage );



      return;
   }

   if (utPlain_clo_trace_symtab)
      utPlain_printf(
          "shoff = %d,  shnum = %d,  size = %d,  n_ut_oimage = %d\n",
          ehdr->e_shoff, ehdr->e_shnum, sizeof(Elf32_Shdr), n_oimage );

   if (ehdr->e_shoff + ehdr->e_shnum*sizeof(Elf32_Shdr) > n_oimage) {
      ut_symerr("ELF section header is beyond image end?!");

      munmap ( (void*)oimage, n_oimage );



      return;
   }

   shdr = (Elf32_Shdr*)(oimage + ehdr->e_shoff);
   sh_strtab = (UChar*)(oimage + shdr[ehdr->e_shstrndx].sh_offset);


   {
      UChar* o_strtab = ((void*)0);
      Elf32_Sym* o_symtab = ((void*)0);
      UInt o_strtab_sz = 0;
      UInt o_symtab_sz = 0;

      UChar* o_got = ((void*)0);
      UChar* o_plt = ((void*)0);
      UInt o_got_sz = 0;
      UInt o_plt_sz = 0;

      Bool snaffle_it;
      Addr sym_addr;


      for (i = 0; i < ehdr->e_shnum; i++) {
         if (0 == utPlain_strcmp(".symtab",sh_strtab + shdr[i].sh_name)) {
            o_symtab = (Elf32_Sym*)(oimage + shdr[i].sh_offset);
            o_symtab_sz = shdr[i].sh_size;
            ((void) (((o_symtab_sz % sizeof(Elf32_Sym)) == 0) ? 0 : (utPlain_assert_fail ("(o_symtab_sz % sizeof(Elf32_Sym)) == 0", "ut_symtab.c", 481, __PRETTY_FUNCTION__), 0)));

         }
         if (0 == utPlain_strcmp(".strtab",sh_strtab + shdr[i].sh_name)) {
            o_strtab = (UChar*)(oimage + shdr[i].sh_offset);
            o_strtab_sz = shdr[i].sh_size;

         }




         if (0 == utPlain_strcmp(".got",sh_strtab + shdr[i].sh_name)) {
            o_got = (UChar*)(lib_info->base_addr
                                + shdr[i].sh_offset);
            o_got_sz = shdr[i].sh_size;

         }
         if (0 == utPlain_strcmp(".plt",sh_strtab + shdr[i].sh_name)) {
            o_plt = (UChar*)(lib_info->base_addr
                                + shdr[i].sh_offset);
            o_plt_sz = shdr[i].sh_size;

         }

      }

      if (utPlain_clo_trace_symtab) {
         if (o_plt) utPlain_printf( "PLT: %p .. %p\n",
                                 o_plt, o_plt + o_plt_sz - 1 );
         if (o_got) utPlain_printf( "GOT: %p .. %p\n",
                                 o_got, o_got + o_got_sz - 1 );
      }

      if (o_strtab == ((void*)0) || o_symtab == ((void*)0)) {
         ut_symerr("   object doesn't have a symbol table");
      } else {


         for (i = 1; i < o_symtab_sz/sizeof(Elf32_Sym); i++){
# 553 "ut_symtab.c"
            snaffle_it
               = ( ((((unsigned char) (o_symtab[i].st_info)) >> 4) == 1 ||
                     (((unsigned char) (o_symtab[i].st_info)) >> 4) == 0 )

                    &&
                    (((o_symtab[i].st_info) & 0xf) == 2 ||
                     ((o_symtab[i].st_info) & 0xf) == 1)
                  );




            sym_addr = lib_info->offset
                       + (UInt)o_symtab[i].st_value;
            if (o_got != ((void*)0)
                && sym_addr >= (Addr)o_got
                && sym_addr < (Addr)(o_got+o_got_sz)) {
               snaffle_it = ((Bool)0);
               if (utPlain_clo_trace_symtab) {
                  utPlain_printf( "in GOT: %s\n",
                               o_strtab+o_symtab[i].st_name);
               }
            }
            if (o_plt != ((void*)0)
                && sym_addr >= (Addr)o_plt
                && sym_addr < (Addr)(o_plt+o_plt_sz)) {
               snaffle_it = ((Bool)0);
               if (utPlain_clo_trace_symtab) {
                  utPlain_printf( "in PLT: %s\n",
                               o_strtab+o_symtab[i].st_name);
               }
            }


            if (snaffle_it
                && (o_symtab[i].st_name == (Elf32_Word)((void*)0)
                    ||

                       * ((UChar*)(o_strtab+o_symtab[i].st_name)) == 0
                    || o_symtab[i].st_size == 0)) {
               snaffle_it = ((Bool)0);
               if (utPlain_clo_trace_symtab) {
                  utPlain_printf( "size=0: %s\n",
                               o_strtab+o_symtab[i].st_name);
               }
            }
# 618 "ut_symtab.c"
            if (snaffle_it && (Int)o_symtab[i].st_value == 0) {
               snaffle_it = ((Bool)0);
               if (utPlain_clo_trace_symtab) {
                  utPlain_printf( "valu=0: %s\n",
                               o_strtab+o_symtab[i].st_name);
               }
            }

            if (snaffle_it) {

               UtSym sym;
               Char* t0 = o_symtab[i].st_name
                             ? (Char*)(o_strtab+o_symtab[i].st_name)
                             : (Char*)"NONAME";
               Int nmoff = addStr(t0);
               ((void) ((nmoff >= 0) ? 0 : (utPlain_assert_fail ("nmoff >= 0", "ut_symtab.c", 633, __PRETTY_FUNCTION__), 0)));

               ((void) (((Int)o_symtab[i].st_value >= 0) ? 0 : (utPlain_assert_fail ("(Int)o_symtab[i].st_value >= 0", "ut_symtab.c", 635, __PRETTY_FUNCTION__), 0)));


               sym.addr = sym_addr;
               sym.size = o_symtab[i].st_size;
               sym.nmoff = nmoff;
               sym.isdata
                  = (((o_symtab[i].st_info) & 0xf) == 1)
                       ? ((Bool)1) : ((Bool)0);
               addSym ( &sym );
            }
         }
      }
   }


   stabstr = ((void*)0);
   stab = ((void*)0);
   stabstr_sz = 0;
   stab_sz = 0;

   for (i = 0; i < ehdr->e_shnum; i++) {
      if (0 == utPlain_strcmp(".stab",sh_strtab + shdr[i].sh_name)) {
         stab = (struct nlist *)(oimage + shdr[i].sh_offset);
         stab_sz = shdr[i].sh_size;
      }
      if (0 == utPlain_strcmp(".stabstr",sh_strtab + shdr[i].sh_name)) {
         stabstr = (UChar*)(oimage + shdr[i].sh_offset);
         stabstr_sz = shdr[i].sh_size;
      }
   }

   if (stab == ((void*)0) || stabstr == ((void*)0)) {
      ut_symerr("   object doesn't have any debug info");

      munmap ( (void*)oimage, n_oimage );



      return;
   }

   if ( stab_sz + (UChar*)stab > n_oimage + (UChar*)oimage
        || stabstr_sz + (UChar*)stabstr
           > n_oimage + (UChar*)oimage ) {
      ut_symerr("   ELF debug data is beyond image end?!");

      munmap ( (void*)oimage, n_oimage );



      return;
   }
# 709 "ut_symtab.c"
   curr_filenmoff = addStr("???");
   curr_fnbaseaddr = (Addr)((void*)0);
   range_startAddr = 0;
   range_lineno = 0;

   for (i = 0; i < stab_sz/(int)sizeof(struct nlist); i++) {
# 725 "ut_symtab.c"
      if (stab[i].n_type == 68) {


         Addr range_endAddr
            = lib_info->offset
                 + curr_fnbaseaddr
                 + (UInt)stab[i].n_value - 1;
         if (range_startAddr != 0) {
            addLineInfo ( curr_filenmoff,
                          range_startAddr,
                          range_endAddr,
                          range_lineno,
                          ((Bool)1) );
         }
         range_startAddr = range_endAddr + 1;
         range_lineno = stab[i].n_desc;

      } else {


         Addr range_endAddr
           = (stab[i].n_type == 36 )
                ? ((Addr)stab[i].n_value) - 1
                : (Addr) ((UInt)(range_startAddr + 16) & 0xFFFFFFF0) - 1;

         if (range_startAddr != 0) {
            addLineInfo ( curr_filenmoff,
                          range_startAddr,
                          range_endAddr,
                          range_lineno,
                          ((Bool)0) );
         }
         range_startAddr = 0;


         if (stab[i].n_type == 100 ||
             stab[i].n_type == 132


            ) {
            UChar* nm = stabstr + stab[i].n_un.n_strx;
            UInt len = utPlain_strlen(nm);
            if (len > 0 && nm[len] != '/')
               curr_filenmoff = addStr(nm);
         } else
         if (stab[i].n_type == 36) {
            curr_fnbaseaddr = (Addr)stab[i].n_value;
         }
      }

   }


   munmap ( (void*)oimage, n_oimage );



}


static
void safeCopy ( UChar* dst, UInt maxlen, UChar* src )
{
   UInt i = 0, j = 0;
   while (((Bool)1)) {
      if (i >= maxlen) return;
      if (dst[i] == 0) break;
      i++;
   }
   while (((Bool)1)) {
      if (i >= maxlen) return;
      dst[i] = src[j];
      if (src[j] == 0) return;
      i++; j++;
   }
}


static __attribute__ ((unused))
void print_linkmap ( struct link_map * linkmap )
{
   utPlain_printf( "linkmap = %p\n", linkmap );
   utPlain_printf( "  l_addr   = %p\n", (char*)linkmap->l_addr );
   utPlain_printf( "  l_name   = %s\n", linkmap->l_name );
   utPlain_printf( "  l_ld     = %p\n", linkmap->l_ld );

   { Int i;
     Elf32_Dyn* dyn = (Elf32_Dyn*)(linkmap->l_ld);
     for (i = 0; dyn[i].d_tag != 0; i++)
       utPlain_printf("      [%2d]: d_tag %d   val/ptr %p (%d)\n",
                   i, (Int)dyn[i].d_tag, dyn[i].d_un, dyn[i].d_un );
   }
   utPlain_printf( "\n" );
}


void utPlain_read_symbols ( void )
{
   struct r_debug * my_r_debug = ((void*)0);
   struct link_map * my_r_linkmap = ((void*)0);
   UtLibInfo lib_info;
   UtLibInfo* lib;

   my_r_debug = & _r_debug;

   if (my_r_debug == ((void*)0)) {
      ut_symerr("Can't find DT_DEBUG entry in "
                "executable's _DYNAMIC array");
      return;
   }

   my_r_linkmap = my_r_debug->r_map;
   if (my_r_linkmap == ((void*)0)) {
      ut_symerr("NULL r_map field in executable's r_debug structure");
      return;
   }




   while (my_r_linkmap != ((void*)0)) {


      if (0 == ((UChar*)my_r_linkmap->l_name)[0]) {



         lib_info.base_addr
            = ((Addr)my_r_linkmap->l_addr) - sizeof(Elf32_Ehdr);
         lib_info.link_map = (Addr)my_r_linkmap;
         lib_info.offset = 0;
         lib_info.libnameoff = addStr("/proc/self/exe");

         lib_info.base_addr = (Addr)0x8048000;
         lib_info.offset = (UInt)0;

         addLibInfo ( &lib_info );

      } else {




         Char str[100];
         UChar* p;
         UChar* lastsl;

         str[0] = 0;
         safeCopy(&str[0], 100, my_r_linkmap->l_name);
         lib_info.libnameoff = addStr(str);





         lastsl = &str[0];
         for (p = lastsl; *p; p++)
            if (*p == '/') lastsl = p+1;
         if (((Bool)1)|| utPlain_strncmp(lastsl,"utopia",8) != 0) {

            lib_info.base_addr = (Addr)my_r_linkmap->l_addr;
            lib_info.offset = (UInt)my_r_linkmap->l_addr;
            lib_info.link_map = (Addr)my_r_linkmap;
            addLibInfo ( &lib_info );





         }
      }
      my_r_linkmap = my_r_linkmap->l_next;
   }
   for (lib = ut_libinfo; lib != ((void*)0); lib = lib->next) {
      if (utPlain_clo_trace_symtab) {
         utPlain_message(Ut_UserMsg, "0x%-10x: %s",
                    lib->base_addr, &ut_strtab[lib->libnameoff]);
      }
   }
   for (lib = ut_libinfo; lib != ((void*)0); lib = lib->next) {
      ut_read_lib_symbols ( lib );
   }





   sortSymtab();
   utPlain_message(Ut_UserMsg, "loaded %d symbols, "
                          "%d line number locations",
                          ut_symtab_used, ut_loctab_used );




}







static
Bool ut_what_fn_is_this ( Bool no_demangle, Addr a,
                          Char* buf, Int nbuf )
{

   Int i;
   for (i = 0; i < ut_symtab_used; i++) {
      if (ut_symtab[i].addr - 0 <= a
          && a < ut_symtab[i].addr + ut_symtab[i].size +0) {
         if (no_demangle) {
            utPlain_strncpy_safely (
               buf, & ut_strtab[ut_symtab[i].nmoff], nbuf );
         } else {
            utPlain_demangle ( & ut_strtab[ut_symtab[i].nmoff],
                            buf, nbuf );
         }
         return ((Bool)1);
      }
   }
   return ((Bool)0);

}




static
Bool ut_what_object_is_this ( Addr a, Char* buf, Int nbuf )
{
   SegInfo* si;
   for (si = utPlain_seginfo; si != ((void*)0); si = si->next) {
      if (si->start <= a && a <= si->end) {
         utPlain_strncpy_safely(buf, si->name, nbuf);
         return ((Bool)1);
      }
   }
   return ((Bool)0);
}







void utPlain_what_fn_or_object_is_this ( Addr a, Char* buf, Int nbuf )
{
   Bool ok = ut_what_fn_is_this ( ((Bool)1), a, buf, nbuf );
   if (ok) return;
   ok = ut_what_object_is_this ( a, buf, nbuf );
   if (ok) return;
   utPlain_strncpy_safely(buf, "???", nbuf);
}





static
Bool ut_what_line_is_this ( Addr a,
                            UChar* filename, Int n_filename,
                            UInt* lineno )
{
   Int i;




   for (i = 0; i < ut_loctab_used; i++) {
      if (ut_loctab[i].addr <= a
          && a < ut_loctab[i].addr+ut_loctab[i].size
          && ut_loctab[i].confident)
         goto found_it;
   }

   for (i = 0; i < ut_loctab_used; i++) {
      if (ut_loctab[i].addr <= a
          && a < ut_loctab[i].addr+ut_loctab[i].size
          && !ut_loctab[i].confident)
         goto found_it;
   }


   return ((Bool)0);

 found_it:
   utPlain_strncpy_safely(filename, & ut_strtab[ut_loctab[i].fnmoff],
                       n_filename);
   *lineno = ut_loctab[i].lineno;
   return ((Bool)1);
}



void utPlain_mini_stack_dump ( ExeContext* ec )
{
# 1032 "ut_symtab.c"
   Bool know_fnname;
   Bool know_objname;
   Bool know_srcloc;
   UInt lineno;
   UChar ibuf[20];
   UInt i, n, clueless;

   UChar buf[96];
   UChar buf_fn[96];
   UChar buf_obj[96];
   UChar buf_srcloc[96];

   Addr callers[3] = { ec->caller1, ec->caller2, ec->caller3 };

   n = 0;

   know_fnname = ut_what_fn_is_this(((Bool)0),ec->caller0, buf_fn, 96);
   know_objname = ut_what_object_is_this(ec->caller0, buf_obj, 96);
   know_srcloc = ut_what_line_is_this(ec->caller0,
                                       buf_srcloc, 96,
                                       &lineno);

   { UChar* sss; for (sss = "   at "; n < 96 -1 && *sss != 0; n++,sss++) buf[n] = *sss; buf[n] = 0; };
   utPlain_sprintf(ibuf,"0x%x: ", ec->caller0);
   { UChar* sss; for (sss = ibuf; n < 96 -1 && *sss != 0; n++,sss++) buf[n] = *sss; buf[n] = 0; };
   if (know_fnname) {
      { UChar* sss; for (sss = buf_fn; n < 96 -1 && *sss != 0; n++,sss++) buf[n] = *sss; buf[n] = 0; }
   } else if (know_objname && !know_srcloc) {
      { UChar* sss; for (sss = "(within "; n < 96 -1 && *sss != 0; n++,sss++) buf[n] = *sss; buf[n] = 0; };
      { UChar* sss; for (sss = buf_obj; n < 96 -1 && *sss != 0; n++,sss++) buf[n] = *sss; buf[n] = 0; };
      { UChar* sss; for (sss = ")"; n < 96 -1 && *sss != 0; n++,sss++) buf[n] = *sss; buf[n] = 0; };
   } else {
      { UChar* sss; for (sss = "???"; n < 96 -1 && *sss != 0; n++,sss++) buf[n] = *sss; buf[n] = 0; };
   }
   if (know_srcloc) {
      { UChar* sss; for (sss = " ("; n < 96 -1 && *sss != 0; n++,sss++) buf[n] = *sss; buf[n] = 0; };
      { UChar* sss; for (sss = buf_srcloc; n < 96 -1 && *sss != 0; n++,sss++) buf[n] = *sss; buf[n] = 0; };
      { UChar* sss; for (sss = ":"; n < 96 -1 && *sss != 0; n++,sss++) buf[n] = *sss; buf[n] = 0; };
      utPlain_sprintf(ibuf,"%d",lineno);
      { UChar* sss; for (sss = ibuf; n < 96 -1 && *sss != 0; n++,sss++) buf[n] = *sss; buf[n] = 0; };
      { UChar* sss; for (sss = ")"; n < 96 -1 && *sss != 0; n++,sss++) buf[n] = *sss; buf[n] = 0; };
   }
   utPlain_message(Ut_UserMsg, "%s", buf);

   clueless = 0;
   for (i = 0; i < 3; i++) {
      know_fnname = ut_what_fn_is_this(((Bool)0),callers[i], buf_fn, 96);
      know_objname = ut_what_object_is_this(callers[i],buf_obj, 96);
      know_srcloc = ut_what_line_is_this(callers[i],
                                          buf_srcloc, 96,
                                          &lineno);
      n = 0;
      { UChar* sss; for (sss = "   by "; n < 96 -1 && *sss != 0; n++,sss++) buf[n] = *sss; buf[n] = 0; };
      if (callers[i] == 0) {
         { UChar* sss; for (sss = "<bogus frame pointer> "; n < 96 -1 && *sss != 0; n++,sss++) buf[n] = *sss; buf[n] = 0; };
      } else {
         utPlain_sprintf(ibuf,"0x%x: ",callers[i]);
         { UChar* sss; for (sss = ibuf; n < 96 -1 && *sss != 0; n++,sss++) buf[n] = *sss; buf[n] = 0; };
      }
      if (know_fnname) {
         { UChar* sss; for (sss = buf_fn; n < 96 -1 && *sss != 0; n++,sss++) buf[n] = *sss; buf[n] = 0; }
      } else {
         if (know_objname && !know_srcloc) {
            { UChar* sss; for (sss = "(within "; n < 96 -1 && *sss != 0; n++,sss++) buf[n] = *sss; buf[n] = 0; };
            { UChar* sss; for (sss = buf_obj; n < 96 -1 && *sss != 0; n++,sss++) buf[n] = *sss; buf[n] = 0; };
            { UChar* sss; for (sss = ")"; n < 96 -1 && *sss != 0; n++,sss++) buf[n] = *sss; buf[n] = 0; };
         } else {
            { UChar* sss; for (sss = "???"; n < 96 -1 && *sss != 0; n++,sss++) buf[n] = *sss; buf[n] = 0; };
         }
         if (!know_srcloc) clueless++;
         if (clueless == 2)
            i = 3;
      };
      if (know_srcloc) {
         { UChar* sss; for (sss = " ("; n < 96 -1 && *sss != 0; n++,sss++) buf[n] = *sss; buf[n] = 0; };
         { UChar* sss; for (sss = buf_srcloc; n < 96 -1 && *sss != 0; n++,sss++) buf[n] = *sss; buf[n] = 0; };
         { UChar* sss; for (sss = ":"; n < 96 -1 && *sss != 0; n++,sss++) buf[n] = *sss; buf[n] = 0; };
         utPlain_sprintf(ibuf,"%d",lineno);
         { UChar* sss; for (sss = ibuf; n < 96 -1 && *sss != 0; n++,sss++) buf[n] = *sss; buf[n] = 0; };
         { UChar* sss; for (sss = ")"; n < 96 -1 && *sss != 0; n++,sss++) buf[n] = *sss; buf[n] = 0; };
      }
      utPlain_message(Ut_UserMsg, "%s", buf);
   }
}


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-04-02 11:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-02  3:00 optimization/3809: gcc-3.0 (release): array subscripting error (-1) in loop_p() in alias.c rth
  -- strict thread matches above, loose matches on Subject: below --
2001-07-25  1:46 jseward

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).