Commit c5c11bd5 authored by rdubner's avatar rdubner

Move the msys2 folder to camelian-packages. Change names

In particular, sfix is now cobcd-sfix, cobst is now cobcd-st, and cprint.py
has become cobcd.py.  The result is that the files deployed to implement the
Camelian/Symas debugging extensions are now all named cobcd*
parent ca34bf02
# Camelian.Systems GnuCOBOL Source Level Debugging Support
This repository contains the development and testing materials for this
package.
It is purposely a private repository with access limited to the
Camelian.Systems team.
These are the source files for building the tools that make up the Symas/Camelian debugging extensions for GnuCOBOL.
You'll need to have Version 3.x-dev, or later, of GnuCOBOL installed to actually make things work.
Building the source, and installing the binaries and scripts into /usr/local, operates as you'd generally expect:
make
sudo make install
Using the extensions is generally a case of using the cobcd script where you'd ordinarily use the cobc program:
Instead of
cobc -x hello.cbl
you instead enter
cobcd -x hello.cbl
After that, you can debug the resulting binary with
gdb ./hello
The extensions' functionality is provided by the information in these folders:
cobcd-st/
cobcd-sfix/
python/
include/
.legacy/ is code that I used along the way, but is currently not involved in production or development, and most likely is thoroughly broken.
bin/ contains utility scripts used during development and deployment
vsdistrib/ contains the .vsix file that provides a Visual Studio Code extension that knows how to use the Symas/Camelian to do source-level debugging of COBOL code in the VSC IDE.
optfde01/ contains a simple program that can be compiled and debugged after you have done the 'make install' The optfde01/.vscode/ subdirectory contains the launch.json and tasks.json files that you'll clone into your own projects.
Feel free to contact me with any questions or problems.
2020-05-07
Bob Dubner
Symas/Camelian
rdubner@symas.com
#!/bin/bash
# FileVersion 2.5
# This script, nominally named cobcd, packages up the process of compiling
# a single COBOL source module and processing it so that gdb can be used for
# source-level debugging of that module. Found in the root folder of the
......
......@@ -34,7 +34,7 @@
#include <fstream>
#include <vector>
#include "../version.h"
#include "../include/version.h"
class FILENAME
{
......
......@@ -72,15 +72,19 @@
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<TargetName>cobcd-sfix</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<TargetName>cobcd-sfix</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<TargetName>cobcd-sfix</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<TargetName>cobcd-sfix</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
......
project=cobst
project=cobcd-st
CPP = g++
src = $(wildcard *.cpp)
......@@ -15,10 +15,10 @@ $(project) : $(obj)
%.d: %.cpp
@$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
cobst.cpp : cprint_py.h
cobst.cpp : cobcd_py.h
cprint_py.h : ../python/cprint.py
xxd -i ../python/cprint.py >cprint_py.h
cprint_py.h : ../python/cobcd.py
xxd -i ../python/cobcd.py >cobcd_py.h
.PHONY: clean
clean:
......
This diff is collapsed.
......@@ -40,7 +40,7 @@
#include "input_scan.h"
#include "profiler.h"
#include "vartree.h"
#include "cprint_py.h"
#include "cobcd_py.h"
#define EQ ==
#define AND &&
......
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="getopt.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="cobst.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="input_scan.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="profiler.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="params.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="utils.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="vartree.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="csv.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="getopt.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="input_scan.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="profiler.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="params.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="utils.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="vartree.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="cprint_py.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="getopt.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="cobst.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="input_scan.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="profiler.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="params.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="utils.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="vartree.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="csv.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="getopt.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="input_scan.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="profiler.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="params.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="utils.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="vartree.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="cobcd_py.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerCommandArguments>C:\projects\1-symas\cbl-gdb\samples\ref_test_3\rtest</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LocalDebuggerCommandArguments>C:\projects\1-symas\cbl-gdb\samples\ref_test_3\rtest</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LocalDebuggerCommandArguments>C:\projects\1-symas\cbl-gdb\samples\ref_test_3\rtest</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LocalDebuggerCommandArguments>C:\projects\1-symas\cbl-gdb\samples\ref_test_3\rtest</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerCommandArguments>C:\projects\1-symas\cbl-gdb\samples\ref_test_3\rtest</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LocalDebuggerCommandArguments>C:\projects\1-symas\cbl-gdb\samples\ref_test_3\rtest</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LocalDebuggerCommandArguments>C:\projects\1-symas\cbl-gdb\samples\ref_test_3\rtest</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LocalDebuggerCommandArguments>C:\projects\1-symas\cbl-gdb\samples\ref_test_3\rtest</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>
\ No newline at end of file
......@@ -43,8 +43,6 @@
#include "params.h"
#include "utils.h"
#include "../version.h"
#define EQ ==
#define AND &&
......
......@@ -33,7 +33,7 @@
#include <string>
#include <fstream>
#include "../version.h"
#include "../include/version.h"
class FILENAME
{
......
::
:: FileVersion 2.5
::
@ECHO OFF
SETLOCAL
::
......
......@@ -5,4 +5,4 @@
// Linux-only trickery to get the version code in place.
//
#define VERSION "2.5"
#define VERSION "2.6"
gnucobol/
pkg/
src/
*.log
*.zst
diff -Naur ./libcob/common.h.orig ./libcob/common.h
--- ./libcob/common.h.orig 2017-09-06 20:37:28.000000000 +0200
+++ ./libcob/common.h 2017-10-25 23:26:58.208945700 +0200
@@ -50,7 +50,7 @@
#endif
-#if defined(_WIN32)
+#if defined(_WIN32) && !defined(__MINGW32__) /* hack for msys2 patch */
#define CB_FMT_LLD "%I64d"
#define CB_FMT_LLU "%I64u"
@@ -389,12 +389,12 @@
/* Also OK for icc which defines __GNUC__ */
-#if defined(__GNUC__) || (defined(__xlc__) && __IBMC__ >= 700)
+#if defined(__GNUC__) && defined(__MINGW32__) /* hack for msys2 patch */
#define COB_A_NORETURN __attribute__((noreturn))
-#define COB_A_FORMAT12 __attribute__((format(printf, 1, 2)))
-#define COB_A_FORMAT23 __attribute__((format(printf, 2, 3)))
-#define COB_A_FORMAT34 __attribute__((format(printf, 3, 4)))
-#define COB_A_FORMAT45 __attribute__((format(printf, 4, 5)))
+#define COB_A_FORMAT12 __attribute__((format(__MINGW_PRINTF_FORMAT, 1, 2)))
+#define COB_A_FORMAT23 __attribute__((format(__MINGW_PRINTF_FORMAT, 2, 3)))
+#define COB_A_FORMAT34 __attribute__((format(__MINGW_PRINTF_FORMAT, 3, 4)))
+#define COB_A_FORMAT45 __attribute__((format(__MINGW_PRINTF_FORMAT, 4, 5)))
#define DECLNORET
#else
#define COB_A_NORETURN
.PHONY : clean
clean :
@./conditional_clean
# Maintainer: Alexey Pavlov <alexpux@gmail.com>
# Contributor: Jürgen Pfeifer <juergen@familiepfeifer.de>
# Contributor: Simon Sobisch <simonsobisch@gnu.org>
_realname=gnucobol
pkgbase=mingw-w64-${_realname}-svn
pkgname=${MINGW_PACKAGE_PREFIX}-${_realname}-svn
pkgver=.r3548
_specialversion=-dev
pkgrel=1
pkgdesc="GnuCOBOL, a free and modern COBOL compiler (mingw-w64)"
conflicts=("${MINGW_PACKAGE_PREFIX}-${_realname}" "${MINGW_PACKAGE_PREFIX}-gnu-cobol-svn")
replaces=("${MINGW_PACKAGE_PREFIX}-${_realname}" "${MINGW_PACKAGE_PREFIX}-gnu-cobol-svn")
arch=('any')
url="https://www.gnu.org/software/gnucobol/"
options=('strip')
license=('GPL3' 'LGPL3')
makedepends=("subversion"
"bison"
"flex"
"rsync" # for translation updates...
"help2man"
"texinfo"
)
checkdepends=("diffutils" "wget" "perl")
# note: the final binaries will call GCC, therefore it is a dependency
depends=("${MINGW_PACKAGE_PREFIX}-gcc"
"${MINGW_PACKAGE_PREFIX}-gmp"
"${MINGW_PACKAGE_PREFIX}-gettext"
"${MINGW_PACKAGE_PREFIX}-ncurses"
"${MINGW_PACKAGE_PREFIX}-db"
"${MINGW_PACKAGE_PREFIX}-libxml2"
#"${MINGW_PACKAGE_PREFIX}-"cjson" <-- not available yet
)
# the optional depencies cannot be used for creating the binary packages, moved to depends
#optdepends=("${MINGW_PACKAGE_PREFIX}-gettext: support for internationalization"
# "${MINGW_PACKAGE_PREFIX}-libxml2: support for XML handling"
# "${MINGW_PACKAGE_PREFIX}-cjson: support for JSON handling"
# "${MINGW_PACKAGE_PREFIX}-ncurses: support for extended screenio"
# "${MINGW_PACKAGE_PREFIX}-pdcurses: support for screenio")
source=(
# "${_realname}::svn://svn.code.sf.net/p/open-cobol/code/trunk"
"${_realname}::svn://svn.code.sf.net/p/open-cobol/code/branches/gnucobol-3.x"
"001-mingw-gnucobol-2.2-fixformatwarnings.patch"
"cobenv.sh" "cobenv.cmd")
sha256sums=('SKIP'
'3FBFDAF61EB6EC125258DE62B404C97BF6DCCF39BD3B9152510F794B5383CA33'
'E55ED37EA93DFB7911B4CAD7F9F45422D831092668991120EA0CD0BCF79605AC'
'37F0848BCC386179D24986D17102F318AAF534D25682A09969B349916B56726B')
pkgver() {
cd "${srcdir}/${_realname}"
local ver="$(svnversion)"
printf "%s.r%s" "${_base_ver}" "${ver//[[:alpha:]]}"
}
prepare() {
cd "${srcdir}/${_realname}"
#patch -Np1 -i ${srcdir}/001-mingw-gnucobol-2.2-fixformatwarnings.patch
chmod u+x autogen.sh && ./autogen.sh
chmod u+x po/update_linguas.sh && po/update_linguas.sh
}
build() {
export lt_cv_deplibs_check_method='pass_all' # libncurses with unconforming name
[[ -d ${srcdir}/build-${CARCH} ]] && rm -rf ${srcdir}/build-${CARCH}
cp -rf ${_realname} build-${CARCH}
cd ${srcdir}/build-${CARCH}
./configure \
CPPLAGS="-D__USE_MINGW_ANSI_STDIO=1" \
--build=${MINGW_CHOST} \
--host=${MINGW_CHOST} \
--target=${MINGW_CHOST} \
--prefix=${MINGW_PREFIX} \
--infodir=${MINGW_PREFIX}/share/info \
--mandir=${MINGW_PREFIX}/share/man \
--disable-rpath \
--enable-shared \
--disable-static
# --> as using the static libcob would be the builtin default,
# all generated COBOL modules would be GPLed (and big)...
make -j1
# make -j1 -C doc gnucobol.pdf note: needs more entries in makedepends
}
check() {
cd ${srcdir}/build-${CARCH}
# make check
# make test || true # note: may fail, but this is the SVN version...
}
package() {
cd ${srcdir}/build-${CARCH}
make DESTDIR="${pkgdir}" install
cd ${srcdir}
install -p -m777 cobenv.* "${pkgdir}${MINGW_PREFIX}/bin"
cd ${_realname}
install -d "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}"
install -p -m644 COPYING* "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}"
install -d "${pkgdir}${MINGW_PREFIX}/share/doc/${_realname}"
install -p -m644 README NEWS "${pkgdir}${MINGW_PREFIX}/share/doc/${_realname}"
# the manual may not be build as PDF (maybe come back later and add to makedepends + do an explicit make as noted above)
#cd doc
#install -p -m644 gnucobol.pdf "${pkgdir}${MINGW_PREFIX}/share/doc/${_realname}"
}
This folder is intended to provide a standalone GnuCOBOL compiler with
Symas/Camelian debugging capability that runs natively on Windows.
It was built on Windows 10 Profession with the MSYS2/MINGW32 toolchain,
so the cobc.exe program and the Camelian programs -- cobst.exe and
sfix.exe -- are all i686 32-bit executables.
The included gcc compiler is version 9.3, and the gdb debugger is 9.1; they
are the latest versions, as of this writing, provided by the MINGW32 toolchain.
You probably received this package as a 7-zip self-extracting executable,
and you probably let it install itself as C:\cblgdb\
The way you use it is to execute
C:\cblgdb\bin\cobenv.cmd
That sets up the execution path and the environment variables for
GnuCOBOL. You can then compile a COBOL program like this
cobcd -x your_program.cbl
You can then debug it with
gdb your_program
When you do that, you'll be confronted with a (gdb) prompt. Use the "list"
command to look at the code. Use the "break" command to set a breakpoint, and
use the "run" command to start the program.
The Camelian debugging package intercepts the "print" command in order to
allow the display of COBOL variables.
"print *" shows you all the variables in the current execution context.
"print 4" shows you the fourth variable in the "print *" list.
"print num" shows you all variables with "num" in their name.
There is a /d switch that shows debugging information for a variable: Use
the name (or the number) like this:
print/d specific_name
print/d 4
There is also a "watch" capability, where the code traps when a variable
changes. The command for that is "cwatch":
cwatch my-counter
Please contact me at rdubner@symas.com with questions, comments, complaints,
bugs, or (with any luck!) accolades.
Special thanks go to Arnold Trembley and Simon Sobisch. Putting this package
together involved a number of procedures and concepts that were new to me, and
the effort would have been much harder without Simon's help and Arnold's
documenation.
Bob Dubner
May 5, 2020
This folder is intended to provide a standalone GnuCOBOL compiler that runs
natively on Windows.
It was built on Windows 10 Profession with the MSYS2/MINGW32 toolchain,
so the cobc.exe program and supporting libraries are all i686 32-bit executables.
The included gcc compiler is version 9.3. It is the latest versions, as of
this writing, provided by the MINGW32 toolchain.
You probably received this package as a 7-zip self-extracting executable,
and you probably let it install itself as C:\gnucobol\
The way you use it is to execute
C:\cblgdb\bin\cobenv.cmd
That sets up the execution path and the environment variables for
GnuCOBOL. You can then compile a COBOL program like this
cobc -x your_program.cbl
Please contact me at rdubner@symas.com with questions, comments, complaints,
bugs, or (with any luck!) accolades.
Special thanks go to Arnold Trembley and Simon Sobisch. Putting this package
together involved a number of procedures and concepts that were new to me, and
the effort would have been much harder without Simon's help and Arnold's
documenation.
Bob Dubner
May 5, 2020
Bob Dubner, 2020-05-15
The enclosed PKGBUILD file was provided by Simon Sobisch.
To get the build to work, I had to modify a couple of things:
In PKGBUILD, line 25: change "diff" to "diffutils"
line 89: comment out 'make check'
line 90: comment out 'make test'
Following those changes:
makepkg-mingw -sCLf
@echo off
:: cobenv.cmd
:: Batch for setting GnuCOBOL Environment in Windows
:: from MSYS2 MINGW32/MINGW64
::
:: Copyright (C) 2017 Free Software Foundation, Inc.
:: Written by Simon Sobisch
::
:: This file is part of GnuCOBOL.
::
:: The GnuCOBOL compiler is free software: you can redistribute it
:: and/or modify it under the terms of the GNU General Public License
:: as published by the Free Software Foundation, either version 3 of the
:: License, or (at your option) any later version.
::
:: GnuCOBOL is distributed in the hope that it will be useful,
:: but WITHOUT ANY WARRANTY; without even the implied warranty of
:: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
:: GNU General Public License for more details.