Hi,
I think get_precision() expects a long* for the precision but the variable passed is declared int in getFloatString() and getDoubleString(). In theory
this could cause a crash on 64 bit linux as int and long are different sizes, but It wouldn’t explain the 32bit crash though as int and long are the same size on that architecture…
Regards,
Freddie
From: [email protected] [mailto:[email protected]]
On Behalf Of Ralph Lange
Sent: 21 February 2017 08:54
To: Carsten Winkler
Cc: EPICS Tech Talk
Subject: Re: Segmentation fault at dbConvert.c in Ubuntu 32/64 bit
Hi Carsten,
The default value for precision used when you comment out the lines you mention is 6.
Can you achieve the same (i.e. avoid segfaults) by setting PREC to 6 in your database?
If yes: which PREC values cause segfaults?
On Tue, Feb 21, 2017 at 9:15 AM, Carsten Winkler <[email protected]> wrote:
I forgot to give you the used db entry. Here it is:
record(waveform, "caLab:waveString")
{
field(DESC, "String waveform record")
field(NELM, 48)
field(FTVL, "STRING")
field (PINI, "YES")
field (PREC, 3)
}
Am 20.02.2017 um 15:40 schrieb Carsten Winkler:
> Hi there,
>
> I always run into a "Segmentation fault" in function "putFloatString" |
> "putDoubleString" of BASE/src/db/dbConvert.c
>
> When I comment out following lines (call of get_precision) everything is
> working again:
> 3947
> 3948
> 4157
> 4158
>
> Test system
> =================================================
> Ubunu 16.04 (64 bit)
> EPICS BASE 3.14.12.6 (64 bit)
>
>
> To check the error, I used this code:
> test.cpp
> =================================================
>
> #include <malloc.h>
> #include <cadef.h>
> //#define DOUBLE
>
> using namespace std;
>
> int main() {
> chid chanID;
> int iNumber = 1;
> int timeout = 0;
> void *pValue = 0x0;
>
> ca_context_create(ca_enable_preemptive_callback);
> #if defined DOUBLE
> pValue = (double*)malloc(iNumber*sizeof(double));
> for(int i=0; i<iNumber; i++) {
> ((double*)pValue)[i] = (double)((1+i)*3.1415926535897);
> }
> #else
> pValue = (float*)malloc(iNumber*sizeof(float));
> for(int i=0; i<iNumber; i++) {
> ((float*)pValue)[i] = (float)((1+i)*3.1415926535897);
> }
> #endif
> ca_create_channel("caLab:waveString", 0, 0, 50, &chanID);
> timeout = 3000;
> while(ca_state(chanID) != cs_conn && timeout--) {
> epicsThreadSleep(.001);
> }
> #if defined DOUBLE
> ca_array_put(DBR_DOUBLE, 1, chanID, pValue);
> #else
> ca_array_put(DBR_FLOAT, 1, chanID, pValue);
> #endif
> ca_context_destroy();
> free(pValue);
> return 0;
> }
>
> g++ -I/usr/local/epics/base-3.14.12.6/include/os/Linux
> -I/usr/local/epics/base-3.14.12.6/include -O0 -g3 -Wall -c
> -fmessage-length=0 -MMD -MP -MF"test.d" -MT"test.d" -o "test.o" "test.cpp"
> g++ -L/usr/local/epics/base-3.14.12.6/lib/linux-x86_64 -o "test"
> test.o -lCom -lca
>
> Any advice to solve this issue?
>
> Best regards
> Carsten Winkler
>
> PS Same problem in 32 bit systems
>
>
> ________________________________
>
> Helmholtz-Zentrum Berlin für Materialien und Energie GmbH
>
> Mitglied der Hermann von Helmholtz-Gemeinschaft Deutscher Forschungszentren e.V.
>
> Aufsichtsrat: Vorsitzender Dr. Karl Eugen Huthmacher, stv. Vorsitzende Dr. Jutta Koch-Unterseher
> Geschäftsführung: Prof. Dr. Anke Rita Kaysser-Pyzalla, Thomas Frederking
>
> Sitz Berlin, AG Charlottenburg, 89 HRB 5583
>
> Postadresse:
> Hahn-Meitner-Platz 1
> D-14109 Berlin
>
> http://www.helmholtz-berlin.de
>
________________________________
Helmholtz-Zentrum Berlin für Materialien und Energie GmbH
Mitglied der Hermann von Helmholtz-Gemeinschaft Deutscher Forschungszentren e.V.
Aufsichtsrat: Vorsitzender Dr. Karl Eugen Huthmacher, stv. Vorsitzende Dr. Jutta Koch-Unterseher
Geschäftsführung: Prof. Dr. Anke Rita Kaysser-Pyzalla, Thomas Frederking
Sitz Berlin, AG Charlottenburg, 89 HRB 5583
Postadresse:
Hahn-Meitner-Platz 1
D-14109 Berlin
http://www.helmholtz-berlin.de
|