diff mbox series

[15/18] htm: Print dump file from library

Message ID 20180619052535.24043-15-mikey@neuling.org
State Accepted
Headers show
Series [01/18] Make -a the default for probe | expand

Commit Message

Michael Neuling June 19, 2018, 5:25 a.m. UTC
Signed-off-by: Michael Neuling <mikey@neuling.org>
---
 libpdbg/htm.c | 1 +
 src/htm.c     | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)

Comments

Alistair Popple June 25, 2018, 5:10 a.m. UTC | #1
Thanks Mikey. I had to apply the following fixup to this patch:

diff --git a/libpdbg/htm.c b/libpdbg/htm.c
index c4eeabb..4a49628 100644
--- a/libpdbg/htm.c
+++ b/libpdbg/htm.c
@@ -965,7 +965,7 @@ static int do_htm_dump(struct htm *htm, uint64_t size, char *filename)
 	if (size == 0)
 		size = status.mem_last - status.mem_base;
 
-	printf("Dumping %li MB to %s\n", size >> 20, filename);
+	printf("Dumping %" PRIi64 "i MB to %s\n", size >> 20, filename);
 	if (status.mem_last - status.mem_base > size) {
 		PR_INFO("Requested size is larger than trace 0x%" PRIx64" vs 0x%" PRIx64 "\n",
 				size, status.mem_last - status.mem_base);

Which fixes the following error when building for ARM (or other 32-bit architectures):

cc1: warnings being treated as errors
libpdbg/htm.c: In function 'do_htm_dump':
libpdbg/htm.c:968:2: error: format '%li' expects type 'long int', but argument 2 has type 'uint64_t'

If the above fix does not look correct to you please let me know.

- Alistair

On Tuesday, 19 June 2018 3:25:32 PM AEST Michael Neuling wrote:
> Signed-off-by: Michael Neuling <mikey@neuling.org>
> ---
>  libpdbg/htm.c | 1 +
>  src/htm.c     | 1 -
>  2 files changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libpdbg/htm.c b/libpdbg/htm.c
> index b037997245..9c229dc99f 100644
> --- a/libpdbg/htm.c
> +++ b/libpdbg/htm.c
> @@ -924,6 +924,7 @@ static int do_htm_dump(struct htm *htm, uint64_t size, char *filename)
>  	if (size == 0)
>  		size = status.mem_last - status.mem_base;
>  
> +	printf("Dumping %li MB to %s\n", size >> 20, filename);
>  	if (status.mem_last - status.mem_base > size) {
>  		PR_INFO("Requested size is larger than trace 0x%" PRIx64" vs 0x%" PRIx64 "\n",
>  				size, status.mem_last - status.mem_base);
> diff --git a/src/htm.c b/src/htm.c
> index a58a968c08..ae7e1ea1e2 100644
> --- a/src/htm.c
> +++ b/src/htm.c
> @@ -166,7 +166,6 @@ static int run_dump(enum htm_type type)
>  		/* size = 0 will dump everything */
>  		printf("Dumping HTM@");
>  		print_htm_address(type, target);
> -		printf("File: %s\n", filename);
>  		if (htm_dump(target, 0, filename) != 1) {
>  			printf("Couldn't dump HTM@");
>  			print_htm_address(type, target);
>
diff mbox series

Patch

diff --git a/libpdbg/htm.c b/libpdbg/htm.c
index b037997245..9c229dc99f 100644
--- a/libpdbg/htm.c
+++ b/libpdbg/htm.c
@@ -924,6 +924,7 @@  static int do_htm_dump(struct htm *htm, uint64_t size, char *filename)
 	if (size == 0)
 		size = status.mem_last - status.mem_base;
 
+	printf("Dumping %li MB to %s\n", size >> 20, filename);
 	if (status.mem_last - status.mem_base > size) {
 		PR_INFO("Requested size is larger than trace 0x%" PRIx64" vs 0x%" PRIx64 "\n",
 				size, status.mem_last - status.mem_base);
diff --git a/src/htm.c b/src/htm.c
index a58a968c08..ae7e1ea1e2 100644
--- a/src/htm.c
+++ b/src/htm.c
@@ -166,7 +166,6 @@  static int run_dump(enum htm_type type)
 		/* size = 0 will dump everything */
 		printf("Dumping HTM@");
 		print_htm_address(type, target);
-		printf("File: %s\n", filename);
 		if (htm_dump(target, 0, filename) != 1) {
 			printf("Couldn't dump HTM@");
 			print_htm_address(type, target);