Print PHDRS clause for debugging.

This commit is contained in:
Ian Lance Taylor
2008-02-04 23:53:15 +00:00
parent 2d312b6be3
commit 7d26c6cc60

View File

@ -1777,6 +1777,14 @@ Output_section_definition::print(FILE* f) const
this->fill_->print(f); this->fill_->print(f);
} }
if (this->phdrs_ != NULL)
{
for (String_list::const_iterator p = this->phdrs_->begin();
p != this->phdrs_->end();
++p)
fprintf(f, " :%s", p->c_str());
}
fprintf(f, "\n"); fprintf(f, "\n");
} }
@ -1967,6 +1975,10 @@ class Phdrs_element
this->segment_->set_flags(this->flags_); this->segment_->set_flags(this->flags_);
} }
// Print for debugging.
void
print(FILE*) const;
private: private:
// The name used in the script. // The name used in the script.
std::string name_; std::string name_;
@ -1989,6 +2001,27 @@ class Phdrs_element
Output_segment* segment_; Output_segment* segment_;
}; };
// Print for debugging.
void
Phdrs_element::print(FILE* f) const
{
fprintf(f, " %s 0x%x", this->name_.c_str(), this->type_);
if (this->includes_filehdr_)
fprintf(f, " FILEHDR");
if (this->includes_phdrs_)
fprintf(f, " PHDRS");
if (this->is_flags_valid_)
fprintf(f, " FLAGS(%u)", this->flags_);
if (this->load_address_ != NULL)
{
fprintf(f, " AT(");
this->load_address_->print(f);
fprintf(f, ")");
}
fprintf(f, ";\n");
}
// Class Script_sections. // Class Script_sections.
Script_sections::Script_sections() Script_sections::Script_sections()
@ -2844,6 +2877,16 @@ Script_sections::print(FILE* f) const
(*p)->print(f); (*p)->print(f);
fprintf(f, "}\n"); fprintf(f, "}\n");
if (this->phdrs_elements_ != NULL)
{
fprintf(f, "PHDRS {\n");
for (Phdrs_elements::const_iterator p = this->phdrs_elements_->begin();
p != this->phdrs_elements_->end();
++p)
(*p)->print(f);
fprintf(f, "}\n");
}
} }
} // End namespace gold. } // End namespace gold.