@@ -187,6 +187,9 @@ bool ins__is_fused(struct arch *arch, const char *ins1, const char *ins2)
187
187
static int call__parse (struct arch * arch , struct ins_operands * ops , struct map * map )
188
188
{
189
189
char * endptr , * tok , * name ;
190
+ struct addr_map_symbol target = {
191
+ .map = map ,
192
+ };
190
193
191
194
ops -> target .addr = strtoull (ops -> raw , & endptr , 16 );
192
195
@@ -208,28 +211,29 @@ static int call__parse(struct arch *arch, struct ins_operands *ops, struct map *
208
211
ops -> target .name = strdup (name );
209
212
* tok = '>' ;
210
213
211
- return ops -> target .name == NULL ? -1 : 0 ;
214
+ if (ops -> target .name == NULL )
215
+ return -1 ;
216
+ find_target :
217
+ target .addr = map__objdump_2mem (map , ops -> target .addr );
212
218
213
- indirect_call :
214
- tok = strchr (endptr , '*' );
215
- if (tok == NULL ) {
216
- struct symbol * sym = map__find_symbol (map , map -> map_ip (map , ops -> target .addr ));
217
- if (sym != NULL )
218
- ops -> target .name = strdup (sym -> name );
219
- else
220
- ops -> target .addr = 0 ;
221
- return 0 ;
222
- }
219
+ if (map_groups__find_ams (& target ) == 0 &&
220
+ map__rip_2objdump (target .map , map -> map_ip (target .map , target .addr )) == ops -> target .addr )
221
+ ops -> target .sym = target .sym ;
223
222
224
- ops -> target .addr = strtoull (tok + 1 , NULL , 16 );
225
223
return 0 ;
224
+
225
+ indirect_call :
226
+ tok = strchr (endptr , '*' );
227
+ if (tok != NULL )
228
+ ops -> target .addr = strtoull (tok + 1 , NULL , 16 );
229
+ goto find_target ;
226
230
}
227
231
228
232
static int call__scnprintf (struct ins * ins , char * bf , size_t size ,
229
233
struct ins_operands * ops )
230
234
{
231
- if (ops -> target .name )
232
- return scnprintf (bf , size , "%-6s %s" , ins -> name , ops -> target .name );
235
+ if (ops -> target .sym )
236
+ return scnprintf (bf , size , "%-6s %s" , ins -> name , ops -> target .sym -> name );
233
237
234
238
if (ops -> target .addr == 0 )
235
239
return ins__raw_scnprintf (ins , bf , size , ops );
@@ -1283,16 +1287,16 @@ static int symbol__parse_objdump_line(struct symbol *sym, FILE *file,
1283
1287
dl -> ops .target .offset_avail = true;
1284
1288
}
1285
1289
1286
- /* kcore has no symbols, so add the call target name */
1287
- if (dl -> ins .ops && ins__is_call (& dl -> ins ) && !dl -> ops .target .name ) {
1290
+ /* kcore has no symbols, so add the call target symbol */
1291
+ if (dl -> ins .ops && ins__is_call (& dl -> ins ) && !dl -> ops .target .sym ) {
1288
1292
struct addr_map_symbol target = {
1289
1293
.map = map ,
1290
1294
.addr = dl -> ops .target .addr ,
1291
1295
};
1292
1296
1293
1297
if (!map_groups__find_ams (& target ) &&
1294
1298
target .sym -> start == target .al_addr )
1295
- dl -> ops .target .name = strdup ( target .sym -> name ) ;
1299
+ dl -> ops .target .sym = target .sym ;
1296
1300
}
1297
1301
1298
1302
annotation_line__add (& dl -> al , & notes -> src -> source );
0 commit comments