@@ -239,10 +239,20 @@ static int jump__parse(struct arch *arch __maybe_unused, struct ins_operands *op
239
239
const char * s = strchr (ops -> raw , '+' );
240
240
const char * c = strchr (ops -> raw , ',' );
241
241
242
- if (c ++ != NULL )
242
+ /*
243
+ * skip over possible up to 2 operands to get to address, e.g.:
244
+ * tbnz w0, #26, ffff0000083cd190 <security_file_permission+0xd0>
245
+ */
246
+ if (c ++ != NULL ) {
243
247
ops -> target .addr = strtoull (c , NULL , 16 );
244
- else
248
+ if (!ops -> target .addr ) {
249
+ c = strchr (c , ',' );
250
+ if (c ++ != NULL )
251
+ ops -> target .addr = strtoull (c , NULL , 16 );
252
+ }
253
+ } else {
245
254
ops -> target .addr = strtoull (ops -> raw , NULL , 16 );
255
+ }
246
256
247
257
if (s ++ != NULL ) {
248
258
ops -> target .offset = strtoull (s , NULL , 16 );
@@ -257,10 +267,27 @@ static int jump__parse(struct arch *arch __maybe_unused, struct ins_operands *op
257
267
static int jump__scnprintf (struct ins * ins , char * bf , size_t size ,
258
268
struct ins_operands * ops )
259
269
{
270
+ const char * c = strchr (ops -> raw , ',' );
271
+
260
272
if (!ops -> target .addr || ops -> target .offset < 0 )
261
273
return ins__raw_scnprintf (ins , bf , size , ops );
262
274
263
- return scnprintf (bf , size , "%-6.6s %" PRIx64 , ins -> name , ops -> target .offset );
275
+ if (c != NULL ) {
276
+ const char * c2 = strchr (c + 1 , ',' );
277
+
278
+ /* check for 3-op insn */
279
+ if (c2 != NULL )
280
+ c = c2 ;
281
+ c ++ ;
282
+
283
+ /* mirror arch objdump's space-after-comma style */
284
+ if (* c == ' ' )
285
+ c ++ ;
286
+ }
287
+
288
+ return scnprintf (bf , size , "%-6.6s %.*s%" PRIx64 ,
289
+ ins -> name , c ? c - ops -> raw : 0 , ops -> raw ,
290
+ ops -> target .offset );
264
291
}
265
292
266
293
static struct ins_ops jump_ops = {
0 commit comments