Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* mi_cmd_disassemble bug?
@ 2008-01-22  6:40 wangjiong
  2008-01-22  7:09 ` Nick Roberts
  0 siblings, 1 reply; 2+ messages in thread
From: wangjiong @ 2008-01-22  6:40 UTC (permalink / raw)
  To: gdb

Dear all:

        I have found that when Eclipse call gdb to disassemble the program 
from the appointed line in mixed source mode, there is some problem.

        For example, if the program stopped at line 140 in main, then the 
user want to see the disassembled codes mixed with C source codes, Eclipse 
will
       using the following command:

        xxx-data-disassemble -f example.c -l 140 -n 100 -- 1

        then gdb will call function  mi_cmd_disassemble which will always 
disassemble from the start address of the function which includes that 
line.
 
        But I think what Eclipse expect gdb to do is disassembling from 
where line 140 start instead of the start address of that function.

        So in GDB6.7 mi/mi-cmd-disas.c, in function mi_cmd_disassemble

        Should the folloing code be modified ?

       if (!find_line_pc (s, line_num, &start))
         error (_("mi_cmd_disassemble: Invalid line number"));
       if (find_pc_partial_function (start, NULL, &low, &high) == 0)
         error (_("mi_cmd_disassemble: No function contains specified 
address"));
       }

        gdb_disassembly (uiout,
                    file_string,
                    line_num,
                    mixed_source_and_assembly, how_many, low, high);
 
        Should it be?

        if (!find_line_pc (s, line_num, &start))
         error (_("mi_cmd_disassemble: Invalid line number"));
       }

        gdb_disassembly (uiout,
                    file_string,
                    line_num,
                    mixed_source_and_assembly, how_many, start, high);


 

 

Wang Jiong 

  tel:2254


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

* Re: mi_cmd_disassemble bug?
  2008-01-22  6:40 mi_cmd_disassemble bug? wangjiong
@ 2008-01-22  7:09 ` Nick Roberts
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Roberts @ 2008-01-22  7:09 UTC (permalink / raw)
  To: wangjiong; +Cc: gdb

 >         I have found that when Eclipse call gdb to disassemble the program 
 > from the appointed line in mixed source mode, there is some problem.
 > 
 >         For example, if the program stopped at line 140 in main, then the 
 > user want to see the disassembled codes mixed with C source codes, Eclipse 
 > will
 >        using the following command:
 > 
 >         xxx-data-disassemble -f example.c -l 140 -n 100 -- 1
 > 
 >         then gdb will call function  mi_cmd_disassemble which will always 
 > disassemble from the start address of the function which includes that 
 > line.
 >  
 >         But I think what Eclipse expect gdb to do is disassembling from 
 > where line 140 start instead of the start address of that function.

Why do you think Eclipse expects disassembly to start from line 140?  Does
it not make sense to display some lines/disassembly before the current line
as context?

 >         So in GDB6.7 mi/mi-cmd-disas.c, in function mi_cmd_disassemble
 > 
 >         Should the folloing code be modified ?

Please post changes as a diff so that they are easier to read.

 >        if (!find_line_pc (s, line_num, &start))
 >          error (_("mi_cmd_disassemble: Invalid line number"));
 >        if (find_pc_partial_function (start, NULL, &low, &high) == 0)
 >          error (_("mi_cmd_disassemble: No function contains specified 
 > address"));
 >        }
 > 
 >         gdb_disassembly (uiout,
 >                     file_string,
 >                     line_num,
 >                     mixed_source_and_assembly, how_many, low, high);
 >  
 >         Should it be?
 > 
 >         if (!find_line_pc (s, line_num, &start))
 >          error (_("mi_cmd_disassemble: Invalid line number"));
 >        }
 > 
 >         gdb_disassembly (uiout,
 >                     file_string,
 >                     line_num,
 >                     mixed_source_and_assembly, how_many, start, high);


I don't think this change should be made, if only because it does what the
manual says:

      -data-disassemble
         [ -s START-ADDR -e END-ADDR ]
       | [ -f FILENAME -l LINENUM [ -n LINES ] ]
       -- MODE


`LINENUM'
     is the line number to disassemble around


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


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

end of thread, other threads:[~2008-01-22  7:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-22  6:40 mi_cmd_disassemble bug? wangjiong
2008-01-22  7:09 ` Nick Roberts

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