Patchwork [review] jit: minor improvement to debug logging

login
register
mail settings
Submitter Simon Marchi (Code Review)
Date Nov. 25, 2019, 12:54 p.m.
Message ID <gerrit.1574686491000.Ie66064f3aaa1c74facfc025c8d87f3a057869779@gnutoolchain-gerrit.osci.io>
Download mbox | patch
Permalink /patch/36183/
State New
Headers show

Comments

Simon Marchi (Code Review) - Nov. 25, 2019, 12:54 p.m.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/703
......................................................................

jit: minor improvement to debug logging

gdb/ChangeLog:
2019-11-14  Mihails Strasuns  <mihails.strasuns@intel.com>
	* jit.c (jit_bfd_try_read_symtab): fix printed function name in the
	debug output.
	* jit.c (jit_unregister_code): add debug print to match
	`jit_register_code`.

Signed-off-by: Mihails Strasuns <mihails.strasuns@intel.com>
Change-Id: Ie66064f3aaa1c74facfc025c8d87f3a057869779
---
M gdb/jit.c
1 file changed, 3 insertions(+), 1 deletion(-)
Simon Marchi (Code Review) - Nov. 25, 2019, 2:06 p.m.
Simon Marchi has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/703
......................................................................


Patch Set 1:

(1 comment)

Hi Mihails,

Thanks for doing this, I just noted a small comment.

| --- gdb/jit.c
| +++ gdb/jit.c
| @@ -953,17 +953,19 @@ jit_register_code (struct gdbarch *gdbarch,
|  }
|  
|  /* This function unregisters JITed code and frees the corresponding
|     objfile.  */
|  
|  static void
|  jit_unregister_code (struct objfile *objfile)
|  {
| +  if (jit_debug)
| +    fprintf_unfiltered (gdb_stdlog, "jit_unregister_code (%p)\n", objfile);

PS1, Line 962:

For a reason I can't remember, we don't use %p (because it's not
reliable on some platform?).  Use "%s" with host_address_to_string
instead.

|    delete objfile;
|  }
|  
|  /* Look up the objfile with this code entry address.  */
|  
|  static struct objfile *
|  jit_find_objf_with_entry_addr (CORE_ADDR entry_addr)
|  {
|    for (objfile *objf : current_program_space->objfiles ())
Simon Marchi (Code Review) - Nov. 26, 2019, 11:28 a.m.
Mihails Strasuns has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/703
......................................................................


Patch Set 2:

(1 comment)

Switched to `host_address_to_string`

| --- gdb/jit.c
| +++ gdb/jit.c
| @@ -953,17 +953,19 @@ jit_register_code (struct gdbarch *gdbarch,
|  }
|  
|  /* This function unregisters JITed code and frees the corresponding
|     objfile.  */
|  
|  static void
|  jit_unregister_code (struct objfile *objfile)
|  {
| +  if (jit_debug)
| +    fprintf_unfiltered (gdb_stdlog, "jit_unregister_code (%p)\n", objfile);

PS1, Line 962:

Done

|    delete objfile;
|  }
|  
|  /* Look up the objfile with this code entry address.  */
|  
|  static struct objfile *
|  jit_find_objf_with_entry_addr (CORE_ADDR entry_addr)
|  {
|    for (objfile *objf : current_program_space->objfiles ())
Simon Marchi (Code Review) - Nov. 26, 2019, 1:51 p.m.
Tom Tromey has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/703
......................................................................


Patch Set 2: Code-Review+2

Thank you.  This is ok.
Simon Marchi (Code Review) - Nov. 27, 2019, 1:08 a.m.
Luis Machado has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/703
......................................................................


Patch Set 2:

Small nit. Use capital letters when starting the ChangeLog sentences.

Patch

diff --git a/gdb/jit.c b/gdb/jit.c
index 85a01ef..5014dfd 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -874,7 +874,7 @@ 
 
   if (jit_debug)
     fprintf_unfiltered (gdb_stdlog,
-			"jit_register_code, symfile_addr = %s, "
+			"jit_bfd_try_read_symtab, symfile_addr = %s, "
 			"symfile_size = %s\n",
 			paddress (gdbarch, code_entry->symfile_addr),
 			pulongest (code_entry->symfile_size));
@@ -958,6 +958,8 @@ 
 static void
 jit_unregister_code (struct objfile *objfile)
 {
+  if (jit_debug)
+    fprintf_unfiltered (gdb_stdlog, "jit_unregister_code (%p)\n", objfile);
   delete objfile;
 }