This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, v3] Add command to erase all flash memory regions


On 01/19/2017 09:28 AM, Pedro Alves wrote:
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".


Fixed.

	* 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.

That looks better.


OK with that change.

Addressed the above and pushed to master as
78cbbba8e0bc8b0288f5ce4360b4689ab893aa13.

Thanks,
Luis


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]