Commit 35c4cba5 authored by rdubner's avatar rdubner

Added gdb debug Python file name pointer

parent cd03c243
......@@ -375,9 +375,9 @@ if [ "$result" = "0" ]
then
if [ "$ECHO" ]
then
echo $COBST -q $DASH_N $FILE_ROOT $FILE_CBL
echo $COBST -q $DASH_7 $DASH_N $FILE_ROOT $FILE_CBL
fi
$COBST -q $DASH_N $FILE_ROOT $FILE_CBL
$COBST -q $DASH_7 $DASH_N $FILE_ROOT $FILE_CBL
result=$?
fi
......
......@@ -90,7 +90,8 @@ static void
CreateSymc(PARAMETERS &params,
const COB_PROGRAM_LABELS &program_labels,
const VARIABLE_TREE &variable_tree,
bool tack_on_python)
bool tack_on_python,
bool tack_on_filename)
{
/* This routine creates the .sym.c file, which contains a global
variable comprising the cross-reference information, followed
......@@ -242,6 +243,33 @@ CreateSymc(PARAMETERS &params,
params.symc << "\".popsection\\n\"" << endl;
params.symc << ");" << endl;
}
if(tack_on_filename) {
/* 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:
asm("
.pushsection \".debug_gdb_scripts\", \"MS\",@progbits,1\n
.byte 1 \n
.asciz \"cobcd.py\"\n
.popsection \n
");
*/
s = ss.str();
params.symc << "asm(" ;
params.symc << "\".pushsection \\\".debug_gdb_scripts\\\", \\\"MS\\\",@progbits,1\\n\"" ;
params.symc << "\".byte 1 \\n\"" ;
params.symc << "\".asciz \\\"cobcd.py\\\"\\n\"" ;
params.symc << "\".popsection\\n\"" ;
params.symc << ");" ;
params.symc << endl;
}
return;
}
......@@ -335,12 +363,14 @@ main(int argc, char *argv[])
// executable, providing the text that will become the executable's
// .debug_gdb_scripts section
bool tack_on_python = params.insert_python;
bool tack_on_filename = params.insert_filename;
#if defined(_WIN32)
tack_on_python = false;
#endif
CreateSymc(params,
program_labels,
variable_tree,
tack_on_python);
tack_on_python,
tack_on_filename);
return 0;
}
......@@ -243,10 +243,11 @@ PARAMETERS::GetParameters(int argc, char *argv[])
quiet = false;
insert_python = true;
insert_filename = false;
string root;
int c;
while ((c = getopt (argc, argv, "qvn")) != -1) {
while ((c = getopt (argc, argv, "qvn7")) != -1) {
switch (c) {
case 'q':
quiet = true;
......@@ -259,6 +260,9 @@ PARAMETERS::GetParameters(int argc, char *argv[])
case 'n':
insert_python = false;
break;
case '7':
insert_filename = true;
break;
case '?':
fprintf (stderr, "Unknown option '-%c'.\n", optopt);
exit(1);
......
......@@ -127,6 +127,7 @@ public:
bool quiet;
bool insert_python;
bool insert_filename;
void GetParameters(int argc, char *argv[]);
};
......
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