Index: gdb/nacl-tdep.c |
diff --git a/gdb/nacl-tdep.c b/gdb/nacl-tdep.c |
index 91db26266505d7c8edc26f3f3df889bb9363a586..edb376398bc6410b8ee3b97b0125e12c7df3dab4 100644 |
--- a/gdb/nacl-tdep.c |
+++ b/gdb/nacl-tdep.c |
@@ -81,6 +81,24 @@ amd64_nacl_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) |
set_solib_svr4_fetch_link_map_offsets (gdbarch, |
svr4_lp64_fetch_link_map_offsets); |
nacl_init_abi (info, gdbarch); |
+ |
+ /* NaCl data model. |
+ |
+ WARNING! This might confuse a lot of code, as it uses |
+ if (set_gdbarch_ptr_bit (gdbarch) == <bits>) |
+ to distinguish between i386 and x86_64 (lame!). Luckily, most of that |
+ code is about native debugging and syscalls, so it is not used for NaCl. |
+ |
+ TODO(eaeltsin): find better way to distinguish between i386 and x86_64! */ |
+ set_gdbarch_long_bit (gdbarch, 32); |
+ set_gdbarch_ptr_bit (gdbarch, 32); |
+ |
+ /* TODO(eaeltsin): we might use address size instead of pointer size to |
+ distinguish between i386 and x86_64... At least address size is not |
+ a property of the data model. */ |
+ set_gdbarch_addr_bit (gdbarch, 64); |
+ |
+ /* How to extract addresses from registers. */ |
set_gdbarch_addr_bits_remove (gdbarch, amd64_nacl_addr_bits_remove); |
set_gdbarch_unwind_pc (gdbarch, amd64_nacl_unwind_pc); |
set_gdbarch_unwind_sp (gdbarch, amd64_nacl_unwind_sp); |