Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Dealing with version-specific syntax
@ 2011-01-12 19:28 Anton Ertl
  2011-01-13  7:30 ` André Pönitz
  0 siblings, 1 reply; 3+ messages in thread
From: Anton Ertl @ 2011-01-12 19:28 UTC (permalink / raw)
  To: gdb

What I am trying to do: Get the disassembly for a specific address
range.  And I try to do it with gdb.  The problem here ist that as far
as I can tell, up to gdb-7.0 the way to do this is

disassemble 0x404E22 0x404E40

Starting from gdb-7.1, this syntax is invalid, and instead we have to
use

disassemble 0x404E22,0x404E40

Unfortunately, this syntax does something else in gdb-7.0 and earlier
(it disassembles whole functions).

Is there a good way inside gdb for deciding which syntax to use?
Ideally, I would test if the space-separated syntax works, and use it
if it does, and otherwise use the comma-syntax.  Or I might test for
the gdb version and use the syntax depending on that.

If there is no easy way, we will probably take the approach of testing
the gdb version outside of gdb.

- anton


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

* Re: Dealing with version-specific syntax
  2011-01-12 19:28 Dealing with version-specific syntax Anton Ertl
@ 2011-01-13  7:30 ` André Pönitz
  2011-01-15 16:33   ` Anton Ertl
  0 siblings, 1 reply; 3+ messages in thread
From: André Pönitz @ 2011-01-13  7:30 UTC (permalink / raw)
  To: anton; +Cc: gdb

On Wednesday 12 January 2011 20:27:50 ext Anton Ertl wrote:
> What I am trying to do: Get the disassembly for a specific address
> range.  And I try to do it with gdb.  The problem here ist that as far
> as I can tell, up to gdb-7.0 the way to do this is
> 
> disassemble 0x404E22 0x404E40
> 
> Starting from gdb-7.1, this syntax is invalid, and instead we have to
> use
> 
> disassemble 0x404E22,0x404E40
> 
> Unfortunately, this syntax does something else in gdb-7.0 and earlier
> (it disassembles whole functions).
> 
> Is there a good way inside gdb for deciding which syntax to use?
> Ideally, I would test if the space-separated syntax works, and use it
> if it does, and otherwise use the comma-syntax.  Or I might test for
> the gdb version and use the syntax depending on that.

That's unfortunately not necessarily a safe approach as gdb version strings 
can be virtually anything. Some distributors get really creative there ;-}

> If there is no easy way, we will probably take the approach of testing
> the gdb version outside of gdb.

You could decide what syntax to use in the same session before loading
a file:

  disassemble 0 1

will produce either

  Dump of assembler code from 0x0 to 0x1:
  0x00000000:     Cannot access memory at address 0x0

or

   A syntax error in expression, near `1'.

Andre'


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

* Re: Dealing with version-specific syntax
  2011-01-13  7:30 ` André Pönitz
@ 2011-01-15 16:33   ` Anton Ertl
  0 siblings, 0 replies; 3+ messages in thread
From: Anton Ertl @ 2011-01-15 16:33 UTC (permalink / raw)
  To: André Pönitz; +Cc: anton, gdb

On Thu, Jan 13, 2011 at 08:33:40AM +0100, André Pönitz wrote:
> You could decide what syntax to use in the same session before loading
> a file:
> 
>   disassemble 0 1
> 
> will produce either
> 
>   Dump of assembler code from 0x0 to 0x1:
>   0x00000000:     Cannot access memory at address 0x0
> 
> or
> 
>    A syntax error in expression, near `1'.

Thank you.  I have now taken this approach, outside gdb:

http://www.complang.tuwien.ac.at/viewcvs/cgi-bin/viewcvs.cgi/gforth/dis-gdb.fs?annotate=1.12

- anton


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

end of thread, other threads:[~2011-01-15 16:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-12 19:28 Dealing with version-specific syntax Anton Ertl
2011-01-13  7:30 ` André Pönitz
2011-01-15 16:33   ` Anton Ertl

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