[FFmpeg-devel] Moving if(constant expression) to preprocessor?

Måns Rullgård mans
Mon Sep 20 15:31:46 CEST 2010

Michael Niedermayer <michaelni at gmx.at> writes:

> On Mon, Sep 20, 2010 at 02:59:11AM +0200, Luca Barbato wrote:
> [...]
>> gdb is wonderful.
> if that is so, there must be documentation for
> how to examine data (8,16,32,64,float and int)

(gdb) help x
Examine memory: x/FMT ADDRESS.
ADDRESS is an expression for the memory address to examine.
FMT is a repeat count followed by a format letter and a size letter.
Format letters are o(octal), x(hex), d(decimal), u(unsigned decimal),
  t(binary), f(float), a(address), i(instruction), c(char) and s(string).
Size letters are b(byte), h(halfword), w(word), g(giant, 8 bytes).
The specified number of objects of the specified size are printed
according to the format.

Defaults for format and size letters are those previously used.
Default count is 1.  Default address is following last thing printed
with this command or "print".

> and code,

(gdb) help disas
Disassemble a specified section of memory.
Default is the function surrounding the pc of the selected frame.
With a /m modifier, source lines are included (if available).
With a /r modifier, raw instructions in hex are included.
With a single argument, the function surrounding that address is dumped.
Two arguments (separated by a comma) are taken as a range of memory to dump.

> single step,

(gdb) help s
Step program until it reaches a different source line.
Argument N means do this N times (or till program stops for another reason).
(gdb) help si
Step one instruction exactly.
Argument N means do this N times (or till program stops for another reason).
(gdb) help n
Step program, proceeding through subroutine calls.
Like the "step" command as long as subroutine calls do not happen;
when they do, the call is treated as one instruction.
Argument N means do this N times (or till program stops for another reason).

> step backward, 


> setting breakpoints both on code

(gdb) help b
Set breakpoint at specified line or function.
LOCATION may be a line number, function name, or "*" and an address.
If a line number is specified, break at start of code for that line.
If a function is specified, break at start of code for that function.
If an address is specified, break at that exact address.
With no LOCATION, uses current execution address of selected stack frame.
This is useful for breaking on return to a stack frame.

THREADNUM is the number from "info threads".
CONDITION is a boolean expression.

Multiple breakpoints at one place are permitted, and useful if conditional.

Do "help breakpoints" for info on other commands dealing with breakpoints.

> and data

(gdb) help watch
Set a watchpoint for an expression.
A watchpoint stops execution of your program whenever the value of
an expression changes.

> and doing so conditional on arbitrary conditions 

(gdb) help cond
Specify breakpoint number N to break only if COND is true.
Usage is `condition N COND', where N is an integer and COND is an
expression to be evaluated whenever breakpoint N is reached.

> and how to watch the value of data as one steps through the code.

(gdb) help disp
Print value of expression EXP each time the program stops.
/FMT may be used before EXP as in the "print" command.
/FMT "i" or "s" or including a size-letter is allowed,
as in the "x" command, and then EXP is used to get the address to examine
and examining is done as in the "x" command.

With no argument, display all currently requested auto-display expressions.
Use "undisplay" to cancel display requests previously made.

> and all that fitting on a 80x25 char page.

A summary of the above would certainly fit.

> if it fails that it is not only not wonderfull but not even average

What would you consider a good debugger?  Or any other app for that matter.

> ahh and one must be able to find that page within 10secs without
> knowing where it is.

When confronted with a command-line interface I'm unfamiliar with, I
usually try "help", "h", and "?" as commands.  More often than not,
one of them works, and it takes me less than 10s to try them all.

> for a naive test, run gdb, hit F1, watch it not do anything sensible

Why do you expect Fnum keys to do anything useful in a console
application?  Perhaps you should try the GDB GUI.

> then follow the devels asshatry and type help (h is enough but yeah
> how would you know, slower is better) and at that point good luck
> finding awnsers to all above through this help system

Typing "help" to get help seems perfectly intuitive to me.

M?ns Rullg?rd
mans at mansr.com

More information about the ffmpeg-devel mailing list