@@ -1245,7 +1245,8 @@ amd64_windows_skip_trampoline_code (frame_info_ptr frame, CORE_ADDR pc)
12451245 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch );
12461246
12471247 /* Check for jmp *<offset>(%rip) (jump near, absolute indirect (/4)). */
1248- if (pc && read_memory_unsigned_integer (pc , 2 , byte_order ) == 0x25ff )
1248+ unsigned instr = pc ? read_memory_unsigned_integer (pc , 2 , byte_order ) : 0 ;
1249+ if (instr == 0x25ff )
12491250 {
12501251 /* Get opcode offset and see if we can find a reference in our data. */
12511252 ULONGEST offset
@@ -1264,8 +1265,26 @@ amd64_windows_skip_trampoline_code (frame_info_ptr frame, CORE_ADDR pc)
12641265 {
12651266 if (startswith (symname , "__imp_" )
12661267 || startswith (symname , "_imp_" ))
1267- destination
1268- = read_memory_unsigned_integer (indirect_addr , 8 , byte_order );
1268+ {
1269+ destination
1270+ = read_memory_unsigned_integer (indirect_addr , 8 , byte_order );
1271+
1272+ pc = destination ;
1273+ instr = pc ? read_memory_unsigned_integer (pc , 2 , byte_order ) : 0 ;
1274+ }
1275+ }
1276+ }
1277+
1278+ if ((instr & 0xff ) == 0xe9 )
1279+ {
1280+ struct minimal_symbol * sym = lookup_minimal_symbol_by_pc (pc ).minsym ;
1281+ const char * symname = sym ? sym -> linkage_name () : NULL ;
1282+
1283+ if (symname && startswith (symname , "__thunk_" ))
1284+ {
1285+ ULONGEST offset
1286+ = read_memory_unsigned_integer (pc + 1 , 4 , byte_order );
1287+ destination = pc + offset + 5 ;
12691288 }
12701289 }
12711290
0 commit comments