gdb: provide const-correct versions of addrmap::find and addrmap::foreach
Users of addrmap::find and addrmap::foreach that have a const addrmap should ideally receive const pointers to objects, to indicate they should not be modified. However, users that have a non-const addrmap should still receive a non-const pointer. To achieve this, without adding more virtual methods, make the existing find and foreach virtual methods private and prefix them with "do_". Add small non-const and const wrappers for find and foreach. Obviously, the const can be cast away, but if using static_cast instead of C-style casts, then the compiler won't let you cast the const away. I changed all the callers of addrmap::find and addrmap::foreach I could find to make them use static_cast. Change-Id: Ia8e69d022564f80d961413658fe6068edc71a094
Showing
- gdb/addrmap.c 5 additions, 5 deletionsgdb/addrmap.c
- gdb/addrmap.h 26 additions, 8 deletionsgdb/addrmap.h
- gdb/dwarf2/cooked-index.h 1 addition, 1 deletiongdb/dwarf2/cooked-index.h
- gdb/dwarf2/index-write.c 1 addition, 1 deletiongdb/dwarf2/index-write.c
- gdb/dwarf2/read.c 7 additions, 6 deletionsgdb/dwarf2/read.c
Loading
Please register or sign in to comment