print more info when verbose.

This commit is contained in:
Kelvin Sherlock 2019-12-21 17:51:15 -05:00
parent 3b95cbb475
commit bf63d70d3b

View File

@ -614,7 +614,7 @@ static void print_symbols(void) {
}); });
print_symbols2(); print_symbols2();
fputs("\n", stdout);
} }
@ -623,13 +623,12 @@ static void print_symbols(void) {
void finish(void) { void finish(void) {
resolve(); resolve();
print_symbols();
std::string path = save_file; std::string path = save_file;
if (path.empty()) path = "gs.out"; if (path.empty()) path = "omf.out";
if (verbose) printf("Saving %s\n", path.c_str());
try { try {
if (lkv == 0) if (lkv == 0)
save_bin(path, segments.back(), org); save_bin(path, segments.back(), org);
@ -641,6 +640,8 @@ void finish(void) {
errx(EX_OSERR, "%s: %s", path.c_str(), ex.what()); errx(EX_OSERR, "%s: %s", path.c_str(), ex.what());
} }
print_symbols();
segments.clear(); segments.clear();
relocations.clear(); relocations.clear();
} }
@ -780,12 +781,14 @@ void evaluate(label_t label, opcode_t opcode, const char *cursor) {
switch(opcode) { switch(opcode) {
case OP_END: case OP_END:
if (!end && lkv == 2) { if (lkv == 2) {
/* finish up */ /* finish up */
segments.pop_back(); segments.pop_back();
relocations.pop_back(); relocations.pop_back();
if (!segments.empty()) if (!segments.empty())
finish(); finish();
// reset. could have another link afterwards.
new_segment(true);
} }
end = true; end = true;
break; break;
@ -905,6 +908,8 @@ void evaluate(label_t label, opcode_t opcode, const char *cursor) {
if (end) throw std::runtime_error("save after end"); if (end) throw std::runtime_error("save after end");
std::string path = path_operand(cursor); std::string path = path_operand(cursor);
std::string base = basename(path);
auto &seg = segments.back();
/* use 1st SAV as the path */ /* use 1st SAV as the path */
if (save_file.empty()) save_file = path; if (save_file.empty()) save_file = path;
@ -917,8 +922,6 @@ void evaluate(label_t label, opcode_t opcode, const char *cursor) {
*/ */
if (lkv == 1 || lkv == 2 || lkv == 3) { if (lkv == 1 || lkv == 2 || lkv == 3) {
auto &seg = segments.back();
std::string base = basename(path);
/* merlin link uses a 10-char fixed label */ /* merlin link uses a 10-char fixed label */
//base.resize(10, ' '); //base.resize(10, ' ');
seg.segname = base; seg.segname = base;
@ -932,6 +935,8 @@ void evaluate(label_t label, opcode_t opcode, const char *cursor) {
new_segment(true); new_segment(true);
} }
if (lkv == 2) { if (lkv == 2) {
if (verbose) printf("Segment %d: %s\n", seg.segnum, base.c_str());
/* add a new segment */ /* add a new segment */
new_segment(); new_segment();
} }