HP3000-L Archives

November 2000, Week 3

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
"Emerson, Tom # El Monte" <[log in to unmask]>
Reply To:
Emerson, Tom # El Monte
Date:
Mon, 20 Nov 2000 17:49:35 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (218 lines)
I'm encountering a strange problem calling the system intrinsic HPCIGETVAR
from within a "C" program compiled with the gnu gcc compiler [2.95.2]  The
program is aborting from within the SYSTEM code, not my user code, so it
makes it difficult to debug "as a user"...

The following output shows the error -- the same code runs fine when
compiled via HP's C compiler, so I know the code is (basically) OK.  [see
the very end of the output]  I suspect I'm missing one or two
not-obvious-to-me things, like a particular "gcc" flag, so perhaps I need to
bury me head in the documentation [if someone we be so kind as to point me
to the proper chapter...]

One thing I did notice in the web-based documentation is that, so far as gcc
is concerned, "#pragma intrinsic" isn't a valid pre-processor statement (the
preprocessor simply ignores the line), so I'm curious -- is there a more
appropriate mechanism in gcc to specify HP intrinsics?  This would be
especially useful for things like FOPEN, where a number of parameters are
typically "omitted"...

=========
This code fails when compiled w/gcc 2.95.2:

 2:25 PM [WORK.EMERSON] (2):setdump
 2:25 PM [WORK.EMERSON] (3):sh
########################################################################

               MPE/iX Shell and Utilities (A.50.02)
    COPYRIGHT (c) Hewlett-Packard Company 1992, All Rights Reserved.

########################################################################


R:[/EMERSON/WORK]> env | grep HPSYSNAME
HPSYSNAME=RAVEN
R:[/EMERSON/WORK]> cat psysidx.c
#pragma intrinsic HPCIGETVAR

/***** procedure to get system id from 'HPSYSNAME var ****/
char Sys_Id_Code(void)
{
    int status=0;
    /* broken down as:
       short info;  (i.e., status >> 16)
       short subsys; ( status & 0xff)
    */
    int strlen;
    char _ret='Z';
    char varvalu[32]="";
    char varname[]="HPSYSNAME  ";

    strlen = 32;

    HPCIGETVAR(varname,&status,
        10,&strlen,
         2, varvalu,
         0, 0);

    if (status == 0)
        _ret = varvalu[0];
    return(_ret);
}
/*********  end of psysid ************/

int main(int argc, char *argv[])
{
    printf("The system name starts with %c\n",Sys_Id_Code());
}
R:[/EMERSON/WORK]> gcc -v -o psysidx psysidx.c
Reading specs from /usr/local/lib/gcc-lib/hppa1.0-hp-mpeix/2.95.2/specs
gcc version 2.95.2 19991024 (release)
 /usr/local/lib/gcc-lib/hppa1.0-hp-mpeix/2.95.2/cpp -lang-c -v -D__GNUC__=2
-D__
GNUC_MINOR__=95 -Dhppa -D__hppa__ -D__hppa -Asystem(mpeix) -Acpu(hppa)
-Amachine
(hppa) -Dhp3000s900 -D__hp3000s900 -Dmpeix -DMPEXL -DREVARGV -D_MPEXL_SOURCE
-D_
MPEIX_SOURCE -D__STDC_EXT__ psysidx.c /usr/tmp/ccKJ5cIc.i
GNU CPP version 2.95.2 19991024 (release) (hppa - MPE A.02.01 Threaded)
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include

/usr/local/lib/gcc-lib/hppa1.0-hp-mpeix/2.95.2/../../../../hppa1.0-hp-mpeix/
inc
lude
 /usr/local/lib/gcc-lib/hppa1.0-hp-mpeix/2.95.2/include
 /usr/include
End of search list.
The following default directories have been omitted from the search path:
 /usr/local/lib/gcc-lib/hppa1.0-hp-mpeix/2.95.2/../../../../include/g++-3
End of omitted list.
 /usr/local/lib/gcc-lib/hppa1.0-hp-mpeix/2.95.2/cc1 /usr/tmp/ccKJ5cIc.i
-quiet -
dumpbase psysidx.c -version -o /usr/tmp/ccop3TMh.s
GNU C version 2.95.2 19991024 (release) (hppa1.0-hp-mpeix) compiled by GNU C
ver
sion 2.95.2 19991024 (release).
 /usr/local/hppa1.0-hp-mpeix/bin/as -o /usr/tmp/cc6a3eop.o
/usr/tmp/ccop3TMh.s
 /usr/local/lib/gcc-lib/hppa1.0-hp-mpeix/2.95.2/collect2 -o psysidx
-L/usr/local
/lib/gcc-lib/hppa1.0-hp-mpeix/2.95.2 -L/usr/local/lib /usr/tmp/cc6a3eop.o
-lgcc
-lc -lgcc
R:[/EMERSON/WORK]> ./psysidx
**** Escape executed outside of TRY block; CODE = E03200A6 (UNWIND 9).

ABORT: /EMERSON/WORK/psysidx
       PC=a.00ab24e8 dbg_stackdump_cmds+$28
NM* 0) SP=41846648 RP=a.005352a8 trap_handler.handle_setdump+$f4
NM  1) SP=418465c8 RP=a.00536784 trap_handler+$3ec
NM  2) SP=41846548 RP=a.00235894 subsystem_abort_handler+$28
NM  3) SP=41845ec8 RP=a.00235838 ?subsystem_abort_handler+$8
         export stub: a.001f54d8 U_PRINT_ERR+$2c0
NM  4) SP=41845e88 RP=a.001f331c U_nonlocal_escape+$dc
NM  5) SP=41845cb8 RP=a.00e80714 HPCIGETVAR+$300
NM  6) SP=41845bb8 RP=a.00e803e0 ?HPCIGETVAR+$8
         export stub: 34c.00009c90 Sys_Id_Code+$b0
NM  7) SP=418452f8 RP=34c.00009d08 main+$28
Can't unwind.  Error reading a value from virtual memory.  (error #1902)
Can't get next stack frame.  Can't trace any further.  (error #1914)

R0 =00000000 c010aa60 00ab24e8 41845d48 R4 =00000000 00000000 00000000
00000001
R8 =00000000 00000003 84022c00 800208b0 R12=800208b0 00000080 00000000
00000000
R16=418439b0 00000080 000042ac 84022c00 R20=0000000a 0000000a c01075a0
00000000
R24=d4879410 00000000 00000001 c0202008 R28=00000022 00000000 41846648
00ab24e8

IPSW=0006010f=jthlnxbCVmrQPDI  PRIV=0   SAR=0004 PCQF=a.ab24e8   a.ab24ec

SR0=0000000a 00000000 00000000 00000000 SR4=0000000a 000004c0 0000000b
0000000a
TR0=000004c0 00000000 002c254c 81d7e390 TR4=00000002 00000000 00000000
00000003
PID1=0484=0242(W) PID2=0000=0000(W)     PID3=0000=0000(W) PID4=0000=0000(W)

RCTR=ffffffff ISR=00000000 IOR=00db9000 IIR=23fca01a IVA=00145000
ITMR=a1e6ecdd
EIEM=ffffffff EIRR=00000000 CCR=0000

[1] + Done(134) ./psysidx
  24379531      Abort   ./psysidx
R:[/EMERSON/WORK]>


================
the same source file using HP's standard C compiler:

 2:33 PM [WORK.EMERSON] (14):ccxllk PSYSIDX.C,PSYSIDX.EXEC;INFO="-Aa"

MON NOV 20 2000  2:33 PM  Copyright Hewlett-Packard Co.  1984.       PAGE
1
HP C/iX HP31506 A.05.19
"PSYSIDX"

    1  0   # 1 "PSYSIDX.C.EMERSON"
    1  0   #pragma intrinsic HPCIGETVAR
    2  0
    3  0
    4  0   char Sys_Id_Code(void)
    5  0   {
    6  1       int status=0;
    7  1
    8  1
    9  1
   10  1
   11  1       int strlen;
   12  1       char _ret='Z';
   13  1       char varvalu[32]="";
   14  1       char varname[]="HPSYSNAME  ";
   15  1
   16  1       strlen = 32;
   17  1
   18  1       HPCIGETVAR(varname,&status,
   19  1           10,&strlen,
   20  1            2, varvalu,
   21  1            0, 0);
   22  1
   23  1       if (status == 0)
   24  1           _ret = varvalu[0];
   25  1       return(_ret);
   26  1   }
   27  0
   28  0
   29  0   int main(int argc, char *argv[])
   30  0   {
   31  1       printf("The system name starts with %c\n",Sys_Id_Code());
   32  1   }

END OF PROGRAM
END OF COMPILE
HP Link Editor/iX (HP30315A.06.14) Copyright Hewlett-Packard Co 1986

LinkEd> link
from=$oldpass;rl=libcshr.lib.sys,libcansi.lib.sys,libmansi.lib.sys
,libcrand.lib.sys;to=PSYSIDX.EXEC;share

END OF LINK
 2:33 PM [WORK.EMERSON] (15):run psysidx.exec

The system name starts with R

END OF PROGRAM
 2:33 PM [WORK.EMERSON] (16):




Tom Emerson
Sr. Systems Analyst
NDC | e COMMERCE
[log in to unmask]
626-258-4309
626-350-3832 FAX

ATOM RSS1 RSS2