How to control Dwarf level of GDB debugger

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

How to control Dwarf level of GDB debugger

跳至解决方案
1,546 次查看
Tuhl
Contributor I

I am using

S32 Design Studio for S32 Platform  Version: 3.6.1  Build id: 250327

In most of my code, when I try to set a breakpoint it works fine.  However, in some sections of code e.g. init code, I get this error. 

Breakpoint installation failed: invalid dwarf2 offset 0xa9be7  (Address is line-specific.)
This code is being compiled and linked separately, then imported into a S32 project. Our settings default to dwarf4.  According to documentation, GDB debugger should read the elf file and determine dwarf level automatically, and should support dwarf4. 

I found where to set dwarf level in compiler settings (though we don't use compiler) in case it might work, but I can't find any way to set dwarf level in GDB debugger.
Why doesn't GDB debugger seem to properly support dwarf4?  Is there any way to set the debugger's dwarf level?

 

0 项奖励
回复
1 解答
1,508 次查看
VaneB
NXP TechSupport
NXP TechSupport

Hi @Tuhl 

I am not an expert on this topic, but I wanted to share some information that may be helpful.

Debuggers themselves cannot change the DWARF version; they only read and interpret the debug information that is already included in the ELF file.

When using GCC, the DWARF version is selected during compilation and can be explicitly set using compiler options (see the references below).

GCC - Options for Debugging Your Program

Unwanted debugging -gdwarf-4 option set automatically in library projects by MCUXpresso

-g, -gdwarf-2, -gdwarf-3, -gdwarf-4

If no DWARF version is specified, the compiler will fall back to its default, which depends on the compiler version. 

 

BR, VaneB

在原帖中查看解决方案

0 项奖励
回复
2 回复数
1,509 次查看
VaneB
NXP TechSupport
NXP TechSupport

Hi @Tuhl 

I am not an expert on this topic, but I wanted to share some information that may be helpful.

Debuggers themselves cannot change the DWARF version; they only read and interpret the debug information that is already included in the ELF file.

When using GCC, the DWARF version is selected during compilation and can be explicitly set using compiler options (see the references below).

GCC - Options for Debugging Your Program

Unwanted debugging -gdwarf-4 option set automatically in library projects by MCUXpresso

-g, -gdwarf-2, -gdwarf-3, -gdwarf-4

If no DWARF version is specified, the compiler will fall back to its default, which depends on the compiler version. 

 

BR, VaneB

0 项奖励
回复
1,459 次查看
Tuhl
Contributor I
OK Thank you! I had begun to realize that maybe our compiler was defaulting to a later version like dwarf5, and the SW is not reporting dwarf2 based on a read of the elf file; instead it is assuming its too old and returning the highest level it doesn't support. If it doesn't support dwarf5 it doesn't know the version exists. I need to determine for sure the exact default dwarf level, and I haven't yet found it in the compiler documentation.
0 项奖励
回复
%3CLINGO-SUB%20id%3D%22lingo-sub-2298438%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E5%A6%82%E4%BD%95%E6%8E%A7%E5%88%B6%20GDB%20%E8%B0%83%E8%AF%95%E5%99%A8%E7%9A%84%E7%9F%AE%E4%BA%BA%E7%BA%A7%E5%88%AB%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2298438%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E6%88%91%E6%AD%A3%E5%9C%A8%E4%BD%BF%E7%94%A8%3C%2FP%3E%3CP%3ES32%20%E5%B9%B3%E5%8F%B0%E7%9A%84%20S32%20Design%20Studio%20%E7%89%88%E6%9C%AC%EF%BC%9A3.6.1%20%20%E7%89%88%E6%9C%AC%20ID%EF%BC%9A250327%3C%2FP%3E%3CP%3E%E5%9C%A8%E6%88%91%E7%9A%84%E5%A4%A7%E9%83%A8%E5%88%86%E4%BB%A3%E7%A0%81%E4%B8%AD%EF%BC%8C%E5%BD%93%E6%88%91%E5%B0%9D%E8%AF%95%E8%AE%BE%E7%BD%AE%E6%96%AD%E7%82%B9%E6%97%B6%E9%83%BD%E8%83%BD%E6%AD%A3%E5%B8%B8%E5%B7%A5%E4%BD%9C%E3%80%82%20%E7%84%B6%E8%80%8C%EF%BC%8C%E5%9C%A8%E6%9F%90%E4%BA%9B%E4%BB%A3%E7%A0%81%E7%AB%A0%E8%8A%82%E4%B8%AD%EF%BC%8C%E4%BE%8B%E5%A6%82%E5%90%AF%E5%8A%A8%E4%BB%A3%E7%A0%81%E6%97%B6%EF%BC%8C%E6%88%91%E5%BE%97%E5%88%B0%E4%BA%86%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%88%91%E4%BB%AC%E4%B8%8D%E4%BD%BF%E7%94%A8%E7%BC%96%E8%AF%91%E5%99%A8%EF%BC%89%EF%BC%8C%E4%BB%A5%E9%98%B2%E4%B8%87%E4%B8%80%EF%BC%8C%E4%BD%86%E6%88%91%E6%89%BE%E4%B8%8D%E5%88%B0%E5%9C%A8%20GDB%20%E8%B0%83%E8%AF%95%E5%99%A8%E4%B8%AD%E8%AE%BE%E7%BD%AE%E7%9F%AE%E4%BA%BA%E7%BA%A7%E5%88%AB%E7%9A%84%E4%BB%BB%E4%BD%95%E6%96%B9%E6%B3%95%E3%80%82%3CBR%20%2F%3E%E4%B8%BA%E4%BB%80%E4%B9%88%20GDB%20%E8%B0%83%E8%AF%95%E5%99%A8%E4%BC%BC%E4%B9%8E%E6%97%A0%E6%B3%95%E6%AD%A3%E7%A1%AE%E6%94%AF%E6%8C%81%20dwarf4%EF%BC%9F%20%E6%9C%89%E6%B2%A1%E6%9C%89%E5%8A%9E%E6%B3%95%E8%AE%BE%E7%BD%AE%E8%B0%83%E8%AF%95%E5%99%A8%E7%9A%84%E7%9F%AE%E4%BA%BA%E7%BA%A7%E5%88%AB%EF%BC%9F%3C%2FP%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2298596%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20How%20to%20control%20Dwarf%20level%20of%20GDB%20debugger%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2298596%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E4%BD%A0%E5%A5%BD%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F250045%22%20target%3D%22_blank%22%3E%40Tuhl%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%E6%88%91%E4%B8%8D%E6%98%AF%E8%BF%99%E6%96%B9%E9%9D%A2%E7%9A%84%E4%B8%93%E5%AE%B6%EF%BC%8C%E4%BD%86%E6%88%91%E6%83%B3%E5%88%86%E4%BA%AB%E4%B8%80%E4%BA%9B%E5%8F%AF%E8%83%BD%E6%9C%89%E7%94%A8%E7%9A%84%E4%BF%A1%E6%81%AF%E3%80%82%3C%2FP%3E%0A%3CP%3E%E8%B0%83%E8%AF%95%E5%99%A8%E6%9C%AC%E8%BA%AB%E4%B8%8D%E8%83%BD%E6%9B%B4%E6%94%B9%20DWARF%20%E7%89%88%E6%9C%AC%EF%BC%9B%E5%AE%83%E4%BB%AC%E5%8F%AA%E8%83%BD%E8%AF%BB%E5%8F%96%E5%92%8C%E8%A7%A3%E9%87%8A%E5%B7%B2%E5%8C%85%E5%90%AB%E5%9C%A8%20ELF%20%E6%96%87%E4%BB%B6%E4%B8%AD%E7%9A%84%E8%B0%83%E8%AF%95%E4%BF%A1%E6%81%AF%E3%80%82%3C%2FP%3E%0A%3CP%3E%E4%BD%BF%E7%94%A8%20GCC%20%E6%97%B6%EF%BC%8CDWARF%20%E7%89%88%E6%9C%AC%E6%98%AF%E5%9C%A8%E7%BC%96%E8%AF%91%E6%9C%9F%E9%97%B4%E9%80%89%E6%8B%A9%E7%9A%84%EF%BC%8C%E5%8F%AF%E4%BB%A5%E4%BD%BF%E7%94%A8%E7%BC%96%E8%AF%91%E5%99%A8%E9%80%89%E9%A1%B9%E8%BF%9B%E8%A1%8C%E6%98%8E%E7%A1%AE%E8%AE%BE%E7%BD%AE%EF%BC%88%E5%8F%82%E8%A7%81%E4%B8%8B%E9%9D%A2%E7%9A%84%E5%8F%82%E8%80%83%EF%BC%89%E3%80%82%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fgcc.gnu.org%2Fonlinedocs%2Fgcc%2FDebugging-Options.html%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3EGCC%20-%20%E8%B0%83%E8%AF%95%E7%A8%8B%E5%BA%8F%E7%9A%84%E9%80%89%E9%A1%B9%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2FMCUXpresso-IDE%2FUnwanted-debugging-gdwarf-4-option-set-automatically-in-library%2Fm-p%2F1852587%22%20target%3D%22_blank%22%3EMCUXpresso%20%E5%9C%A8%E5%BA%93%E9%A1%B9%E7%9B%AE%E4%B8%AD%E8%87%AA%E5%8A%A8%E8%AE%BE%E7%BD%AE%E4%BA%86%E4%B8%8D%E9%9C%80%E8%A6%81%E7%9A%84%E8%B0%83%E8%AF%95%20-gdwarf-4%20%E9%80%89%E9%A1%B9%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdeveloper.arm.com%2Fdocumentation%2Fdui0774%2Fl%2FCompiler-Command-line-Options%2F-g---gdwarf-2---gdwarf-3---gdwarf-4%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E-g%E3%80%81-gdwarf-2%E3%80%81-gdwarf-3%E3%80%81-gdwarf-4%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%E5%A6%82%E6%9E%9C%E6%9C%AA%E6%8C%87%E5%AE%9A%20DWARF%20%E7%89%88%E6%9C%AC%EF%BC%8C%E7%BC%96%E8%AF%91%E5%99%A8%E5%B0%86%E8%BF%94%E5%9B%9E%E9%BB%98%E8%AE%A4%E5%80%BC%EF%BC%8C%E9%BB%98%E8%AE%A4%E5%80%BC%E5%8F%96%E5%86%B3%E4%BA%8E%E7%BC%96%E8%AF%91%E5%99%A8%E7%89%88%E6%9C%AC%E3%80%82%20%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EBR%E3%80%81VaneB%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2299374%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20How%20to%20control%20Dwarf%20level%20of%20GDB%20debugger%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2299374%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E5%A5%BD%E7%9A%84%EF%BC%8C%E8%B0%A2%E8%B0%A2%EF%BC%81%E6%88%91%E5%BC%80%E5%A7%8B%E6%84%8F%E8%AF%86%E5%88%B0%EF%BC%8C%E5%8F%AF%E8%83%BD%E6%98%AF%E6%88%91%E4%BB%AC%E7%9A%84%E7%BC%96%E8%AF%91%E5%99%A8%E9%BB%98%E8%AE%A4%E4%BD%BF%E7%94%A8%E4%BA%86%E8%BE%83%E6%99%9A%E7%9A%84%E7%89%88%E6%9C%AC%EF%BC%8C%E6%AF%94%E5%A6%82%20dwarf5%EF%BC%8C%E8%80%8C%20SW%20%E5%9C%A8%E8%AF%BB%E5%8F%96%E7%B2%BE%E7%81%B5%E6%96%87%E4%BB%B6%E6%97%B6%E5%B9%B6%E6%B2%A1%E6%9C%89%E6%8A%A5%E5%91%8A%20dwarf2%EF%BC%8C%E8%80%8C%E6%98%AF%E5%81%87%E8%AE%BE%E5%AE%83%E5%A4%AA%E6%97%A7%E4%BA%86%EF%BC%8C%E5%B9%B6%E8%BF%94%E5%9B%9E%E4%BA%86%E5%AE%83%E4%B8%8D%E6%94%AF%E6%8C%81%E7%9A%84%E6%9C%80%E9%AB%98%E7%BA%A7%E5%88%AB%E3%80%82%E5%A6%82%E6%9E%9C%E4%B8%8D%E6%94%AF%E6%8C%81%20dwarf5%EF%BC%8C%E5%AE%83%E5%B0%B1%E4%B8%8D%E7%9F%A5%E9%81%93%E8%AF%A5%E7%89%88%E6%9C%AC%E7%9A%84%E5%AD%98%E5%9C%A8%E3%80%82%E6%88%91%E9%9C%80%E8%A6%81%E7%A1%AE%E5%AE%9A%E5%87%86%E7%A1%AE%E7%9A%84%E9%BB%98%E8%AE%A4%E7%9F%AE%E4%BA%BA%E7%AD%89%E7%BA%A7%EF%BC%8C%E4%BD%86%E6%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