Thread overview
line number information with dmd and gdb
Jul 01, 2012
Tobias Pankrath
Jul 03, 2012
Rainer Schuetze
Dec 14, 2014
Blackcat345
Jul 23, 2012
kiranlucky
July 01, 2012
Hey,

I've run into problems when debugging a program of mine using gdb (7.4.1) and dmd (2.59 / 2.60).

While running the program in a step by step fashion it occurs that the current line jumps back and forth. So I'm more less blind till the line number information turns correct again. Sadly I've yet to reduce this problem to a program that's fit for a bug report.

Does anyone have this problem, too? Any workarounds?

Thanks
July 03, 2012

On 7/1/2012 10:24 AM, Tobias Pankrath wrote:
> Hey,
>
> I've run into problems when debugging a program of mine using gdb
> (7.4.1) and dmd (2.59 / 2.60).
>
> While running the program in a step by step fashion it occurs that the
> current line jumps back and forth. So I'm more less blind till the line
> number information turns correct again. Sadly I've yet to reduce this
> problem to a program that's fit for a bug report.
>
> Does anyone have this problem, too? Any workarounds?
>
> Thanks

I've seen that, too, but haven't analyzed it thoroughly, because I've been getting used to these. Some unexpected cases from the top of my head (seen on windows, but I guess the problem is OS independent):

- line numbers inside templates are sometimes off by 1
- line numbers within string mixins including line breaks overlap with the following source code
- implicite struct destructors might jump back to the place of the construction
- code like this:
	if(condition)
	 	return;
	code;
  sometimes steps into the line of the "return" statement, even if the condition is false, but then continues with the code
- passing default arguments jumps to the function definition, returns to the invocation before the call, then jumps there again. Very frustrating if you think you can skip the function call by using "until return/finish"
- it is sometimes hard to step into/out of foreach loops, because there is too much magic involved

July 23, 2012
On Sunday, 1 July 2012 at 08:24:14 UTC, Tobias Pankrath wrote:
> Hey,
>
> I've run into problems when debugging a program of mine using gdb (7.4.1) and dmd (2.59 / 2.60).
>
> While running the program in a step by step fashion it occurs that the current line jumps back and forth. So I'm more less blind till the line number information turns correct again. Sadly I've yet to reduce this problem to a program that's fit for a bug report.
>
> Does anyone have this problem, too? Any workarounds?
>
> Thanks

very nice.http://www.kiransweet.com/
December 14, 2014
I've been messing around with this for a couple of hours, and I'm having difficulty determining whether gdb on OS X can be used with DMD at all (it seems to work ok with gdc). I've tried compiling with both -g and -gc switches.