gnucobol-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [open-cobol-list] cobc Segmentation fault (core dumped)


From: Michael Anderson
Subject: Re: [open-cobol-list] cobc Segmentation fault (core dumped)
Date: Mon, 16 Sep 2013 13:56:13 -0500
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130803 Thunderbird/17.0.8

Thanks Brian!
I think you may have misunderstood. It is not my program that is crashing, it is the compiler 'cobc' that is crashing. So I would need to re-build the OC compiler with symbols/debugging on, that was my "howto" question.

Just as your email showed up I solved it.

The method I used, was to used the 'cobc -v"  output.

1. 'cat  /tmp/cob7521_0.c'
In the temp C file I can see (the last line) the line of COBOL source where the crash happened.

2. Next I rearrange the source, and the look at the new temp C file.
Now I have confirmed the line of COBOL source that cause the compiler to crash.

3. Next I start to comment out COBOL statements 1 by 1, until I get a good compile.

4. The problem turned out to be a String statement, where I ( mistakenly ) was passing a 88 level item to a trim function within the string.

Example problem code:
     If Not Split-Transaction
         String Quote
             trim(Tr-Date)    quote "," quote
             trim(Tr-Payee)   Quote "," Quote
trim(Tr-Memo) " " trim(i-filename) " " trim(Tr-Cleared) Quote "," Quote
             trim(Tr-Amount)    Quote "," Quote
             trim(Tr-type)       Quote "," Quote
             trim(Tr-Category)  Quote "," Quote
             " "    Quote "," Quote
             trim(qifname) " " trim(Tr-Serialnumber) Quote
             Delimited By size into csv-record
         End-String
Was changed to:
     If Not Split-Transaction
         String Quote
             trim(Tr-Date)    quote "," quote
             trim(Tr-Payee)   Quote "," Quote
trim(Tr-Memo) " " trim(i-filename) " " trim(Tr-Cleared) Quote "," Quote
             trim(Tr-Amount)    Quote "," Quote
             trim(Tr-type)       Quote "," Quote
             trim(Tr-Category)  Quote "," Quote
             " "    Quote "," Quote
             trim(i-filename) " " trim(Tr-Serialnumber) Quote
             Delimited By size into csv-record
         End-String


Where i-filename is a string, and qifname is a 88 level item of pic 9.
And again, there was not a compiler error/warning, instead cobc generated a core file, a segmentation fault.

Thanks again,
Mike.



On 09/16/2013 01:30 PM, Brian Tiffin wrote:
Micheal; Without seeing any code yet, you'll likely get better messages using

cobc -v -g -debug -x -free -ffunctions-all

Adding in the -g and -debug.  It should then crap out with a better
message and leave source files around for gdb stepping.  (gdb requires
the .c files to show source lines, and sadly I haven't yet put in the
compiler code to allow stepping .cob source lines intermixed with the
.c code that is actually running in the binary).

If that doesn't work out, we can talk about listing the COBOL sources.

Cheers,
Brian

On 9/16/13, Michael Anderson <address@hidden> wrote:
Hello all!

I'm working on a personal tax project, and wrote a little conversion
utility.

When I compile it, a SEGV occurs......

Any pointers/hints to debug?
Any OC developers want to look at it?
I can send the cobol source to anyone interested.
Be forewarned, My COBOL coding style has angered some traditional COBOL
programmers.

--
Thanks,
Mike.

Screen scrape follows:

$ cobc -v -x -free -ffunctions-all qif2csv.cob
preprocessing qif2csv.cob into /tmp/cob7521_0.cob
parsing /tmp/cob7521_0.cob (qif2csv.cob)
return status: 0
translating /tmp/cob7521_0.cob into /tmp/cob7521_0.c (qif2csv.cob)
Segmentation fault (core dumped)
j
$ gdb /usr/local/bin/cobc ./core
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
Reading symbols from /usr/local/bin/cobc...(no debugging symbols
found)...done.
[New LWP 17921]

warning: Can't read pathname for load map: Input/output error.
Core was generated by `cobc -x -Icopylib -free -ffunctions-all
qif2csv.cob'.
Program terminated with signal 11, Segmentation fault.
#0  0x080511f8 in cb_field_variable_address ()
(gdb)

------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8,
SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack
includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13.
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
_______________________________________________
open-cobol-list mailing list
address@hidden
https://lists.sourceforge.net/lists/listinfo/open-cobol-list




reply via email to

[Prev in Thread] Current Thread [Next in Thread]