Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH: mi-cmd-file.c]
@ 2008-01-10  3:30 Nick Roberts
  2008-01-29 18:08 ` Daniel Jacobowitz
  0 siblings, 1 reply; 7+ messages in thread
From: Nick Roberts @ 2008-01-10  3:30 UTC (permalink / raw)
  To: gdb-patches


Emacs currently uses "info source" as part of it's front end to GDB.  This
patch allows it to use -file-list-exec-source-file instead.

-- 
Nick                                           http://www.inet.net.nz/~nickrob


2008-01-10  Nick Roberts  <nickrob@snap.net.nz>

	* mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file): Add field
	for preprocessor macro information.



*** mi-cmd-file.c.~1.7.~	2008-01-04 10:24:34.000000000 +1300
--- mi-cmd-file.c	2008-01-10 16:15:10.000000000 +1300
*************** mi_cmd_file_list_exec_source_file(char *
*** 59,64 ****
--- 59,66 ----
    if (st.symtab->fullname)
    ui_out_field_string (uiout, "fullname", st.symtab->fullname);
  
+   ui_out_field_int (uiout, "macro-info", st.symtab->macro_table ? 1 : 0);
+ 
    return MI_CMD_DONE;
  }


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH: mi-cmd-file.c]
  2008-01-10  3:30 [PATCH: mi-cmd-file.c] Nick Roberts
@ 2008-01-29 18:08 ` Daniel Jacobowitz
  2008-01-30  1:57   ` Nick Roberts
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Jacobowitz @ 2008-01-29 18:08 UTC (permalink / raw)
  To: Nick Roberts; +Cc: gdb-patches

On Thu, Jan 10, 2008 at 04:29:37PM +1300, Nick Roberts wrote:
> 
> Emacs currently uses "info source" as part of it's front end to GDB.  This
> patch allows it to use -file-list-exec-source-file instead.
> 
> -- 
> Nick                                           http://www.inet.net.nz/~nickrob
> 
> 
> 2008-01-10  Nick Roberts  <nickrob@snap.net.nz>
> 
> 	* mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file): Add field
> 	for preprocessor macro information.

Needs a manual update, of course.  Otherwise looks OK to me.

GUD uses this to avoid expanding macros if it knows they are not
available, right?


-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH: mi-cmd-file.c]
  2008-01-29 18:08 ` Daniel Jacobowitz
@ 2008-01-30  1:57   ` Nick Roberts
  2008-01-30  3:06     ` Daniel Jacobowitz
  0 siblings, 1 reply; 7+ messages in thread
From: Nick Roberts @ 2008-01-30  1:57 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

 > > 2008-01-10  Nick Roberts  <nickrob@snap.net.nz>
 > > 
 > > 	* mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file): Add field
 > > 	for preprocessor macro information.
 > 
 > Needs a manual update, of course.  Otherwise looks OK to me.
 > 
 > GUD uses this to avoid expanding macros if it knows they are not
 > available, right?

Actually Emacs turns tooltips off if there is no macro information in case
of something like:

#define STOP abort ()

and the mouse hovers over STOP.  Macro information allows Emacs to ensure that
a macro doesn't expand to a function first.

I've committed it with the formatting changes below as obvious.

Thanks.

-- 
Nick                                           http://www.inet.net.nz/~nickrob


2008-01-30  Nick Roberts  <nickrob@snap.net.nz>

	* mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file):  Add field
	for preprocessor macro information.  Formatting changes.

*** mi-cmd-file.c.~1.7.~	2008-01-04 10:24:34.000000000 +1300
--- mi-cmd-file.c	2008-01-10 16:15:10.000000000 +1300
***************
*** 29,46 ****
     current file being executed. */
  
  enum mi_cmd_result
! mi_cmd_file_list_exec_source_file(char *command, char **argv, int argc)
  {
    struct symtab_and_line st;
    int optind = 0;
    char *optarg;
    
!   if ( !mi_valid_noargs("mi_cmd_file_list_exec_source_file", argc, argv) )
      error (_("mi_cmd_file_list_exec_source_file: Usage: No args"));
  
    /* Set the default file and line, also get them */
!   set_default_source_symtab_and_line();
!   st = get_current_source_symtab_and_line();
  
    /* We should always get a symtab. 
       Apparently, filename does not need to be tested for NULL.
--- 29,46 ----
     current file being executed. */
  
  enum mi_cmd_result
! mi_cmd_file_list_exec_source_file (char *command, char **argv, int argc)
  {
    struct symtab_and_line st;
    int optind = 0;
    char *optarg;
    
!   if (!mi_valid_noargs ("mi_cmd_file_list_exec_source_file", argc, argv))
      error (_("mi_cmd_file_list_exec_source_file: Usage: No args"));
  
    /* Set the default file and line, also get them */
!   set_default_source_symtab_and_line ();
!   st = get_current_source_symtab_and_line ();
  
    /* We should always get a symtab. 
       Apparently, filename does not need to be tested for NULL.
*************** mi_cmd_file_list_exec_source_file(char *
*** 59,64 ****
--- 59,66 ----
    if (st.symtab->fullname)
    ui_out_field_string (uiout, "fullname", st.symtab->fullname);
  
+   ui_out_field_int (uiout, "macro-info", st.symtab->macro_table ? 1 : 0);
+ 
    return MI_CMD_DONE;
  }
  


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH: mi-cmd-file.c]
  2008-01-30  1:57   ` Nick Roberts
@ 2008-01-30  3:06     ` Daniel Jacobowitz
  2008-01-30  3:32       ` Nick Roberts
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Jacobowitz @ 2008-01-30  3:06 UTC (permalink / raw)
  To: Nick Roberts; +Cc: gdb-patches

On Wed, Jan 30, 2008 at 02:49:09PM +1300, Nick Roberts wrote:
>  > > 2008-01-10  Nick Roberts  <nickrob@snap.net.nz>
>  > > 
>  > > 	* mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file): Add field
>  > > 	for preprocessor macro information.
>  > 
>  > Needs a manual update, of course.  Otherwise looks OK to me.
>  > 
>  > GUD uses this to avoid expanding macros if it knows they are not
>  > available, right?
> 
> Actually Emacs turns tooltips off if there is no macro information in case
> of something like:
> 
> #define STOP abort ()
> 
> and the mouse hovers over STOP.  Macro information allows Emacs to ensure that
> a macro doesn't expand to a function first.

Hmm, that sounds silly.  If there's no macro information, GDB won't be
able to expand STOP to a function...

> I've committed it with the formatting changes below as obvious.

OK - be sure to do the manual update.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH: mi-cmd-file.c]
  2008-01-30  3:06     ` Daniel Jacobowitz
@ 2008-01-30  3:32       ` Nick Roberts
  2008-01-30  7:19         ` Vladimir Prus
  0 siblings, 1 reply; 7+ messages in thread
From: Nick Roberts @ 2008-01-30  3:32 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

 > > Actually Emacs turns tooltips off if there is no macro information in case
 > > of something like:
 > > 
 > > #define STOP abort ()
 > > 
 > > and the mouse hovers over STOP.  Macro information allows Emacs to ensure
 > > that a macro doesn't expand to a function first.
 > 
 > Hmm, that sounds silly.  If there's no macro information, GDB won't be
 > able to expand STOP to a function...

Yes, what I've said is silly, but hopefully what I've done isn't.  When running
in the old mode, as for Emacs 21, Emacs can't tell if the macro expands to a
function, so turns off tooltips.  In the new mode, it checks to see if the
macro expands to a function and if so, doesn't try to print its value (which
would call abort () in this case).

-- 
Nick                                           http://www.inet.net.nz/~nickrob


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH: mi-cmd-file.c]
  2008-01-30  3:32       ` Nick Roberts
@ 2008-01-30  7:19         ` Vladimir Prus
  2008-01-30  9:30           ` Nick Roberts
  0 siblings, 1 reply; 7+ messages in thread
From: Vladimir Prus @ 2008-01-30  7:19 UTC (permalink / raw)
  To: Nick Roberts, gdb-patches

Nick Roberts wrote:

>  > > Actually Emacs turns tooltips off if there is no macro information in
>  > > case of something like:
>  > > 
>  > > #define STOP abort ()
>  > > 
>  > > and the mouse hovers over STOP.  Macro information allows Emacs to
>  > > ensure that a macro doesn't expand to a function first.
>  > 
>  > Hmm, that sounds silly.  If there's no macro information, GDB won't be
>  > able to expand STOP to a function...
> 
> Yes, what I've said is silly, but hopefully what I've done isn't.  When
> running in the old mode, as for Emacs 21, Emacs can't tell if the macro
> expands to a
> function, so turns off tooltips.  In the new mode, it checks to see if the
> macro expands to a function and if so, doesn't try to print its value
> (which would call abort () in this case).

I seems like this patch was checked in, and I see the following:

   FAIL: gdb.mi/mi-file.exp: request path info of current source file (basics.c)

and same for mi2-file.exp. Did you forgot to run testsuite, or forgot to
commit testsuite change?

- Volodya



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH: mi-cmd-file.c]
  2008-01-30  7:19         ` Vladimir Prus
@ 2008-01-30  9:30           ` Nick Roberts
  0 siblings, 0 replies; 7+ messages in thread
From: Nick Roberts @ 2008-01-30  9:30 UTC (permalink / raw)
  To: Vladimir Prus; +Cc: gdb-patches

 > I seems like this patch was checked in, and I see the following:
 > 
 >    FAIL: gdb.mi/mi-file.exp: request path info of current source file
 >    (basics.c)
 > 
 > and same for mi2-file.exp. Did you forgot to run testsuite, or forgot to
 > commit testsuite change?

Yes, my mistake - sorry.

I've checked in the changes below as obvious.

-- 
Nick                                           http://www.inet.net.nz/~nickrob


2008-01-30  Nick Roberts  <nickrob@snap.net.nz>

	* gdb.mi/mi-file.exp, gdb.mi/mi2-file.exp
	(test_file_list_exec_source_file): Update to new macro-info field.


*** mi-file.exp.~1.11.~	2008-01-10 11:35:09.000000000 +1300
--- mi-file.exp	2008-01-30 21:42:59.000000000 +1300
*************** proc test_file_list_exec_source_file {} 
*** 64,70 ****
      set line_default [expr $line_main_body - $gdb_lines_to_list + 1]
  
      mi_gdb_test "111-file-list-exec-source-file" \
! 	    "111\\\^done,line=\"$line_default\",file=\"${srcfilepath}\",fullname=\"$fullname_syntax${srcfile}\"" \
                 "request path info of current source file (${srcfile})"
  }
  
--- 64,70 ----
      set line_default [expr $line_main_body - $gdb_lines_to_list + 1]
  
      mi_gdb_test "111-file-list-exec-source-file" \
! 	    "111\\\^done,line=\"$line_default\",file=\"${srcfilepath}\",fullname=\"$fullname_syntax${srcfile}\",macro-info=\"0\"" \
                 "request path info of current source file (${srcfile})"
  }
  

*** mi2-file.exp.~1.11.~	2008-01-10 11:35:10.000000000 +1300
--- mi2-file.exp	2008-01-30 21:43:06.000000000 +1300
*************** proc test_file_list_exec_source_file {} 
*** 64,70 ****
      set line_default [expr $line_main_body - $gdb_lines_to_list + 1]
  
      mi_gdb_test "111-file-list-exec-source-file" \
! 	    "111\\\^done,line=\"$line_default\",file=\"${srcfilepath}\",fullname=\"$fullname_syntax${srcfile}\"" \
                 "request path info of current source file (${srcfile})"
  }
  
--- 64,70 ----
      set line_default [expr $line_main_body - $gdb_lines_to_list + 1]
  
      mi_gdb_test "111-file-list-exec-source-file" \
! 	    "111\\\^done,line=\"$line_default\",file=\"${srcfilepath}\",fullname=\"$fullname_syntax${srcfile}\",macro-info=\"0\"" \
                 "request path info of current source file (${srcfile})"
  }
  


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-01-30  8:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-10  3:30 [PATCH: mi-cmd-file.c] Nick Roberts
2008-01-29 18:08 ` Daniel Jacobowitz
2008-01-30  1:57   ` Nick Roberts
2008-01-30  3:06     ` Daniel Jacobowitz
2008-01-30  3:32       ` Nick Roberts
2008-01-30  7:19         ` Vladimir Prus
2008-01-30  9:30           ` Nick Roberts

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox