| 135 | }; |
| 136 | |
| 137 | struct PDR { |
| 138 | uint32_t addr; /* memory address of start of procedure */ |
| 139 | uint32_t isym; /* start of local symbol entries */ |
| 140 | uint32_t iline; /* start of line number entries */ |
| 141 | uint32_t regmask; /* save register mask */ |
| 142 | uint32_t regoffset; /* save register offset */ |
| 143 | uint32_t iopt; /* start of optimization symbol entries */ |
| 144 | uint32_t fregmask; /* save floating point register mask */ |
| 145 | uint32_t fregoffset; /* save floating point register offset */ |
| 146 | uint32_t frameoffset; /* frame size */ |
| 147 | uint16_t framereg; /* frame pointer register */ |
| 148 | uint16_t pcreg; /* offset or reg of return pc */ |
| 149 | int32_t lnLow; /* lowest line in the procedure */ |
| 150 | int32_t lnHigh; /* highest line in the procedure */ |
| 151 | int32_t cbLineOffset; /* byte offset for this procedure from the fd base */ |
| 152 | |
| 153 | void swap() { |
| 154 | addr = bswap32(addr); |
| 155 | isym = bswap32(isym); |
| 156 | iline = bswap32(iline); |
| 157 | regmask = bswap32(regmask); |
| 158 | regoffset = bswap32(regoffset); |
| 159 | iopt = bswap32(iopt); |
| 160 | fregmask = bswap32(fregmask); |
| 161 | fregoffset = bswap32(fregoffset); |
| 162 | frameoffset = bswap32(frameoffset); |
| 163 | framereg = bswap16(framereg); |
| 164 | pcreg = bswap16(pcreg); |
| 165 | lnLow = bswap32(lnLow); |
| 166 | lnHigh = bswap32(lnHigh); |
| 167 | cbLineOffset = bswap32(cbLineOffset); |
| 168 | } |
| 169 | |
| 170 | inline std::pair<uint32_t,uint32_t> sym_bounds(std::span<const SYMR> symrs, std::span<const AUX> auxs) const { |
| 171 | const SYMR& first = symrs[isym]; |
| 172 | const ST first_st = first.get_st(); |
| 173 | // The first symbol is the symbol of the procedure itself. The procedure name is the name of this symbol. |
| 174 | assert(first_st == ST_PROC || first_st == ST_STATICPROC); |
| 175 | |
| 176 | const AUX& aux = auxs[first.get_index()]; |
| 177 | const SYMR& last = symrs[aux.isym - 1]; |
| 178 | const ST last_st = last.get_st(); |
| 179 | // The last symbol is the END marker, pointed to by the first AUX of the stPROC symbol. |
| 180 | assert(last_st == ST_END); |
| 181 | |
| 182 | // Return the symbol bounds |
| 183 | return std::make_pair(isym, aux.isym); |
| 184 | } |
| 185 | }; |
| 186 | |
| 187 | enum LANG { |
| 188 | LANG_C = 0, |
nothing calls this directly
no outgoing calls
no test coverage detected