EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: RE: RE: problem of using Streamdevice
From: "Mark Rivers" <[email protected]>
To: <[email protected]>, "tech-talk" <[email protected]>
Date: Sat, 4 Oct 2008 10:25:37 -0500
The input string is a zero-length string, which is OK, but the char
*value pointer is NULL for some reason, so when it tries to copy \0 to
value[0] you are getting an access violation.  I don't know why
value=NULL.

Mark


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Silver
Sent: Saturday, October 04, 2008 10:18 AM
To: tech-talk
Subject: Re: RE: problem of using Streamdevice

hi, Mark:

  Following is gdb message, could you give me some hints?

Core was generated by `O.linux-x86/streamApp example.cmd'.
Program terminated with signal 11, Segmentation fault.
#0  StdStringConverter::scanString (this=0x9268b8, fmt=@0xb7f6aa14,
input=0x88d2deb "", value=0x0, maxlen=0)
    at ../StreamFormatConverter.cc:281
281             value[0] = '\0';
(gdb) bt
#0  StdStringConverter::scanString (this=0x9268b8, fmt=@0xb7f6aa14,
input=0x88d2deb "", value=0x0, maxlen=0)
    at ../StreamFormatConverter.cc:281
#1  0x00913ce0 in StreamCore::matchInput (this=0x88d29e0) at
../StreamCore.cc:1153
#2  0x00916667 in StreamCore::readCallback (this=0x88d29e0,
status=StreamIoEnd, input=0x88d384c, size=7) at ../StreamCore.cc:1058
#3  0x008ffc6b in AsynDriverInterface::readHandler (this=0x88d37d8) at
../StreamBusInterface.h:112
#4  0x0090100a in handleRequest (pasynUser=0x88ce90c) at
../AsynDriverInterface.cc:1304
#5  0x009509d3 in portThread (pport=0x888fb68) at
../../asyn/asynDriver/asynManager.c:779
#6  0x0064783f in start_routine (arg=0x88ce590) at
../../../src/libCom/osi/os/posix/osdThread.c:320
#7  0x0084b322 in start_thread () from
/lib/i686/nosegneg/libpthread.so.0
#8  0x0028a9ce in clone () from /lib/i686/nosegneg/libc.so.6
(gdb)   

here is some parts of StreamFormatConverter.cc:
int StdStringConverter::

scanString(const StreamFormat& fmt, const char* input,

    char* value, size_t maxlen)

{

    int length = -1;

    if (*input == '\0')

    {

        // match empty string

        value[0] = '\0';

        return 0;

    }

    if (fmt.flags & skip_flag)

    {

        /* can't use return value on vxWorks: sscanf with %* format

           returns -1 at end of string whether value is found or not */

        sscanf(input, fmt.info, &length);

    }



======= At 2008-10-04, 20:04:51 you wrote: =======

>You should enable core dumps and then run gdb on the core file to see
where it crashed.
>
>________________________________
>
>From: [email protected] on behalf of Silver
>Sent: Sat 10/4/2008 6:31 AM
>To: tech-talk
>Subject: problem of using Streamdevice
>
>
>
>hi, all:
>
>  I am just trying Streamdevice driver by Franksen's suggestion. Seems
it's a flexabile way of controlling our equipment. But I met some
problems, the ioc will crash quickly after starting.
>our streamdevice will response 8 bytes data in hex like "55 40 04 67 39
47 be e3". in the data, "67 39 47 be" is a float's 4 bytes. other bytes
are header or crc. So I write my protocol file like this:
># example stream protocol file
>
>#Terminator = CR LF;
>ReplyTimeout = 80000; # 10 sec is very long, for keyboard input
>ReadTimeout = 1000;   # also long for keyboard input
>
># note the field access
>ai {
>    out 170 129 00 129;
>    in "%*3c%#R%*1c";  
>}
>
>my example.db is like this:
># process this record to reload all stream protocols
>
>record (ai, "$(PREFIX):ai")
>{
>    field (DESC, "An analog value")
>    field (DTYP, "stream")
>    field (INP,  "@example.proto ai terminal")
>#    field (PREC, "3")
>#    field (LINR, "LINEAR")
>#    field (ESLO, "0.000305180437934") # 20.0 / 0xffff
>#    field (EOFF, "-10")
>#    field (EGU,  "V")
>    field (SCAN, ".5 second")
>}
>
>my example.cmd file:
>#!./streamApp
>
>dbLoadDatabase "O.Common/streamApp.dbd"
>streamApp_registerRecordDeviceDriver
>
>#where can protocols be located?
>epicsEnvSet "STREAM_PROTOCOL_PATH", ".:protocols:../protocols/"
>
>#setup the busses
>
>#example telnet style IP port setup
>drvAsynIPPortConfigure "terminal", "192.168.1.103:4001"
>#asynOctetSetInputEos "terminal",0,"\r\n"
>#asynOctetSetOutputEos "terminal",0,"\r\n"
>
>#example VXI11 (GPIB via IP) port setup
>#vxi11Configure "GPIB","ins023",1,5.0,"hpib"
>
>#load the records
>dbLoadRecords "example.db","PREFIX=DZ"
>#dbLoadRecords "scalcout.db","PREFIX=DZ"
>
>#lots! of debug output
>#var streamDebug 1
>
>#enable debug output
>var streamDebug 1
>
>iocInit
>
>my output of running ioc:
>
>~/testApp/StreamDevice-2-4/streamApp>./example.cmd
>#!./streamApp
>dbLoadDatabase "O.Common/streamApp.dbd"
>streamApp_registerRecordDeviceDriver
>#where can protocols be located?
>epicsEnvSet "STREAM_PROTOCOL_PATH", ".:protocols:../protocols/"
>#setup the busses
>#example telnet style IP port setup
>drvAsynIPPortConfigure "terminal", "192.168.1.103:4001"
>#asynOctetSetInputEos "terminal",0,"\r\n"
>#asynOctetSetOutputEos "terminal",0,"\r\n"
>#example VXI11 (GPIB via IP) port setup
>#vxi11Configure "GPIB","ins023",1,5.0,"hpib"
>#load the records
>dbLoadRecords "example.db","PREFIX=DZ"
>#dbLoadRecords "scalcout.db","PREFIX=DZ"
>#lots! of debug output
>#var streamDebug 1
>iocInit
>Starting iocInit
>#######################################################################
#####
>###  EPICS IOC CORE built on Sep 27 2008
>###  EPICS R3.14.8.2 $R3-14-8-2$ $2006/01/06 15:55:13$
>#######################################################################
#####
>iocInit: All initialization complete
>#enable debug output
>var streamDebug 1
>epics>
>epics> dbpr DZ:ai
>ASG:                DESC: An analog value                   DISA: 0

>DISP: 0             DISV: 1             NAME: DZ:ai         RVAL: 0

>SEVR: NO_ALARM      STAT: NO_ALARM      SVAL: 0             TPRO: 0

>VAL: 0.003662109375
>epics> Segmentation fault
>:~/testApp/StreamDevice-2-4/streamApp>
>
>Can anybody give me some hints? thanks a lot for your help.
>
>Best regards
>Geyang  2008-10-04

= = = = = = = = = = = = = = = = = = = =
			

Best regards				 
Geyang 2008-10-04





Replies:
Re: RE: RE: problem of using Streamdevice Silver
References:
Re: RE: problem of using Streamdevice Silver

Navigate by Date:
Prev: Re: RE: problem of using Streamdevice Silver
Next: Re: RE: RE: problem of using Streamdevice Silver
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: RE: problem of using Streamdevice Silver
Next: Re: RE: RE: problem of using Streamdevice Silver
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 02 Sep 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·