Comments (9)
isn't gdb aware of the architecture details?
from riscv-binutils-gdb.
I think it should be from misa and maybe other csrs but at the moment to debug our specific RV32IM I have to do this otherwise gdb will assume a 64 bit target and ability to use compressed BP instructions:
set arch riscv:rv32
set riscv use_compressed_breakpoints no
from riscv-binutils-gdb.
gdb attempts to read MISA, and if C is set it will use compressed breakpoints: https://github.com/riscv/riscv-binutils-gdb/blob/riscv-binutils-2.29/gdb/riscv-tdep.c#L231
In older versions of the code it would be unable to read MISA if it was at the old location (it moved in some priv spec update). 697d5b8 fixed that issue.
from riscv-binutils-gdb.
But why bother trying to use compressed BP instructions when uncompressed BP instructions are universally compatible?
Seems like unnecessary complication for the implementation and the end user to use compressed BP instructions?
from riscv-binutils-gdb.
The software breakpoint instruction can be no longer than the instruction it is replacing, in case the program contains a jump to the instruction right after it. Rather than figuring out the size of the instruction, it's much simpler just to use the smallest supported breakpoint instruction.
from riscv-binutils-gdb.
The software breakpoint instruction can be no longer than the instruction it is replacing, in case the program contains a jump to the instruction right after it. Rather than figuring out the size of the instruction, it's much simpler just to use the smallest supported breakpoint instruction.
Thanks Tim - that explains matters alright.
gdb attempts to read MISA, and if C is set it will use compressed breakpoints: https://github.com/riscv/riscv-binutils-gdb/blob/riscv-binutils-2.29/gdb/riscv-tdep.c#L231
In older versions of the code it would be unable to read MISA if it was at the old location (it moved in some priv spec update). 697d5b8 fixed that issue.
So a build of gdb with that mod no longer needs:
set riscv use_compressed_breakpoints no
regardless of the draft privilege spec that the target adheres to (1.9, 1.9.1 or 1.10)?
from riscv-binutils-gdb.
So a build of gdb with that mod no longer needs:
set riscv use_compressed_breakpoints no
I just tried it with an RV32IM adhering to the 1.9 priv spec and that seems to be the case - i.e. it does the right thing (uses non compressed BP instruction) even when set riscv use_compressed_breakpoints no) is NOT specified.
Unfortunately set arch riscv:rv32 is still needed - shouldn't it be able to figure out the XLEN from misa or some other CSR to obviate the need for this?
from riscv-binutils-gdb.
Unfortunately set arch riscv:rv32 is still needed - shouldn't it be able to figure out the XLEN from misa or some other CSR to obviate the need for this?
Yes, but unfortunately it's not so easily implemented. This is #54
from riscv-binutils-gdb.
Since the rationale for using compressed bps where supported was explained above I'm closing this issue now.
from riscv-binutils-gdb.
Related Issues (20)
- How gdb register csr HOT 2
- riscv64 gdb doesn't recognize riscv32 symbol tables: "Sorry, Dave" HOT 1
- GDB internal error HOT 1
- About the opcode constraints documentation. HOT 3
- What is the expected behavior upon hitting a EBREAK? HOT 3
- riscv-binutils-2.35-rvb: `_`instead of `.` ? HOT 2
- How to add a new custom instruction? HOT 6
- riscv-binutils-2.35-rvb: wrong match for xperm.h HOT 2
- a tricky one about gdb HOT 5
- Overlappings on the operand name for p ext
- Registers are interpreted as 64-bit when architecture is set to rv32 HOT 2
- ld: cannot find default versions of the ISA extension `i', when linking rv32e HOT 5
- GDB build fails on CentOS 7.9.2009 HOT 1
- Is there a way to let gdbserver instruct gdb client to use compressed breakpoints? HOT 2
- objdump cant correctly dissemble instructions that reuse other's encoding
- right way to compress branching instuction (decbnez from ZCE extension)
- Objdump and auipc: the immediate value should be displayed shifted HOT 2
- Does anyone know the status about zfh support of binutils? HOT 5
- GDB Single Step fails on RISCV, EL2 with ICCM HOT 1
- continue function not working??? HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from riscv-binutils-gdb.