{"action":"created","issue":{"url":"https://api.github.com/repos/paul99/v8m-rb/issues/147","labels_url":"https://api.github.com/repos/paul99/v8m-rb/issues/147/labels{/name}","comments_url":"https://api.github.com/repos/paul99/v8m-rb/issues/147/comments","events_url":"https://api.github.com/repos/paul99/v8m-rb/issues/147/events","html_url":"https://github.com/paul99/v8m-rb/issues/147","id":89463797,"number":147,"title":"disassembler enhancement request","user":{"login":"paul99","id":131475,"avatar_url":"https://avatars.githubusercontent.com/u/131475?v=3","gravatar_id":"","url":"https://api.github.com/users/paul99","html_url":"https://github.com/paul99","followers_url":"https://api.github.com/users/paul99/followers","following_url":"https://api.github.com/users/paul99/following{/other_user}","gists_url":"https://api.github.com/users/paul99/gists{/gist_id}","starred_url":"https://api.github.com/users/paul99/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paul99/subscriptions","organizations_url":"https://api.github.com/users/paul99/orgs","repos_url":"https://api.github.com/users/paul99/repos","events_url":"https://api.github.com/users/paul99/events{/privacy}","received_events_url":"https://api.github.com/users/paul99/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/paul99/v8m-rb/labels/pri2","name":"pri2","color":"eb6420"}],"state":"open","locked":false,"assignee":{"login":"ilijapavlovic","id":12394603,"avatar_url":"https://avatars.githubusercontent.com/u/12394603?v=3","gravatar_id":"","url":"https://api.github.com/users/ilijapavlovic","html_url":"https://github.com/ilijapavlovic","followers_url":"https://api.github.com/users/ilijapavlovic/followers","following_url":"https://api.github.com/users/ilijapavlovic/following{/other_user}","gists_url":"https://api.github.com/users/ilijapavlovic/gists{/gist_id}","starred_url":"https://api.github.com/users/ilijapavlovic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ilijapavlovic/subscriptions","organizations_url":"https://api.github.com/users/ilijapavlovic/orgs","repos_url":"https://api.github.com/users/ilijapavlovic/repos","events_url":"https://api.github.com/users/ilijapavlovic/events{/privacy}","received_events_url":"https://api.github.com/users/ilijapavlovic/received_events","type":"User","site_admin":false},"milestone":null,"comments":22,"created_at":"2015-06-19T04:36:16Z","updated_at":"2015-07-30T06:03:51Z","closed_at":null,"body":"When we disassmble mips & mips64 relative branch instructions, they look like this:\r\n\r\n    0x4eb4f63c   124  10200007       beq     at, zero_reg, 7\r\n    0x4eb4f640   128  00000000       nop\r\n    0x4eb4f644   132  3c190000       lui     t9, 0x0             ;; code: BUILTIN\r\n    0x4eb4f648   136  37394eb4       ori     t9, t9, 0x4eb4\r\n    ....\r\n\r\nThe 7 is extracted from the instruction encoding, but for the human to figure out where it is going, they have to run the calculation of (pc_ + 4) + (branch_distance << 2). Annoying to calculate all the time. For larger distances you can't just count instructions.\r\n\r\nThe other arch's do a much more human friendly job. They give absolute address of destination, plus usually also the pc-realtive offset from start of function, which is very easy to parse by eye. Here is arm32:\r\n\r\n                      -- B3 start (deconstruct frame) --\r\n    0x5b83cce0    96  e59a0014       ldr r0, [r10, #+20]\r\n    0x5b83cce4   100  e1a0d00b       mov sp, fp\r\n    0x5b83cce8   104  e8bd4800       ldmia sp!, {fp, lr}\r\n    0x5b83ccec   108  e28dd004       add sp, sp, #4\r\n    0x5b83ccf0   112  e12fff1e       bx lr\r\n                      -- B4 start (no frame) --\r\n                      -- B1 start (deferred) --\r\n    0x5b83ccf4   116  e3071c0c       movw r1, #31756\r\n    0x5b83ccf8   120  e3401b50       movt r1, #2896\r\n    0x5b83ccfc   124  e3a00000       mov r0, #0\r\n    0x5b83cd00   128  e51b7010       ldr r7, [fp, #-16]\r\n    0x5b83cd04   132  e59fc01c       ldr ip, [pc, #+28]          ;; code: STUB, CEntryStub, minor: 0\r\n    0x5b83cd08   136  e12fff3c       blx ip\r\n    0x5b83cd0c   140  eafffff3       b -44 -> 96  (0x5b83cce0)\r\n\r\nYou get to that last instruction and see immediately where it is going. You don't even have to look at the 32-bit hex address. x64 does something very similar.\r\n\r\nPlease update the disassembler to do this."},"comment":{"url":"https://api.github.com/repos/paul99/v8m-rb/issues/comments/126195975","html_url":"https://github.com/paul99/v8m-rb/issues/147#issuecomment-126195975","issue_url":"https://api.github.com/repos/paul99/v8m-rb/issues/147","id":126195975,"user":{"login":"ilijapavlovic","id":12394603,"avatar_url":"https://avatars.githubusercontent.com/u/12394603?v=3","gravatar_id":"","url":"https://api.github.com/users/ilijapavlovic","html_url":"https://github.com/ilijapavlovic","followers_url":"https://api.github.com/users/ilijapavlovic/followers","following_url":"https://api.github.com/users/ilijapavlovic/following{/other_user}","gists_url":"https://api.github.com/users/ilijapavlovic/gists{/gist_id}","starred_url":"https://api.github.com/users/ilijapavlovic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ilijapavlovic/subscriptions","organizations_url":"https://api.github.com/users/ilijapavlovic/orgs","repos_url":"https://api.github.com/users/ilijapavlovic/repos","events_url":"https://api.github.com/users/ilijapavlovic/events{/privacy}","received_events_url":"https://api.github.com/users/ilijapavlovic/received_events","type":"User","site_admin":false},"created_at":"2015-07-30T06:03:51Z","updated_at":"2015-07-30T06:03:51Z","body":"Ok."}}