This is the mail archive of the gdb-patches@sources.redhat.com 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: [RFA] new command: 'maintenance info lines'


Josef Ezra wrote:
Fernando Nasser wrote:

The maintenance commands are to be used to debug (or test) GDB only.
We could say you'd be dumping the line table but that is hardly what is being done and we don't have a real need for that anyway.

well, WE have a real need for this command
That is the problem. We can't go and add things to GDB to the use of each individual need. That is why the MI was added so that any tool developer can use that to talk to GDB.

(is there a wrong way to use gdb?).
Definitively parsing CLI output is one.

If you really want to use a CLI command, you need to add a set/show variable to request that the source lines are included in the 'disassemble' command output.

do you mean something like:

(gdb) set  disassem dump-source-or-something 1
(gdb) disassemble main
Dump of assembler code for function main:
   Line ../gdb/main.c:757
0x50ce4 <main>: save  %sp, -120, %sp
0x50ce8 <main+4>:       std  %i0, [ %fp + -24 ]
0x50cec <main+8>:       sethi  %hi(0x50000), %o0
0x50cf0 <main+12>:      or  %o0, 0x16c, %o0     ! 0x5016c <captured_main>
0x50cf4 <main+16>:      sethi  %hi(0x2a7c00), %o2
   Line ../gdb/main.c:759
0x50cf8 <main+20>:      add  %fp, -24, %o1
0x50cfc <main+24>:      or  %o2, 0x3c0, %o2
0x50d00 <main+28>:      call  0xb2374 <catch_errors>
0x50d04 <main+32>:      mov  6, %o3
   Line ../gdb/main.c:775
0x50d08 <main+36>:      ret
0x50d0c <main+40>:      restore  %g0, 0, %o0
End of assembler dump.

Exactly, but the source line itself (if available) will be displayed as well.

that would be a great solution for our needs. how about setting the dump-source to 1 to show line location, and 2 to try presenting the actual source lines (like mixed list and disassemble)

Actually, I was thinking of

set/show mixed-disassembly on/off

There is no point in not showing the source lines themselves on the CLI output. Tools using GDB as the backend may want to manipulate the source files themselves, and that is why the MI output only have the line number (not the content of the source file line).


The newer disassembler code that handles mixed output is still in the MI subdirectory (and in an older form in the gdbtk subdir) but it is intended to replace the one in printcmd.c. It shouldn't be too difficult and you can always ask if you have any doubts.

?? please explain

Sure. The newest code for disassembly is in the file mi/mi-cmd-disas.c.
This is supposed to replace the old one in printcmd.c which was not capable of mixed-mode disassembly. Once this code is in the libgdb proper, all interfaces (CLI, MI and gdbtk) will use this same code.

Maybe it helps if you know the story:
.the code in printcmd.c came first
.it was improved in gdbtk land to allow mixed-mode disassembly
.it was copied with small changes to MI land
.the code in MI was improved to be more modular (and facilitate splitting the UI and core parts).
.MISSING: Replace the old code and use the new one (from mi-cmd-disas.c) and use it everywhere, getting rid of all the other versions.


We are slowly doing this. It was not a priority as it is already working on the MI and having mixed-mode disassembly in the CLI is just an enhancement no one has ever asked for (although I think it would be nice). We are doing it more like a clean-up.

I will take a look and see if I can find time and do it. Or do you want to give it a try yourself?

Regards,
Fernando


--
Fernando Nasser
Red Hat - Toronto E-Mail: fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario M4P 2C9


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