pycdc icon indicating copy to clipboard operation
pycdc copied to clipboard

Trying to decompile opcode PUSH_EXC_INFO failed

Open 1wxyz opened this issue 1 year ago • 2 comments

Trying to implement opcode PUSH_EXC_INFO with the notes from https://docs.python.org/3/library/dis.html#opcode-PUSH_EXC_INFO

case Pyc::PUSH_EXC_INFO:
            {
                PycRef<ASTNode> popped = stack.top();
                stack.pop();

                PycRef<ASTBlock> except = new ASTCondBlock(ASTBlock::BLK_EXCEPT, 0, NULL, false);
                except->init();
                stack.push(except.cast<ASTNode>());
                stack.push(popped);
            }
            break;

Based on the code above, I was trying to implement: 'Pushes the current exception to the top of the stack. ', which ended up with Segmentation fault (core dumped).

When I change stack.push(except.cast<ASTNode>()); to blocks.push(except); , it gives this error: Error decompyling file.pyc: vector::_M_range_check: __n (which is 3) >= this->size() (which is 2)

Not sure what is the correct way to write in pycdc. Thanks for any advise given in advance.

1wxyz avatar Sep 13 '24 10:09 1wxyz

need write a "exception table" to syntax try block

hngocuyen avatar Jun 01 '25 10:06 hngocuyen

#564 tackles the exception table. However decompilation for exception handling is much harder now.

whoami730 avatar Jul 16 '25 09:07 whoami730