dwarf2cpp icon indicating copy to clipboard operation
dwarf2cpp copied to clipboard

Want to ask a question about line numbers, but no discussion/contact info

Open RappyPhan opened this issue 2 years ago • 0 comments

Hi everyone

There's no discussion board, and no way to contact the (main) developer, so as a last-ditch effort I'm creating an issue to ask a question. Apologies in advance.

I'm decompiling a PS2 game thanks to this project's output, and I'm pretty far along. Lately I've been matching the line numbers with C code to get as close to the original code as possible. What is not clear to me, however, is for what lines DWARFv1 has an entry. Is it only statements? Do conditions get one as well?

I've tried to find this information by myself, but no article goes into that detail.

Example:

if (actionwk->r_no0 == 0 /* Line 399, Address: 0x100450c */
  || actionwk->actno & 128) { /* Line 400, Address: 0x1004520 */

  sjump_move_tbl[actionwk->r_no0 >> 1](actionwk); /* Line 402, Address: 0x1004538 */
}

If conditions on their own don't get a line number, and I have to use a second if statement, then it'd have to look like this kludge:

  if (actionwk->r_no0 == 0) goto label1; /* Line 399, Address: 0x100450c */
  if (actionwk->actno & 128) { /* Line 400, Address: 0x1004520 */
label1:
    sjump_move_tbl[actionwk->r_no0 >> 1](actionwk); /* Line 402, Address: 0x1004538 */
  }

I also have concerns when it comes to for loops, but one question at a time.

Thanks for reading.

RappyPhan avatar Jun 04 '23 14:06 RappyPhan