Bug 332037 - Valgrind cannot handle Thumb "add pc, reg"
Summary: Valgrind cannot handle Thumb "add pc, reg"
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: vex (show other bugs)
Version: 3.8.0
Platform: unspecified Android 4.x
: NOR crash
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-11 18:16 UTC by Ben Cheng
Modified: 2014-05-09 15:36 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
unit test to be compiled in thumb mode (112 bytes, text/x-csrc)
2014-03-11 18:16 UTC, Ben Cheng
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ben Cheng 2014-03-11 18:16:12 UTC
Created attachment 85539 [details]
unit test to be compiled in thumb mode

The new Android ART runtime is generating code sequence where it is adding a register to PC as computed gotos in Thumb mode. However it is giving Valgrind problems with the following crash:

vex: external/valgrind/main/VEX/priv/guest_generic_bb_to_IR.c:402 (bb_to_IR): Assertion `irsb->next == ((void*)0)' failed.

We are seeing the same problem on 3.8.1 and trunk (3.10).

I have created a small unit test like below which can crash Valgrind in the same way.

#include <stdio.h>

int main()
{
    asm("mov r0, #-2");
    asm("add pc, r0");
    printf("Hello World!\n");
}

Looks like "add(hi)" in guest_arm_toIR.c is not handing the case properly when pc is the destination register.
Comment 1 Julian Seward 2014-03-15 08:15:20 UTC
Fixed, vex r2838.