cisco-open / llvm-crash-analyzer

llvm crash analysis
Apache License 2.0
40 stars 17 forks source link

[TA] Fix calculateMemAddr for PC relative addresses #42

Closed niktesic closed 1 year ago

niktesic commented 1 year ago

Calculate Concrete Memory Address for PC relative addressing mode. Use PC register value at the next instruction program point as a base register. Compute next instruction PC value as current PC value plus an instruction size.

This PR includes changes from the dependent PR, which are unwanted. My intention was to create 2 PRs for a separate review. For this reason, I will mark this only as a draft PR.

niktesic commented 1 year ago

The runOnBlameMF () function has grown too big and involves a lot of different logic in it ... I think we should refactor this.

Also, I think at some point we need to derive a new class from MachineInstr to use as specialized instruction representation to be used in crash-analyzer. a lot of the logic that is scattered across the crash-analyzer source base can be moved there including the size and address and how to deal with common cases of handling branch by creating our own phi nodes, etc.

Definitely! I absolutely agree, we should derive a new specialized MachineInstr class. One of my biggest concerns is the cost of using maps for inst size and address, and your idea would overcome that problem.

niktesic commented 1 year ago

Committed with https://github.com/cisco-open/llvm-crash-analyzer/pull/43