Re: Merging ugen into the usb stack

2018-02-09 Thread Stephen Borrill
On Thu, 8 Feb 2018, Martin Husemann wrote: On Thu, Feb 08, 2018 at 05:22:18PM +0100, Wolfgang Solfrank wrote: Hi, with the attached diffs I'm able to attach my debug board like this: ugen0 at uhub5 port 1 configuration 1 interface 0 ugen0: OpenMoko (0x1457) Debug Board for Neo1973 (0x5118),

gcc: optimizations, and stack traces

2018-02-09 Thread Maxime Villard
An issue I spotted a few months ago, but PR/52560 just reminded me about it. Basically, in order to get a backtrace, GDB reads the %rbp register. At the beginning of each function, GCC inserts the two following instructions: pushq %rbp movq%rsp,%rbp Therefore, at any

Re: gcc: optimizations, and stack traces

2018-02-09 Thread Martin Husemann
On Fri, Feb 09, 2018 at 11:23:17AM +0100, Maxime Villard wrote: > When I spotted this several months ago (while developing Live Kernel ASLR), I > tried to look for GCC options that say "optimize with -O2, but keep the stack > trace intact". I couldn't find one, and the only thing I ended up doing

Re: gcc: optimizations, and stack traces

2018-02-09 Thread Maxime Villard
Le 09/02/2018 à 12:08, Valery Ushakov a écrit : On Fri, Feb 09, 2018 at 11:38:47 +0100, Martin Husemann wrote: On Fri, Feb 09, 2018 at 11:23:17AM +0100, Maxime Villard wrote: When I spotted this several months ago (while developing Live Kernel ASLR), I tried to look for GCC options that say

Re: gcc: optimizations, and stack traces

2018-02-09 Thread Valery Ushakov
On Fri, Feb 09, 2018 at 11:38:47 +0100, Martin Husemann wrote: > On Fri, Feb 09, 2018 at 11:23:17AM +0100, Maxime Villard wrote: > > > When I spotted this several months ago (while developing Live > > Kernel ASLR), I tried to look for GCC options that say "optimize > > with -O2, but keep the

Re: gcc: optimizations, and stack traces

2018-02-09 Thread Valery Ushakov
[Summoning Krister] On Fri, Feb 09, 2018 at 11:23:17 +0100, Maxime Villard wrote: > There are also several cases where functions in the call tree can disappear > from the backtrace. In the following call tree: > > A -> B -> C -> D (and D panics) > > if, in B, GCC put the two

Re: gcc: optimizations, and stack traces

2018-02-09 Thread Joerg Sonnenberger
On Fri, Feb 09, 2018 at 11:23:17AM +0100, Maxime Villard wrote: > It implies that if a bug occurs _before_ these two instructions are executed, > we have a %rbp that points to the _previous_ function, the one we got called > from. And therefore, GDB does not display the current function (where the

Re: gcc: optimizations, and stack traces

2018-02-09 Thread Maxime Villard
Le 09/02/2018 à 13:32, Joerg Sonnenberger a écrit : On Fri, Feb 09, 2018 at 11:23:17AM +0100, Maxime Villard wrote: It implies that if a bug occurs _before_ these two instructions are executed, we have a %rbp that points to the _previous_ function, the one we got called from. And therefore, GDB

Re: gcc: optimizations, and stack traces

2018-02-09 Thread Maxime Villard
Le 09/02/2018 à 12:13, Valery Ushakov a écrit : [Summoning Krister] On Fri, Feb 09, 2018 at 11:23:17 +0100, Maxime Villard wrote: There are also several cases where functions in the call tree can disappear from the backtrace. In the following call tree: A -> B -> C -> D (and D