Forum > Debugger

view argc and argv in FpDebug

(1/3) > >>

440bx:
Hello,

I've been trying, unsuccessfully, to view the values of argc and argv while debugging using FpDebug.  When I hover over the names, the little debug window doesn't show their values.  If I attempt to "evaluate/modify" either one, the evaluate/modify window shows an error message stating that it could not find the identifier/variable.

Is there a way to convince the debugger to show the values of argc and argv ?  (in the case of argv it would be nice to get the full array of pointers (0..argc - 1).

Thank you for your help.

PS: using Lazarus 3.1 (fixes) dated 2024-02-13

TRon:
Are you using rtl with debug info ?

440bx:

--- Quote from: TRon on February 23, 2024, 12:04:52 am ---Are you using rtl with debug info ?

--- End quote ---
I'm not sure what the correct answer to that question is.  Probably not (I would expect the executable sizes to be larger than what I'm getting.)

That said, I know that the addresses of argc and argv are _present_ in the debug (COFF symbol table) information.  I see them using a PE dump program and also see them using IDA pro, i.e,
--- Code: Text  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---.bss:0000000100014390 U_$SYSTEM_$$_RETURNNILIFGROWHEAPFAILS db ?.bss:0000000100014390                                         ; DATA XREF: sub_100006230+232↑r.bss:0000000100014390                                         ; sub_100006750+18↑r.bss:0000000100014391                 align 20h.bss:00000001000143A0                 public U_$SYSTEM_$$_ARGC.bss:00000001000143A0 U_$SYSTEM_$$_ARGC dd ?                  ; DATA XREF: main:loc_100001BAA↑r.bss:00000001000143A0                                         ; main+4BC↑r ....bss:00000001000143A4                 align 10h.bss:00000001000143B0                 public U_$SYSTEM_$$_ARGV.bss:00000001000143B0 U_$SYSTEM_$$_ARGV dq ?                  ; DATA XREF: main+1B7↑r.bss:00000001000143B0                                         ; main+2BC↑r ... The information is in the COFF symbol table



--- Code: Text  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---              Entry :  955.c49c  [  4]                   Symbol name inline :      0    (false)6.03a1  [ 18]                          Symbol name : U_$SYSTEM_$$_ARGC 5.c4a0  [  4]      Symbol name string table offset :    9a7    [FO: 6.03a1]5.c4a4  [  4]                                Value :   13a05.c4a8  [  2]             (1 based) Section number :      5    .bss5.c4aa  [  2]                                 Type :      05.c4ac  [  1]                        Storage class :      2    CLASS_EXTERNAL5.c4ad  [  1]          Number of auxiliary symbols :      0                 Entry :  965.c4ae  [  4]                   Symbol name inline :      0    (false)6.03b3  [ 18]                          Symbol name : U_$SYSTEM_$$_ARGV 5.c4b2  [  4]      Symbol name string table offset :    9b9    [FO: 6.03b3]5.c4b6  [  4]                                Value :   13b05.c4ba  [  2]             (1 based) Section number :      5    .bss5.c4bc  [  2]                                 Type :      05.c4be  [  1]                        Storage class :      2    CLASS_EXTERNAL5.c4bf  [  1]          Number of auxiliary symbols :      0 
Objdump shows that neither argc nor argv are in the dwarf sections. 

TRon:

--- Quote from: 440bx on February 23, 2024, 01:18:49 am ---Objdump shows that neither argc nor argv are in the dwarf sections.

--- End quote ---
Then that is probably your problem.

But you can probably circumvent that by declaring:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---var  x: integer absolute argc;  y: ppchar absolute argv; and set a watch for x and y instead. Not exactly what you asked for but should be able to show you the contents of argc and argv..

edit and yes, you can also name them argc and argv  :)

440bx:

--- Quote from: TRon on February 23, 2024, 02:12:12 am ---But you can probably circumvent that by declaring:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---var  x: integer absolute argc;  y: ppchar absolute argv; 
--- End quote ---
Good idea and it works.

Thank you.  That gets the job done :)

I still think the debugger should be able to watch argc and argv without having to "absolute" variables on top of them because their addresses are in the COFF symbol table but, I'm pleased to have a way to inspect the values.

Navigation

[0] Message Index

[#] Next page

Go to full version