Hi Matthias, thanks for tracking down this problem! Please take a look at base/compiler.hh for some macros which hide the compiler specific details of how to set a structure as packed, prevent inlining, etc. If only a pragma works on your compiler, you might need to update that file since I don't see any pragmas there now.
Once you've switched over to M5_ATTR_PACKED (the macro for this particular situation), could you please submit your patch to gerrit for review? You should have permission to do that, and that will start the process of getting it checked in. Gabe On Tue, May 2, 2017 at 8:48 AM, Matthias Hille <[email protected] > wrote: > Hi all, > > I noticed that newer gdb versions break the ability to attach a remote > debugger to debug simulated code. > The good thing is, I already figured out why. Starting with commit > 9dc193c3be > <https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=9dc193c3be85aafa60ceff57d3b0430af607b4ce> > gdb does bounds checking for every register you sent to it via the remote > debugging protocol. If a register is not sent complete it will output > "Truncated register xy in remote 'g' packet" and that's what actually > happens with the current gem5 version. > Gem5 transmits 23 registers (17 64bit regs and 7 32bit regs) that should > result in a total amount of 164 bytes. But it actually send 168 bytes, > making gdb believe it will receive a 24th register. For the 24th register > gdb expects a size of 10 bytes and hence complains about it and refuses to > continue working. > The reason for the 4 byte overlap is that the structure used to keep > register contents is 8-bytes aligned. > So my current fix is packing that struct so gem5 won't send the padding > bytes. (Diff is attached) > > I am not entirely sure if this breaks compilation for some of you. I used > #pragma pack() to tell the compiler to pack the struct, and most of the > compilers should support it. > Cheers, > Matthias > > _______________________________________________ > gem5-users mailing list > [email protected] > http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users >
_______________________________________________ gem5-users mailing list [email protected] http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
