Re: How do I find out which info table a continuation belongs to?

Bumping thread, this is still a problem for me.
I wonder if this ever worked. I should try this with older GHCs.
Ömer
Sergei Azovskov
Hey!
Unfortunately, I'm not a big expert in gdb and debugging ghc runtime. I stripped some auto generated symbols from the symtab but they can still be found in dwarf section. I don't know how to force gdb to show them but you can manually check via dwarfdump. ________________________________ From: Ömer Sinan Ağacan
Sent: Sunday, February 10, 2019 6:45 PM To: Simon Marlow Cc: ghc-devs; Sergei Azovskov Subject: Re: How do I find out which info table a continuation belongs to? I'm already using -g3. Here's my build.mk:
BuildFlavour = quick
ifneq "$(BuildFlavour)" "" include mk/flavours/$(BuildFlavour).mk endif
GhcRtsHcOpts += -O0 -g3 SRC_HC_OPTS += -g3 GhcStage1HcOpts += -g3 GhcStage2HcOpts += -g3 GhcLibHcOpts += -g3
STRIP_CMD = :
Ömer
Simon Marlow
, 10 Şub 2019 Paz, 19:00 tarihinde şunu yazdı: (cc Sergei Azovskov)
I'm a bit surprised that gdb isn't showing anything though, it should know that the address corresponds to a temporary symbol like `.L1234`. Perhaps you need to compile with -g to make this work, I'm not sure.
On Sun, 10 Feb 2019 at 07:50, Ömer Sinan Ağacan
wrote: I'm currently working on a bug and one of the things I often want to know is what's on the stack. The problem is I can't see labels of continuations so the information is really useless. Example:
>>> call printStack(((StgTSO*)0x42000e0198)->stackobj) 0x42000c8788: RET_SMALL (0x512d70) 0x42000c8790: RET_SMALL (0x40edf0) stk[5] (0x42000c8798) = 0x7b3938 0x42000c87a0: CATCH_FRAME(0x735a98,0x7d3ff2) 0x42000c87b8: STOP_FRAME(0x7311b8)
(I modified the printer to print stack locations when printing stacks)
Here I need to know which info table the RET_SMALLs return to. Normally I do this for other kinds of closures:
>>> print ((StgClosure*)...)->header.info $15 = (const StgInfoTable *) 0x404dc0
But for continuations that doesn't work:
>>> print ((StgClosure*)0x42000c8788)->header.info $11 = (const StgInfoTable *) 0x512d80 >>> info symbol 0x512d80 No symbol matches 0x512d80.
Anyone know how to make this work? Can I maybe mark the continuations label in the generated assembly somehow to make those labels available in gdb?
Thanks
Ömer _______________________________________________ ghc-devs mailing list ghc-devs@haskell.org https://urldefense.proofpoint.com/v2/url?u=http-3A__mail.haskell.org_cgi-2Dbin_mailman_listinfo_ghc-2Ddevs&d=DwIFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=kdITsLFp8oDGMKQlc9eIzA&m=TC61xap_n2utc37GJd4nKe0d_swgwMyqoHVKekcPDZk&s=OIXAtMjQkAnHAverwOpWQrKM1GIy-Eo85s3wxcnOqfU&e=

Anyone know where should I be looking at to improve this?
I found one workaround which is painful and does not work if you don't have the
asm dumps already, but basically if you can find the current location in the
program in the assembly dump you can find the map the symbols manually. E.g. I
see this in gdb:
0x0000000000405115 Main_main1_info+101 movq $0x405058,-0x10(%r12)
0x000000000040511e Main_main1_info+110 mov %rbx,(%r12)
0x0000000000405122 Main_main1_info+114 mov $0x8c7a9a,%edi
in the asm dump this code is shown as
movq $sat_s6gH_info,-16(%r12)
movq %rbx,(%r12)
movl $True_closure+2,%edi
Once I found the code in the asm dump I can map addresses to symbols
0x405058 -> sat_s6gH_info
0x8c7a98 -> True_closure
Ömer
Ömer Sinan Ağacan
Bumping thread, this is still a problem for me.
I wonder if this ever worked. I should try this with older GHCs.
Ömer
Sergei Azovskov
, 26 Şub 2019 Sal, 19:21 tarihinde şunu yazdı: Hey!
Unfortunately, I'm not a big expert in gdb and debugging ghc runtime. I stripped some auto generated symbols from the symtab but they can still be found in dwarf section. I don't know how to force gdb to show them but you can manually check via dwarfdump. ________________________________ From: Ömer Sinan Ağacan
Sent: Sunday, February 10, 2019 6:45 PM To: Simon Marlow Cc: ghc-devs; Sergei Azovskov Subject: Re: How do I find out which info table a continuation belongs to? I'm already using -g3. Here's my build.mk:
BuildFlavour = quick
ifneq "$(BuildFlavour)" "" include mk/flavours/$(BuildFlavour).mk endif
GhcRtsHcOpts += -O0 -g3 SRC_HC_OPTS += -g3 GhcStage1HcOpts += -g3 GhcStage2HcOpts += -g3 GhcLibHcOpts += -g3
STRIP_CMD = :
Ömer
Simon Marlow
, 10 Şub 2019 Paz, 19:00 tarihinde şunu yazdı: (cc Sergei Azovskov)
I'm a bit surprised that gdb isn't showing anything though, it should know that the address corresponds to a temporary symbol like `.L1234`. Perhaps you need to compile with -g to make this work, I'm not sure.
On Sun, 10 Feb 2019 at 07:50, Ömer Sinan Ağacan
wrote: I'm currently working on a bug and one of the things I often want to know is what's on the stack. The problem is I can't see labels of continuations so the information is really useless. Example:
>>> call printStack(((StgTSO*)0x42000e0198)->stackobj) 0x42000c8788: RET_SMALL (0x512d70) 0x42000c8790: RET_SMALL (0x40edf0) stk[5] (0x42000c8798) = 0x7b3938 0x42000c87a0: CATCH_FRAME(0x735a98,0x7d3ff2) 0x42000c87b8: STOP_FRAME(0x7311b8)
(I modified the printer to print stack locations when printing stacks)
Here I need to know which info table the RET_SMALLs return to. Normally I do this for other kinds of closures:
>>> print ((StgClosure*)...)->header.info $15 = (const StgInfoTable *) 0x404dc0
But for continuations that doesn't work:
>>> print ((StgClosure*)0x42000c8788)->header.info $11 = (const StgInfoTable *) 0x512d80 >>> info symbol 0x512d80 No symbol matches 0x512d80.
Anyone know how to make this work? Can I maybe mark the continuations label in the generated assembly somehow to make those labels available in gdb?
Thanks
Ömer _______________________________________________ ghc-devs mailing list ghc-devs@haskell.org https://urldefense.proofpoint.com/v2/url?u=http-3A__mail.haskell.org_cgi-2Dbin_mailman_listinfo_ghc-2Ddevs&d=DwIFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=kdITsLFp8oDGMKQlc9eIzA&m=TC61xap_n2utc37GJd4nKe0d_swgwMyqoHVKekcPDZk&s=OIXAtMjQkAnHAverwOpWQrKM1GIy-Eo85s3wxcnOqfU&e=
participants (1)
-
Ömer Sinan Ağacan