This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH, v3] Add command to erase all flash memory regions
- From: Pedro Alves <palves at redhat dot com>
- To: Luis Machado <lgustavo at codesourcery dot com>, gdb-patches at sourceware dot org
- Date: Thu, 19 Jan 2017 15:28:20 +0000
- Subject: Re: [PATCH, v3] Add command to erase all flash memory regions
- Authentication-results: sourceware.org; auth=none
- References: <1484659856-22290-1-git-send-email-lgustavo@codesourcery.com>
> 2017-01-17 Mike Wrighton <mike_wrighton@codesourcery.com>
> Luis Machado <lgustavo@codesourcery.com>
>
> * NEWS (New commands): Mention flash-erase.
> (New MI commands): Mention target-flash-erase.
> * mi/mi-cmds.c (mi_cmd_target_flash_erase): Added target-flash-erase MI
> command.
"Add".
> * mi/mi-cmds.h (mi_cmd_target_flash_erase): New declaration.
> * mi/mi-main.c (mi_cmd_target_flash_erase): New function.
> * target.c (flash_erase_command): New function.
> (initialize_targets): Add new flash-erase command.
> * target.h (flash_erase_command): New declaration.
> +@smallexample
> +(gdb)
> +-target-flash-erase
> +^done,erased-regions=@{address="0x0",size="0x40000"@}
> +(gdb)
> + current_uiout->message (", size = ");
> + current_uiout->field_fmt ("size", "0x%s", phex (m->hi - m->lo, 0));
phex always prints 64-bit hex numbers with leading "00000000". So
I think that instead of:
+^done,erased-regions=@{address="0x0",size="0x40000"@}
you're getting something like:
+^done,erased-regions=@{address="0x0",size="0x0000000000040000"@}
You can avoid that by using phex_nz instead. Or better, use
hex_string, and remove the "0x" from the string, since hex_string
already handles that.
OK with that change.
Thanks,
Pedro Alves