diff options
author | Mike Frysinger <vapier@gentoo.org> | 2021-01-12 05:39:16 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2021-01-30 01:15:04 -0500 |
commit | 18d4b488f4538f11cfdc618ddfb26eaf2c955fb7 (patch) | |
tree | d2fab6fdb0fd5af67c287be85cc83a0cc6d21384 /sim | |
parent | 88f68ee277e3f3dd5b94360e797f06e6378ea844 (diff) | |
download | gdb-18d4b488f4538f11cfdc618ddfb26eaf2c955fb7.zip gdb-18d4b488f4538f11cfdc618ddfb26eaf2c955fb7.tar.gz gdb-18d4b488f4538f11cfdc618ddfb26eaf2c955fb7.tar.bz2 |
sim: profile: fix bucketing with 64-bit targets
When the target's PC is 64-bits, this shift expands into a range of
8 * 8 - 1 which doesn't work with 32-bit constants. Force it to be
a 64-bit value all the time and let the compiler truncate it.
Diffstat (limited to 'sim')
-rw-r--r-- | sim/common/ChangeLog | 4 | ||||
-rw-r--r-- | sim/common/sim-profile.c | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index cafb4b2..dbf030d 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,5 +1,9 @@ 2021-01-30 Mike Frysinger <vapier@gentoo.org> + * sim-profile.c (profile_pc_init): Change 1 in shifts to 1ULL. + +2021-01-30 Mike Frysinger <vapier@gentoo.org> + * sim-hw.c (merge_device_file): Replace fgets with getline. 2021-01-30 Mike Frysinger <vapier@gentoo.org> diff --git a/sim/common/sim-profile.c b/sim/common/sim-profile.c index f4ce89f..5508f0f 100644 --- a/sim/common/sim-profile.c +++ b/sim/common/sim-profile.c @@ -554,7 +554,7 @@ profile_pc_init (SIM_DESC sd) { /* nr_buckets = (full-address-range / 2) / (bucket_size / 2) */ PROFILE_PC_NR_BUCKETS (data) = - ((1 << sizeof (sim_cia) * (8 - 1)) + ((1ULL << sizeof (sim_cia) * (8 - 1)) / (PROFILE_PC_BUCKET_SIZE (data) / 2)); } else @@ -573,7 +573,7 @@ profile_pc_init (SIM_DESC sd) { if (PROFILE_PC_END (data) == 0) /* bucket_size = (full-address-range / 2) / (nr_buckets / 2) */ - bucket_size = ((1 << ((sizeof (sim_cia) * 8) - 1)) + bucket_size = ((1ULL << ((sizeof (sim_cia) * 8) - 1)) / (PROFILE_PC_NR_BUCKETS (data) / 2)); else bucket_size = ((PROFILE_PC_END (data) |