Commit 0fca2f6c authored by rdubner's avatar rdubner

Use obmod to put symbol string into cprint.py

parent 99770d26
......@@ -442,20 +442,19 @@ CreateCModule(PARAMETERS &params,
// data_description information, so don't put it out here because
// it's potentially confusing.
continue;
}
}
stringstream ss;
ios_base::fmtflags deflags = ss.flags();
if( cs.program != current_program)
{
if( cs.program != current_program) {
current_program = cs.program;
ss << "P|";
ss << cs.line_number << "|";
ss << cs.program << "|";
params.csym << " \"" << ss.str() << "\"," << endl;
}
}
}
// You can't change the order of things here unless you also change
// the ordering in cprint.py They are tightly linked, and that's that!
......
......@@ -952,17 +952,16 @@ void ELF::CreateSection(const std::string &sec_name,
}
static string ZeroIsNull(const LONGLONG &v)
{
{
stringstream ss;
if( v != 0 )
{
if( v != 0 ) {
ss << v;
}
return ss.str();
}
return ss.str();
}
string ELF::SymbolString()
{
{
/* This routine puts the COBOL-identifier/C-identifier cross-reference
information into a single string that will be prepended, as a string
variable, to the cprint.py module embedded in the executable as a
......@@ -975,34 +974,29 @@ string ELF::SymbolString()
// Do the line/address information from the .text in the minimal form
// used by cprint.py to figure out which program a trap has occurred in.
string current_program = "";
for(int i=0; i<cobst_symbols.size(); i++)
{
for(int i=0; i<cobst_symbols.size(); i++) {
COBST_SYMBOL cs = cobst_symbols[i];
if( cs.division EQ "Procedure")
{
if( cs.division EQ "Procedure") {
if( cs.section EQ "Linkage" ) {
// This information was previously transferred to the
// data_description information, so don't put it out here because
// it's potentially confusing.
continue;
}
}
if( cs.program != current_program)
{
if( cs.program != current_program) {
current_program = cs.program;
ss << "P|";
ss << cs.line_number << "|";
ss << cs.program;
ss << "~";
continue;
}
}
}
for(int i=0; i<cobst_symbols.size(); i++)
{
}
for(int i=0; i<cobst_symbols.size(); i++) {
COBST_SYMBOL cs = cobst_symbols[i];
if( cs.division EQ "Data")
{
if( cs.division EQ "Data") {
ss << "D|";
ss << cs.section.substr(0,2) << "|";
ss << ZeroIsNull(cs.level) << "|" ;
......@@ -1017,12 +1011,12 @@ string ELF::SymbolString()
ss << ZeroIsNull(cs.attr_digits) << "|" ;
ss << ZeroIsNull(cs.attr_scale) << "|" ;
ss << ZeroIsNull(cs.attr_flags) << "~";
}
}
}
ss << "\"";
return ss.str();
}
}
#if 0
void ELF::InsertDebugScript(const std::string &python_script)
......
......@@ -86,10 +86,13 @@ void COBST_SYMBOLS::ReadFrom(const string &cobst_filename)
} else {
cobst_symbol.section = values[header_columns[SECTION]];
if( cobst_symbol.section EQ "WORKING-STORAGE"
OR cobst_symbol.section EQ "INPUT-OUTPUT"
OR cobst_symbol.section EQ "LOCAL-STORAGE"
OR cobst_symbol.section EQ "LINKAGE" ) {
cobst_symbol.program = values[header_columns[PROGRAM_NAME]];
cobst_symbol.full_name = values[header_columns[FULL_NAME]];
cobst_symbol.level = stoi(values[header_columns[LEVEL]]);
cobst_symbol.division = values[header_columns[DIVISION]];
cobst_symbol.base_symbol = values[header_columns[BASE_SYMBOL]];
cobst_symbol.offset = stoull(values[header_columns[OFFSET]]);
cobst_symbol.list_type = values[header_columns[LIST_TYPE]];
......@@ -100,7 +103,7 @@ void COBST_SYMBOLS::ReadFrom(const string &cobst_filename)
cobst_symbol.attr_digits = (USHORT)stoul(values[header_columns[ATTR_DIGITS]]);
cobst_symbol.attr_scale = (SHORT)stoi(values[header_columns[ATTR_SCALE]]);
cobst_symbol.attr_flags = (USHORT)stoul(values[header_columns[ATTR_FLAGS]]);
}
}
cobst_symbols.push_back(cobst_symbol);
prior = cobst_symbol;
......
......@@ -24,7 +24,7 @@ public:
int level; // COBOL symbol level
std::string base_symbol;// C-code base symbol for the COBOL symbol
ULONGLONG offset; // offset from the base address
std::string list_type; //
std::string list_type; //
size_t list_size; // Length of data
std::string picture;
int occurs;
......
......@@ -5,14 +5,13 @@
using namespace std;
int main(int argc, char **argv)
{
{
PROFILER;
PARAMETERS params = GetParameters(argc, argv);
if(!params.quiet)
{
if(!params.quiet) {
cout << "obmod version " << VERSION << endl;
}
}
ELF elf;
......@@ -64,5 +63,5 @@ int main(int argc, char **argv)
// Put the headers and sections back together, and writes them out to a
// file.
elf.WriteTo(params.o_output_filename.WholePath());
}
}
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