Commit 32766363 authored by rdubner's avatar rdubner

cobcd-st is using -m switch instead of -f and -n. First appearance of 4.7

parent ffb113de
......@@ -56,8 +56,8 @@ bool GV_echo_line = false;
static void
CreateSymc(PARAMETERS &params,
const VARIABLES &variables,
bool tack_on_python,
bool tack_on_filename)
const INSERT_MODE insert_mode
)
{
PROFILER;
/* This routine creates the .sym.c file, which contains a global
......@@ -177,7 +177,7 @@ CreateSymc(PARAMETERS &params,
delete[] py;
if(tack_on_python) {
if(insert_mode EQ IM_MODE_TEXT) {
/* As per https://sourceware.org/gdb/current/onlinedocs/gdb/dotdebug_005fgdb_005fscripts-section.html,
we are going to format that string in a way that reflects this example:
......@@ -237,7 +237,7 @@ CreateSymc(PARAMETERS &params,
params.symc << ");" << endl;
}
if(tack_on_filename) {
if(insert_mode EQ IM_MODE_FILE) {
/* As per https://sourceware.org/gdb/current/onlinedocs/gdb/dotdebug_005fgdb_005fscripts-section.html,
we are going to format that string in a way that reflects this example:
......@@ -304,15 +304,10 @@ main(int argc, char *argv[])
variables.Dump();
#endif
bool tack_on_python = params.insert_python;
bool tack_on_filename = params.insert_filename;
#if defined(_WIN32) || defined(__MINGW32__) || defined(__MINGW64__)
tack_on_python = false;
#endif
CreateSymc(params,
variables,
tack_on_python,
tack_on_filename);
params.insert_mode
);
return 0;
......
<?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>-f C:\Users\Bob\repos\cbl-gdb-samples\ref_test_14\rtest C:\Users\Bob\repos\cbl-gdb-samples\ref_test_14\rtest.cbl</LocalDebuggerCommandArguments>
<LocalDebuggerCommandArguments>-m 2 C:\Users\Bob\repos\cbl-gdb-samples\ref_test_14\rtest C:\Users\Bob\repos\cbl-gdb-samples\ref_test_14\rtest.cbl</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerEnvironment>COBST_NOISYx=1</LocalDebuggerEnvironment>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LocalDebuggerCommandArguments>-f C:\Users\Bob\repos\cbl-gdb-samples\ref_test_14\rtest C:\Users\Bob\repos\cbl-gdb-samples\ref_test_14\rtest.cbl</LocalDebuggerCommandArguments>
<LocalDebuggerCommandArguments>-m 2 C:\Users\Bob\repos\cbl-gdb-samples\ref_test_14\rtest C:\Users\Bob\repos\cbl-gdb-samples\ref_test_14\rtest.cbl</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerEnvironment>COBST_NOISYx=1</LocalDebuggerEnvironment>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LocalDebuggerCommandArguments>-f C:\Users\Bob\repos\cbl-gdb-samples\ref_test_14\rtest C:\Users\Bob\repos\cbl-gdb-samples\ref_test_14\rtest.cbl</LocalDebuggerCommandArguments>
<LocalDebuggerCommandArguments>-m 2 C:\Users\Bob\repos\cbl-gdb-samples\ref_test_14\rtest C:\Users\Bob\repos\cbl-gdb-samples\ref_test_14\rtest.cbl</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerEnvironment>COBST_NOISYx=1</LocalDebuggerEnvironment>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LocalDebuggerCommandArguments>-f C:\Users\Bob\repos\cbl-gdb-samples\ref_test_14\rtest C:\Users\Bob\repos\cbl-gdb-samples\ref_test_14\rtest.cbl</LocalDebuggerCommandArguments>
<LocalDebuggerCommandArguments>-m 2 C:\Users\Bob\repos\cbl-gdb-samples\ref_test_14\rtest C:\Users\Bob\repos\cbl-gdb-samples\ref_test_14\rtest.cbl</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerEnvironment>COBST_NOISYx=1</LocalDebuggerEnvironment>
</PropertyGroup>
......
......@@ -38,8 +38,6 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: getopt.c,v 12.6 2007/05/17 15:14:54 bostic Exp $
*/
#include <stdio.h>
......
......@@ -203,13 +203,15 @@ static void
Usage()
{
cerr << "cobst: Cobol Symbol Table generator version: " << VERSION << endl;
cerr << "cobst [-v] [-q] [-f] [-s] root CobolSourceFilename\n";
cerr << "cobst [-v] [-q] [-m MODE] root CobolSourceFilename\n";
cerr << "Reads various other files with the same root;\n";
cerr << "Generates root.sym.c containing the symbol table data\n";
cerr << "-q suppresses the one-line version announcement\n";
cerr << "-v generates the one-line version announcement and exits\n";
cerr << "-f inserts a Type1 pointer to cobcd.py into SOURCE.sym.c\n";
cerr << "-n inserts a Type3 copy of cobcb.py into SOURCE.sym.c\n";
cerr << "-m MODE specifies the cobcd.py insertion mode\n";
cerr << " MODE is 0 (the default) - No insertion\n";
cerr << " MODE is 1 - Embed a pointer to cobcd.py\n";
cerr << " MODE is 2 - Embed entire text of cobcd.py\n";
}
void
......@@ -238,12 +240,12 @@ void
PARAMETERS::GetParameters(int argc, char *argv[])
{
quiet = false;
insert_python = false;
insert_filename = false;
insert_mode = IM_MODE_NONE;
string root;
int c;
while ((c = getopt (argc, argv, "qvfs")) != -1) {
int n;
while ((c = getopt (argc, argv, "qvm:")) != -1) {
switch (c) {
case 'q':
quiet = true;
......@@ -253,17 +255,26 @@ PARAMETERS::GetParameters(int argc, char *argv[])
<< VERSION << endl;
exit(0);
break;
case 's':
insert_python = true;
break;
case 'f':
insert_filename = true;
case 'm':
n = atoi(optarg);
if( n EQ 0 ) {
insert_mode = IM_MODE_NONE;
} else if( n EQ 1 ) {
insert_mode = IM_MODE_FILE;
} else if( n EQ 2 ) {
insert_mode = IM_MODE_TEXT;
} else {
fprintf (stderr, "-m parameter must be 0, 1, or 2");
exit(1);
}
break;
case '?':
fprintf (stderr, "Unknown option '-%c'.\n", optopt);
Usage();
exit(1);
break;
default:
Usage();
exit(1);
break;
}
......@@ -271,17 +282,17 @@ PARAMETERS::GetParameters(int argc, char *argv[])
if(argc < 3) {
Usage();
exit(1);
exit(0);
}
if( optind >= argc ) {
Usage();
exit(1);
exit(0);
}
basename = argv[optind++];
if( optind >= argc ) {
Usage();
exit(1);
exit(0);
}
sourcename = argv[optind++];
......
......@@ -106,6 +106,14 @@ public:
};
typedef enum {
// See https://sourceware.org/gdb/current/onlinedocs/gdb/dotdebug_005fgdb_005fscripts-section.html
// In particular, reference the .debug_gdb_scripts section
IM_MODE_NONE, // Don't include any reference to the cobcd.py script
IM_MODE_FILE, // Embed pointer to the script. See SECTION_SCRIPT_ID_PYTHON_FILE
IM_MODE_TEXT, // Embed entire script. See SECTION_SCRIPT_ID_PYTHON_TEXT at
} INSERT_MODE;
class PARAMETERS
{
public:
......@@ -123,8 +131,7 @@ public:
std::ofstream symc;
bool quiet;
bool insert_python;
bool insert_filename;
INSERT_MODE insert_mode;
void GetParameters(int argc, char *argv[]);
};
......
......@@ -4,4 +4,4 @@
// On the Unix side, there is scripting trickery to propogate this version
// code into cobcd.py and the names of packages when they are created.
#define VERSION "4.6"
#define VERSION "4.7"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment