-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wdw register state not working properly #1350
Comments
There are multiple problems with the debugger. The fault that is triggered when register context is selected (or the window is clicked) is due to line.length having an undefined value in wndcurr.c, WndSetPoint(). This is because wndmeth.c is not initializing this field. However, when this is initialized to zero, only registers in the first column can be changed with the mouse, so the real problem is hidden by the initialization. |
Another issue is that "Source code not found" seems to affect RDOS drivers. It seems like finding the source is done in dbgwinsp.c, WndSrcInspect(). At least, the error message is shown there. |
This seems to be an issue with DLLs too. The dwarf/dr/c/drline.c file, procedure DRWalkLFiles method seems to be at the heart of this problem. For exe sources, it returns the correct pathname, but not for DLLs or RDOS device drivers. A problem with debugging this is that drline.c is in the dwarf.dll, so I cannot debug it at source level. More checks seems to reveal that it is only loaded DLLs, and not automatically imported that are not showing source information. The RDOS device drivers are also loaded on access. |
I will review. |
@rdos314 |
I can see with wdump that the full path of the filename is present in DW_AT_name in the symbol file. The symbol file is read correctly too since line numbers are shown. It's just the source that is not displayed. I compiled dwarf for debug and it appears the same problem is present with all the dr*.c files, while the other files in the dll works as they should. Since it is in drline.c file that the problems seems to be for RDOS drivers, it's a bit hard to debug. |
Trace: The wlk.res variable contains the full source path when it works, but the name of the module when it doesn't work. |
Assembler switches: -mf -6r -fpi87 -d1 -w4 -e25 -zq |
The main change is in multiple THEADR records, if exists only one then it should works as before. If there are two records then first is module name used by linker and librarian and should be ignored by debugger and second record is true source file name only. Next THEADR record change source file name only. It is not used as module name, module name is always defined by first THEADR record. -d1 option and above should generate OMF modules with two THEADR records on the begining and second one should contain full source file name. Try to check. |
When I switch debugger version all the way back to 2021, the same bug remains. When I rebuild the device driver with a build from 2023-12-29 the device driver source is ok and the bug disappears. |
Then it looks like a bug in debug info processing for source file name or may be more bugs for different versions. |
I also note that a device driver where the first module is a C file works for the first file, but all the rest show ups without source code. I think for dr*.c, there might be a bug that doesn't compile those with source information even when OWDEBUGBUILD is set to 1. I note that these files will show no local variables, although the line number information still appears to be correct. |
In debugger is involved more projects that if you recompile for debug only single project then only some files have debug info available. Definitely it is issue with source file name lookup, may be another errors too. |
I have gotten close to the cause now. It's cu_tag in the modinfo structure that is incorrect. When the source is found, this field contains the full pathname, while for newly linked device drivers, it contains this junk in hex: 02 83 09 00. Going to the source of this information, the ModFill function in dfmod.c gets this junk when it calls DRGetCompileUnitTag. Here the data looks like this in hex: 02 83 09 00 00 "E:\rdos\kernel\fs\dev\devfile.c" 00. IOW, the position for finding the source filename is five bytes off, and instead returns junk. |
It is strange. |
It appears that for ASM source, the problem is that the sym-file does not contain the full path of the source files. Checked C files a bit more, they contain the full source path, and at least the ModFill function also decodes it correctly. So, the main problem seems to be that ASM source no longer registers the full path of source files. Checked an application too, and it's is the same problem. The full path of ASM source is not in the symbol file. Actually, I think this problem can be connected to source that is not compiled with symbols too. I have a clib that is not compiled for debug, and all the files from it, both ASM and C lack the full path for source files. Which is why I initially couldn't debug part of dwarf.dll. The linker needs to register the full path of all source files, regardless of settings for debug-info, otherwise, the debugger will show that source is not available instead of the assembly code. A very simple driver source in ASM (32-bit RDOS device driver): code SEGMENT byte public use32 'CODE'
test_name DB 'Test func', 0 test_func Proc far init PROC far code ENDS
` With the old compiler & linker wdump shows this info: Offset: 00000000 Length: 00000051 Version: 0002 Abbrev: 00000000 Address Size 04 With the current assembler & linker it looks like this: Offset: 00000000 Length: 00000039 Version: 0002 Abbrev: 00000000 Address Size 04 |
If the registers are already shown, only the first column can be highlighted by clicking on it (cursor keys seems to work though). When selecting registers from the menu, the debugger crashes.
The text was updated successfully, but these errors were encountered: