gdb_server, target: Add target_address_bits()

Targets can use this to expose how many address bits there are.
gdb_server uses this to send gdb the appropriate upper limit in the
memory-map. (Before this change the upper limit would only be correct
for 32-bit targets.)

Change-Id: Idb0933255ed53951fcfb05e040674bcdf19441e1
Signed-off-by: Tim Newsome <tim@sifive.com>
Reviewed-on: http://openocd.zylin.com/4947
Tested-by: jenkins
Reviewed-by: Peter Mamonov <pmamonov@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
This commit is contained in:
Tim Newsome
2019-02-25 14:02:30 -08:00
committed by Matthias Welwarsky
parent 85ba2dc4c6
commit 57e30102ea
5 changed files with 43 additions and 6 deletions

View File

@@ -1921,11 +1921,10 @@ static int gdb_memory_map(struct connection *connection,
if (ram_start != 0)
xml_printf(&retval, &xml, &pos, &size,
"<memory type=\"ram\" start=\"" TARGET_ADDR_FMT "\" "
"length=\"0x%x\"/>\n",
ram_start, 0-ram_start);
/* ELSE a flash chip could be at the very end of the 32 bit address
* space, in which case ram_start will be precisely 0
*/
"length=\"" TARGET_ADDR_FMT "\"/>\n",
ram_start, target_address_max(target) - ram_start + 1);
/* ELSE a flash chip could be at the very end of the address space, in
* which case ram_start will be precisely 0 */
free(banks);