Lines 366-378
Link Here
|
366 |
<title>How do I debug with gdb?</title> |
366 |
<title>How do I debug with gdb?</title> |
367 |
<body> |
367 |
<body> |
368 |
<p> |
368 |
<p> |
369 |
First gotcha is that GDB can't resolve symbols in PIEs; it doesn't realise that |
369 |
First gotcha is that GDB versions before 7.1 can't resolve symbols in PIEs; it doesn't realise that |
370 |
the addresses are relative in PIEs not absolute. This shows up when you try to |
370 |
the addresses are relative in PIEs not absolute. This shows up when you try to |
371 |
get a backtrace for example, and see a stream of lines with '??' where the |
371 |
get a backtrace for example, and see a stream of lines with '??' where the |
372 |
symbol should be. |
372 |
symbol should be. |
373 |
</p> |
373 |
</p> |
374 |
<p> |
374 |
<p> |
375 |
To get around this, do the final link stage with <c>-nopie</c> - all the |
375 |
Although previous versions are patched to solve this, you can get around this if you do the final link stage with <c>-nopie</c> <c>-nopie</c> - all the |
376 |
preceding object compilations can still be with <c>-fPIE</c> as normal (i.e. the |
376 |
preceding object compilations can still be with <c>-fPIE</c> as normal (i.e. the |
377 |
default with the hardened compiler) so that your executable is as close as |
377 |
default with the hardened compiler) so that your executable is as close as |
378 |
possible to the real thing, but the final link must create a regular executable. |
378 |
possible to the real thing, but the final link must create a regular executable. |