<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to view function parameters in core file in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/how-to-view-function-parameters-in-core-file/m-p/3849661#M98331</link>
    <description>Impressive!, Dennis&lt;BR /&gt;&lt;BR /&gt;Because I'm a newbie to disassembler and PA-RISC instruction set I still would need some help.&lt;BR /&gt;&lt;BR /&gt;With respect to memcpy(), its prototype is:&lt;BR /&gt;   void *memcpy(void *s1, const void *s2, size_t n);&lt;BR /&gt;Return value: s1.&lt;BR /&gt;&lt;BR /&gt;(gdb) disas $pc-4*4 $pc+4&lt;BR /&gt;Dump of assembler code from 0xc01ccb4c to 0xc01ccb60:&lt;BR /&gt;0xc01ccb4c &lt;MEMCPY&gt;:      ret &lt;BR /&gt;0xc01ccb50 &lt;MEMCPY&gt;:      stdby,e %r21,0(%r26)&lt;BR /&gt;0xc01ccb54 &lt;MEMCPY&gt;:      ldb,ma 1(%r25),%ret1&lt;BR /&gt;0xc01ccb58 &lt;MEMCPY&gt;:      addib,&amp;lt;&amp;gt; -1,%r24,0xc01ccb54 &lt;MEMCPY&gt;&lt;BR /&gt;0xc01ccb5c &lt;MEMCPY&gt;:      stb,ma %ret1,1(%r26)&lt;BR /&gt;End of assembler dump.&lt;BR /&gt;&lt;BR /&gt;(gdb) p /x $pc&lt;BR /&gt;$14 = 0xc01ccb5c&lt;BR /&gt;&lt;BR /&gt;From my University days, I think $pc was pointing to the next instruction to execute.&lt;BR /&gt;So in our case:&lt;BR /&gt;1) which assembly instruction is faulty? (addib?) &lt;BR /&gt;2) and what does it mean?&lt;BR /&gt;&lt;BR /&gt;(gdb) info reg&lt;BR /&gt;      flags:         32000041  &lt;BR /&gt;         r1:          b9ea800        rp/r2:         c690b683  &lt;BR /&gt;         r3:         7800dd64           r4:             1e78  &lt;BR /&gt;         r5:         44c0fad8           r6:         4007ea84  &lt;BR /&gt;         r7:               18           r8:                6  &lt;BR /&gt;         r9:         40080354          r10:                6  &lt;BR /&gt;        r11:         44bfe72c          r12:         7800dd94  &lt;BR /&gt;        r13:             1e78          r14:                0  &lt;BR /&gt;        r15:         c690b404          r16:                0  &lt;BR /&gt;        r17:         40059338          r18:         400593e0  &lt;BR /&gt;        r19:         77fd4794          r20:         44bfe708  &lt;BR /&gt;        r21:         c01cca18          r22:               18  &lt;BR /&gt;   arg3/r23:         c656d328     arg2/r24:                5  &lt;BR /&gt;   arg1/r25:         44c0fad9     arg0/r26:             1e79  &lt;BR /&gt;  dp/gp/r27:         40004280     ret0/r28:             1e79  &lt;BR /&gt;ret1/ap/r29:               c5       sp/r30:         7800e180  &lt;BR /&gt;    mrp/r31:                5     sar/cr11:               20  &lt;BR /&gt;      pcoqh:         c01ccb5c        pcsqh:          b9ea800  &lt;BR /&gt;      pcoqt:         c01ccb54        pcsqt:          b9ea800  &lt;BR /&gt;  eiem/cr15: ffffffffffffffff     iir/cr19:          f5d1222  &lt;BR /&gt;   isr/cr20:          d707800     ior/cr21:             1e79  &lt;BR /&gt;  ipsw/cr22:            c001f         goto:            96d84  &lt;BR /&gt;        sr4:          d707800          sr0:          b9ea800  &lt;BR /&gt;        sr1:                0          sr2:                0  &lt;BR /&gt;        sr3:                0          sr5:          471b800  &lt;BR /&gt;        sr6:          b9ea800          sr7:          b9ea800  &lt;BR /&gt;   rctr/cr0:                0    pidr1/cr8:          2815368  &lt;BR /&gt;  pidr2/cr9:          2815378     ccr/cr10:                0  &lt;BR /&gt; pidr3/cr12:                0   pidr4/cr13:        100000000  &lt;BR /&gt;       cr24:          2815130         cr25:                0  &lt;BR /&gt;       cr26:           c75e60   mpsfu_high:         40007280  &lt;BR /&gt;  mpsfu_low:           c67078  mpsfu_ovflo:                0  &lt;BR /&gt;        pad: 847b889002815000         fpsr:          c3fe03e  &lt;BR /&gt;       fpe1:                0         fpe2:                0  &lt;BR /&gt;       fpe3:                0         fpe4:                0  &lt;BR /&gt;       fpe5:                0         fpe6:                0  &lt;BR /&gt;       fpe7:                0  &lt;BR /&gt;&lt;BR /&gt;3) Shall I assume:&lt;BR /&gt;- %r26 is string 's1' = dst string (0x1e79)&lt;BR /&gt;- %r25 is string 's2' = src string (0x44c0fad9)&lt;BR /&gt;- %r24 is num bytes 'n' (5) ?&lt;BR /&gt;&lt;BR /&gt;4) And that it is trying (unsuccessfully) to copy '08 23 5a 5c 15' to dst?&lt;BR /&gt;(gdb) x /1g 0x1e79&lt;BR /&gt;0x1e79: 0xe5c7b3eca3287111&lt;BR /&gt;(gdb) x /1g 0x44c0fad9&lt;BR /&gt;0x44c0fad9:     0x08235a5c15000000&lt;BR /&gt;&lt;BR /&gt;gdb can print 0x44c0fad9, so it belongs to the process's memory space.&lt;BR /&gt;&lt;BR /&gt;5) Additionally, is this reasoning correct?: the memory address 0x44c0fad9 belongs to a data memory region of the process:&lt;BR /&gt;&lt;BR /&gt;(gdb) info target&lt;BR /&gt;Symbols from "/arcsde/sdeexe90/bin/gsrvr.shared".&lt;BR /&gt;Local core dump file:&lt;BR /&gt;        `/arcsde/sdeexe90/core.signal10', file type hpux-core.&lt;BR /&gt;        0x40001000 - 0x45840000 is .data&lt;BR /&gt;&lt;BR /&gt;Regarding frame#11 parameters:&lt;BR /&gt;&lt;BR /&gt;6) &amp;gt;&amp;gt;&amp;gt;&amp;gt; You can use "frame 12" and look at the machine code.&lt;BR /&gt;I have tried with frame 1 to infere the parameters to frame 0 but it is too hard for me.&lt;BR /&gt;I still have to study a lot :-)&lt;BR /&gt;&lt;BR /&gt;7) &amp;gt;&amp;gt;&amp;gt;&amp;gt; Assuming they have been stored:&lt;BR /&gt;&lt;BR /&gt;OCIStmtExecute() prototype is:&lt;BR /&gt;&lt;BR /&gt;sword OCIStmtExecute ( OCISvcCtx *svchp,&lt;BR /&gt;OCIStmt *stmtp,&lt;BR /&gt;OCIError *errhp,&lt;BR /&gt;ub4 iters,&lt;BR /&gt;ub4 rowoff,&lt;BR /&gt;CONST OCISnapshot *snap_in,&lt;BR /&gt;OCISnapshot *snap_out,&lt;BR /&gt;ub4 mode );&lt;BR /&gt;&lt;BR /&gt;that is:&lt;BR /&gt;(ptr, ptr, ptr, int, int, ptr, ptr, int)&lt;BR /&gt;By calling sizeof(...) I deduce both 'ptr' and 'int' are 4 bytes long.&lt;BR /&gt;So, in this case, their values were:&lt;BR /&gt;&lt;BR /&gt;(gdb) frame 12&lt;BR /&gt;#12 0xda755cbc in db_sda_execute_stmt+0x14c ()&lt;BR /&gt;   from /arcsde/sdeexe90/lib/libsdeora8isrvr90.sl&lt;BR /&gt;(gdb)  x /xw $sp-32-4*1&lt;BR /&gt;0x7800ce1c:     0x4003b380&lt;BR /&gt;(gdb)  x /xw $sp-32-4*2&lt;BR /&gt;0x7800ce18:     0x0056ccd4&lt;BR /&gt;(gdb)  x /xw $sp-32-4*3&lt;BR /&gt;0x7800ce14:     0x7800cca4&lt;BR /&gt;(gdb)  x /xw $sp-32-4*4&lt;BR /&gt;0x7800ce10:     0x40008ab4&lt;BR /&gt;(gdb)  x /xw $sp-32-4*5&lt;BR /&gt;0x7800ce0c:     0x00000000&lt;BR /&gt;(gdb)  x /xw $sp-32-4*6&lt;BR /&gt;0x7800ce08:     0x00000000&lt;BR /&gt;(gdb)  x /xw $sp-32-4*7&lt;BR /&gt;0x7800ce04:     0x00000000&lt;BR /&gt;(gdb)  x /xw $sp-32-4*8&lt;BR /&gt;0x7800ce00:     0x00000000&lt;BR /&gt;&lt;BR /&gt;Is that right?&lt;BR /&gt;If so, parameter 4 seems rather incorrect: should be a number and looks like a memory address.&lt;BR /&gt;Maybe this is the original problem ???&lt;BR /&gt;&lt;/MEMCPY&gt;&lt;/MEMCPY&gt;&lt;/MEMCPY&gt;&lt;/MEMCPY&gt;&lt;/MEMCPY&gt;&lt;/MEMCPY&gt;</description>
    <pubDate>Mon, 28 Aug 2006 06:35:49 GMT</pubDate>
    <dc:creator>Jose M. del Rio</dc:creator>
    <dc:date>2006-08-28T06:35:49Z</dc:date>
    <item>
      <title>How to view function parameters in core file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-view-function-parameters-in-core-file/m-p/3849657#M98327</link>
      <description>I'm troubleshooting a 3rd party SW (ESRI ArcSDE) running on top of Oracle - HP-UX.&lt;BR /&gt;From time to time (several times a day) one of ArcSDE's processes (called 'gsrvr') core dumps on signal 10.&lt;BR /&gt;I have downloaded and installed WDB (an used it for the very first time to examine the core file).&lt;BR /&gt;The faulting stack trace is:&lt;BR /&gt;&lt;BR /&gt;#0  0xc01ccb5c in memcpy+0x144 () from /usr/lib/libc.2&lt;BR /&gt;#1  0xc6d0b680 in kpcxk2u+0x2cc () from /ora8/lib/libclntsh.sl.8.0&lt;BR /&gt;#2  0xc6d38960 in ttccDefineConvert+0x114 () from /ora8/lib/libclntsh.sl.8.0&lt;BR /&gt;#3  0xc6d38d9c in ttccfpg+0x370 () from /ora8/lib/libclntsh.sl.8.0&lt;BR /&gt;#4  0xc6d181d8 in ttcfour+0x130 () from /ora8/lib/libclntsh.sl.8.0&lt;BR /&gt;#5  0xc6d1494c in ttcdrv+0x119c () from /ora8/lib/libclntsh.sl.8.0&lt;BR /&gt;#6  0xc6baf2ac in nioqwa+0x4c () from /ora8/lib/libclntsh.sl.8.0&lt;BR /&gt;#7  0xc6a01ecc in upirtrc+0x200 () from /ora8/lib/libclntsh.sl.8.0&lt;BR /&gt;#8  0xc6a51ca8 in kpurcsc+0x70 () from /ora8/lib/libclntsh.sl.8.0&lt;BR /&gt;#9  0xc6a2381c in kpuexecv8+0xa90 () from /ora8/lib/libclntsh.sl.8.0&lt;BR /&gt;#10 0xc6a25c74 in kpuexec+0xe00 () from /ora8/lib/libclntsh.sl.8.0&lt;BR /&gt;#11 0xc69e5a9c in OCIStmtExecute+0x30 () from /ora8/lib/libclntsh.sl.8.0&lt;BR /&gt;#12 0xc7255cbc in db_sda_execute_stmt+0x14c () from /arcsde/sdeexe90/lib/libsdeora8isrvr90.sl&lt;BR /&gt;#13 0xc7256078 in db_sda_execute_and_fetch+0x14 () from /arcsde/sdeexe90/lib/libsdeora8isrvr90.sl&lt;BR /&gt;#14 0xc71ac864 in db_execute_and_fetch_data+0x6c () from /arcsde/sdeexe90/lib/libsdeora8isrvr90.sl&lt;BR /&gt;#15 0xc72bcac0 in db_array_fetch_spix_recs+0x74 () from /arcsde/sdeexe90/lib/libsdeora8isrvr90.sl&lt;BR /&gt;#16 0xc72bc1f4 in db_get_spix_fidlist+0xf0 () from /arcsde/sdeexe90/lib/libsdeora8isrvr90.sl&lt;BR /&gt;#17 0xc72996fc in db_fetch_search_row+0x58 () from /arcsde/sdeexe90/lib/libsdeora8isrvr90.sl&lt;BR /&gt;#18 0xc72b3544 in S_fetch_search_row_by_storage_type+0x58 () from /arcsde/sdeexe90/lib/libsdeora8isrvr90.sl&lt;BR /&gt;#19 0xc72b3124 in DB_stream_fetch_row+0x88 () from /arcsde/sdeexe90/lib/libsdeora8isrvr90.sl&lt;BR /&gt;#20 0x630b4 in &lt;UNKNOWN_PROCEDURE&gt; + 0x134 ()&lt;BR /&gt;#21 0x62e7c in &lt;UNKNOWN_PROCEDURE&gt; ()&lt;BR /&gt;#22 0x1bff8 in &lt;UNKNOWN_PROCEDURE&gt; + 0x78 ()&lt;BR /&gt;#23 0x523fc in &lt;UNKNOWN_PROCEDURE&gt; + 0x278c ()&lt;BR /&gt;#24 0x4f8a8 in &lt;UNKNOWN_PROCEDURE&gt; + 0x20 ()&lt;BR /&gt;&lt;BR /&gt;My hypothesis is: gsrvr is passing to Oracle a wrong memory address as one of the parameters to Oracle's function OCIStmtExecute() (frame #11). So, when Oracle tries to memcpy (frame #0) to this address, it SIGBUSes.&lt;BR /&gt;&lt;BR /&gt;By using gdb, I would like to:&lt;BR /&gt;1) obtain the args (memory addresses) passed to OCIStmtExecute()&lt;BR /&gt;2) dump the contents of these addresses and compare them with the OCI structures parameters, as they should be (Oracle doc).&lt;BR /&gt;&lt;BR /&gt;I know:&lt;BR /&gt;2) I must use the 'x' command to dump a memory address&lt;BR /&gt;1) as I have no symbols' information (neither Oracle's nor ArcSDE's), gdb cannot possibly know the types and sizes of the parameters passed to the OCIStmtExecute() at frame #11&lt;BR /&gt;but, anyway, I would like to dig into it. &lt;BR /&gt;&lt;BR /&gt;So the questions would be:&lt;BR /&gt;a) is it possible to know what the args passed to frame #11 were?&lt;BR /&gt;b) and to frame #0 (memcpy)?&lt;BR /&gt;In both cases:&lt;BR /&gt;c) is there any way to determine whether those addresses indeed belonged (were malloc'ed by) the running process.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The only related thing I've found is at "Debugging with GDB" manual:&lt;BR /&gt;"When GDB has no debug information; it does not know where the arguments are&lt;BR /&gt;located or even the type of the arguments. GDB cannot infer this in an optimized,&lt;BR /&gt;non-debug executable.&lt;BR /&gt;However, for integer arguments you can find the first few parameters for the top-of-&lt;BR /&gt;stack frame by looking at the registers. On PA-RISC systems, the first parameter will&lt;BR /&gt;be in $r26, the second in $r25 and so on."&lt;BR /&gt;Thanks.&lt;BR /&gt;&lt;/UNKNOWN_PROCEDURE&gt;&lt;/UNKNOWN_PROCEDURE&gt;&lt;/UNKNOWN_PROCEDURE&gt;&lt;/UNKNOWN_PROCEDURE&gt;&lt;/UNKNOWN_PROCEDURE&gt;</description>
      <pubDate>Thu, 24 Aug 2006 05:38:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-view-function-parameters-in-core-file/m-p/3849657#M98327</guid>
      <dc:creator>Jose M. del Rio</dc:creator>
      <dc:date>2006-08-24T05:38:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to view function parameters in core file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-view-function-parameters-in-core-file/m-p/3849658#M98328</link>
      <description>Do you have support/maintenance for ArcSDE?  If so, I'd contact them.  Are you current on ArcSDE patches?&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://support.esri.com/index.cfm?fa=downloads.patchesServicePacks.listPatches&amp;amp;PID=19" target="_blank"&gt;http://support.esri.com/index.cfm?fa=downloads.patchesServicePacks.listPatches&amp;amp;PID=19&lt;/A&gt;</description>
      <pubDate>Thu, 24 Aug 2006 08:59:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-view-function-parameters-in-core-file/m-p/3849658#M98328</guid>
      <dc:creator>OldSchool</dc:creator>
      <dc:date>2006-08-24T08:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to view function parameters in core file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-view-function-parameters-in-core-file/m-p/3849659#M98329</link>
      <description>&lt;!--!*#--&gt;Hi SA,&lt;BR /&gt;Yes, we have support.&lt;BR /&gt;Until a couple of weeks we were up to date with version/patches.&lt;BR /&gt;ESRI has just released a new version that we are testing at preproduction.&lt;BR /&gt;Thanks for your input.</description>
      <pubDate>Fri, 25 Aug 2006 05:11:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-view-function-parameters-in-core-file/m-p/3849659#M98329</guid>
      <dc:creator>Jose M. del Rio</dc:creator>
      <dc:date>2006-08-25T05:11:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to view function parameters in core file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-view-function-parameters-in-core-file/m-p/3849660#M98330</link>
      <description>To find why memcpy is aborting you should look at the current instructions and the registers:&lt;BR /&gt;(gdb) disas $pc-4*4 $pc+4&lt;BR /&gt;(gdb) info reg&lt;BR /&gt;&lt;BR /&gt;And from the instruction at $pc figure out whether load or store and which of $r26 .. $r24 are being used and their values.&lt;BR /&gt;Note memcpy would be special (hand optimized) in that its parms would still be in registers.&lt;BR /&gt;&lt;BR /&gt;As to frame #11, you will have to look at the machine code or assume the parms are stored in their default locatations.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;a) is it possible to know what the args passed to frame #11 were?&lt;BR /&gt;&lt;BR /&gt;Several ways.  You can use "frame 12" and look at the machine code.&lt;BR /&gt;Or you can assume they have been stored.  So use:&lt;BR /&gt;(gdb) frame 12&lt;BR /&gt;(gdb) x /8x $sp-64&lt;BR /&gt;&lt;BR /&gt;Assuming the arguments are not more than 4 bytes in size or pointers, the last is the first arg.&lt;BR /&gt;Assuming the first arg is a pointer you could use:&lt;BR /&gt;(gdb) x /8x *(void**)($sp-32-4*1)&lt;BR /&gt;(and so on, by replacing the "1" above.)&lt;BR /&gt;&lt;BR /&gt;&amp;gt;b) and to frame #0 (memcpy)?&lt;BR /&gt;&lt;BR /&gt;Here you print out the registers:&lt;BR /&gt;(gdb) p /x $r26&lt;BR /&gt;(gdb) p /x $r25&lt;BR /&gt;(gdb) p $r24&lt;BR /&gt;&lt;BR /&gt;&amp;gt;c) is there any way to determine whether those addresses indeed belonged the running process.&lt;BR /&gt;&lt;BR /&gt;It's pretty simple, if gdb can display them, they belong.</description>
      <pubDate>Sat, 26 Aug 2006 01:19:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-view-function-parameters-in-core-file/m-p/3849660#M98330</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2006-08-26T01:19:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to view function parameters in core file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-view-function-parameters-in-core-file/m-p/3849661#M98331</link>
      <description>Impressive!, Dennis&lt;BR /&gt;&lt;BR /&gt;Because I'm a newbie to disassembler and PA-RISC instruction set I still would need some help.&lt;BR /&gt;&lt;BR /&gt;With respect to memcpy(), its prototype is:&lt;BR /&gt;   void *memcpy(void *s1, const void *s2, size_t n);&lt;BR /&gt;Return value: s1.&lt;BR /&gt;&lt;BR /&gt;(gdb) disas $pc-4*4 $pc+4&lt;BR /&gt;Dump of assembler code from 0xc01ccb4c to 0xc01ccb60:&lt;BR /&gt;0xc01ccb4c &lt;MEMCPY&gt;:      ret &lt;BR /&gt;0xc01ccb50 &lt;MEMCPY&gt;:      stdby,e %r21,0(%r26)&lt;BR /&gt;0xc01ccb54 &lt;MEMCPY&gt;:      ldb,ma 1(%r25),%ret1&lt;BR /&gt;0xc01ccb58 &lt;MEMCPY&gt;:      addib,&amp;lt;&amp;gt; -1,%r24,0xc01ccb54 &lt;MEMCPY&gt;&lt;BR /&gt;0xc01ccb5c &lt;MEMCPY&gt;:      stb,ma %ret1,1(%r26)&lt;BR /&gt;End of assembler dump.&lt;BR /&gt;&lt;BR /&gt;(gdb) p /x $pc&lt;BR /&gt;$14 = 0xc01ccb5c&lt;BR /&gt;&lt;BR /&gt;From my University days, I think $pc was pointing to the next instruction to execute.&lt;BR /&gt;So in our case:&lt;BR /&gt;1) which assembly instruction is faulty? (addib?) &lt;BR /&gt;2) and what does it mean?&lt;BR /&gt;&lt;BR /&gt;(gdb) info reg&lt;BR /&gt;      flags:         32000041  &lt;BR /&gt;         r1:          b9ea800        rp/r2:         c690b683  &lt;BR /&gt;         r3:         7800dd64           r4:             1e78  &lt;BR /&gt;         r5:         44c0fad8           r6:         4007ea84  &lt;BR /&gt;         r7:               18           r8:                6  &lt;BR /&gt;         r9:         40080354          r10:                6  &lt;BR /&gt;        r11:         44bfe72c          r12:         7800dd94  &lt;BR /&gt;        r13:             1e78          r14:                0  &lt;BR /&gt;        r15:         c690b404          r16:                0  &lt;BR /&gt;        r17:         40059338          r18:         400593e0  &lt;BR /&gt;        r19:         77fd4794          r20:         44bfe708  &lt;BR /&gt;        r21:         c01cca18          r22:               18  &lt;BR /&gt;   arg3/r23:         c656d328     arg2/r24:                5  &lt;BR /&gt;   arg1/r25:         44c0fad9     arg0/r26:             1e79  &lt;BR /&gt;  dp/gp/r27:         40004280     ret0/r28:             1e79  &lt;BR /&gt;ret1/ap/r29:               c5       sp/r30:         7800e180  &lt;BR /&gt;    mrp/r31:                5     sar/cr11:               20  &lt;BR /&gt;      pcoqh:         c01ccb5c        pcsqh:          b9ea800  &lt;BR /&gt;      pcoqt:         c01ccb54        pcsqt:          b9ea800  &lt;BR /&gt;  eiem/cr15: ffffffffffffffff     iir/cr19:          f5d1222  &lt;BR /&gt;   isr/cr20:          d707800     ior/cr21:             1e79  &lt;BR /&gt;  ipsw/cr22:            c001f         goto:            96d84  &lt;BR /&gt;        sr4:          d707800          sr0:          b9ea800  &lt;BR /&gt;        sr1:                0          sr2:                0  &lt;BR /&gt;        sr3:                0          sr5:          471b800  &lt;BR /&gt;        sr6:          b9ea800          sr7:          b9ea800  &lt;BR /&gt;   rctr/cr0:                0    pidr1/cr8:          2815368  &lt;BR /&gt;  pidr2/cr9:          2815378     ccr/cr10:                0  &lt;BR /&gt; pidr3/cr12:                0   pidr4/cr13:        100000000  &lt;BR /&gt;       cr24:          2815130         cr25:                0  &lt;BR /&gt;       cr26:           c75e60   mpsfu_high:         40007280  &lt;BR /&gt;  mpsfu_low:           c67078  mpsfu_ovflo:                0  &lt;BR /&gt;        pad: 847b889002815000         fpsr:          c3fe03e  &lt;BR /&gt;       fpe1:                0         fpe2:                0  &lt;BR /&gt;       fpe3:                0         fpe4:                0  &lt;BR /&gt;       fpe5:                0         fpe6:                0  &lt;BR /&gt;       fpe7:                0  &lt;BR /&gt;&lt;BR /&gt;3) Shall I assume:&lt;BR /&gt;- %r26 is string 's1' = dst string (0x1e79)&lt;BR /&gt;- %r25 is string 's2' = src string (0x44c0fad9)&lt;BR /&gt;- %r24 is num bytes 'n' (5) ?&lt;BR /&gt;&lt;BR /&gt;4) And that it is trying (unsuccessfully) to copy '08 23 5a 5c 15' to dst?&lt;BR /&gt;(gdb) x /1g 0x1e79&lt;BR /&gt;0x1e79: 0xe5c7b3eca3287111&lt;BR /&gt;(gdb) x /1g 0x44c0fad9&lt;BR /&gt;0x44c0fad9:     0x08235a5c15000000&lt;BR /&gt;&lt;BR /&gt;gdb can print 0x44c0fad9, so it belongs to the process's memory space.&lt;BR /&gt;&lt;BR /&gt;5) Additionally, is this reasoning correct?: the memory address 0x44c0fad9 belongs to a data memory region of the process:&lt;BR /&gt;&lt;BR /&gt;(gdb) info target&lt;BR /&gt;Symbols from "/arcsde/sdeexe90/bin/gsrvr.shared".&lt;BR /&gt;Local core dump file:&lt;BR /&gt;        `/arcsde/sdeexe90/core.signal10', file type hpux-core.&lt;BR /&gt;        0x40001000 - 0x45840000 is .data&lt;BR /&gt;&lt;BR /&gt;Regarding frame#11 parameters:&lt;BR /&gt;&lt;BR /&gt;6) &amp;gt;&amp;gt;&amp;gt;&amp;gt; You can use "frame 12" and look at the machine code.&lt;BR /&gt;I have tried with frame 1 to infere the parameters to frame 0 but it is too hard for me.&lt;BR /&gt;I still have to study a lot :-)&lt;BR /&gt;&lt;BR /&gt;7) &amp;gt;&amp;gt;&amp;gt;&amp;gt; Assuming they have been stored:&lt;BR /&gt;&lt;BR /&gt;OCIStmtExecute() prototype is:&lt;BR /&gt;&lt;BR /&gt;sword OCIStmtExecute ( OCISvcCtx *svchp,&lt;BR /&gt;OCIStmt *stmtp,&lt;BR /&gt;OCIError *errhp,&lt;BR /&gt;ub4 iters,&lt;BR /&gt;ub4 rowoff,&lt;BR /&gt;CONST OCISnapshot *snap_in,&lt;BR /&gt;OCISnapshot *snap_out,&lt;BR /&gt;ub4 mode );&lt;BR /&gt;&lt;BR /&gt;that is:&lt;BR /&gt;(ptr, ptr, ptr, int, int, ptr, ptr, int)&lt;BR /&gt;By calling sizeof(...) I deduce both 'ptr' and 'int' are 4 bytes long.&lt;BR /&gt;So, in this case, their values were:&lt;BR /&gt;&lt;BR /&gt;(gdb) frame 12&lt;BR /&gt;#12 0xda755cbc in db_sda_execute_stmt+0x14c ()&lt;BR /&gt;   from /arcsde/sdeexe90/lib/libsdeora8isrvr90.sl&lt;BR /&gt;(gdb)  x /xw $sp-32-4*1&lt;BR /&gt;0x7800ce1c:     0x4003b380&lt;BR /&gt;(gdb)  x /xw $sp-32-4*2&lt;BR /&gt;0x7800ce18:     0x0056ccd4&lt;BR /&gt;(gdb)  x /xw $sp-32-4*3&lt;BR /&gt;0x7800ce14:     0x7800cca4&lt;BR /&gt;(gdb)  x /xw $sp-32-4*4&lt;BR /&gt;0x7800ce10:     0x40008ab4&lt;BR /&gt;(gdb)  x /xw $sp-32-4*5&lt;BR /&gt;0x7800ce0c:     0x00000000&lt;BR /&gt;(gdb)  x /xw $sp-32-4*6&lt;BR /&gt;0x7800ce08:     0x00000000&lt;BR /&gt;(gdb)  x /xw $sp-32-4*7&lt;BR /&gt;0x7800ce04:     0x00000000&lt;BR /&gt;(gdb)  x /xw $sp-32-4*8&lt;BR /&gt;0x7800ce00:     0x00000000&lt;BR /&gt;&lt;BR /&gt;Is that right?&lt;BR /&gt;If so, parameter 4 seems rather incorrect: should be a number and looks like a memory address.&lt;BR /&gt;Maybe this is the original problem ???&lt;BR /&gt;&lt;/MEMCPY&gt;&lt;/MEMCPY&gt;&lt;/MEMCPY&gt;&lt;/MEMCPY&gt;&lt;/MEMCPY&gt;&lt;/MEMCPY&gt;</description>
      <pubDate>Mon, 28 Aug 2006 06:35:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-view-function-parameters-in-core-file/m-p/3849661#M98331</guid>
      <dc:creator>Jose M. del Rio</dc:creator>
      <dc:date>2006-08-28T06:35:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to view function parameters in core file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-view-function-parameters-in-core-file/m-p/3849662#M98332</link>
      <description>I'm a bit confused.&lt;BR /&gt;I have developed the following program:&lt;BR /&gt;&lt;BR /&gt;int foo2(char* s)&lt;BR /&gt;{&lt;BR /&gt;  char* aux;&lt;BR /&gt;&lt;BR /&gt;  printf("dentro\n");&lt;BR /&gt;  aux = 0x12345678;&lt;BR /&gt;  memcpy(aux, s, 3);  // &amp;lt;--- here&lt;BR /&gt;  return 9;&lt;BR /&gt;}&lt;BR /&gt;int main(argc, argv)&lt;BR /&gt;int argc;&lt;BR /&gt;char *argv[];&lt;BR /&gt;{&lt;BR /&gt;  char* s;&lt;BR /&gt;  s = (char*) malloc(3);&lt;BR /&gt;  if(!s) {printf("fallo malloc\n"); return 1;}&lt;BR /&gt;  printf("0x%x\n", s);&lt;BR /&gt;  memcpy(s, "ABC", 3);&lt;BR /&gt;  foo2(s);&lt;BR /&gt;  free(s);&lt;BR /&gt;  return 0;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;in order to produce a core and debug it with gdb to test the memcpy() arguments at $r26, $r25, $r24.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;ORACLE8_desar&amp;gt;./cdemo81           &lt;BR /&gt;0x40004bb8&lt;BR /&gt;dentro&lt;BR /&gt;Memory fault(coredump)&lt;BR /&gt;ORACLE8_desar&amp;gt;gdb cdemo81 core&lt;BR /&gt;...&lt;BR /&gt;(gdb) bt&lt;BR /&gt;#0  0xc01cd59c in memcpy+0x144 () from /usr/lib/libc.2&lt;BR /&gt;#1  0x6cb8 in foo2+0x74 ()&lt;BR /&gt;#2  0x6e10 in main+0xfc ()&lt;BR /&gt;(gdb) p /x $r26&lt;BR /&gt;$1 = 0x12345678&lt;BR /&gt;(gdb) p /x $r25&lt;BR /&gt;$2 = 0x40004bb9&lt;BR /&gt;(gdb) p /x $r24&lt;BR /&gt;$3 = 0x2&lt;BR /&gt;&lt;BR /&gt;Surprise!&lt;BR /&gt;1) $r25 contains 0x40004bb9 but the src string is 0x40004bb8&lt;BR /&gt;2) $r24 contains 2 but the number of bytes to copy was 3.&lt;BR /&gt;Am I misinterpreting something?</description>
      <pubDate>Mon, 28 Aug 2006 07:12:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-view-function-parameters-in-core-file/m-p/3849662#M98332</guid>
      <dc:creator>Jose M. del Rio</dc:creator>
      <dc:date>2006-08-28T07:12:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to view function parameters in core file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-view-function-parameters-in-core-file/m-p/3849663#M98333</link>
      <description>Back to the original issue (gsrvr calling OCIStmtExecute()), even more insteresting than parameter 4 is parameter 2: it seems it is not included in the process's memory regions.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;(gdb) frame 12&lt;BR /&gt;#12 0xda755cbc in db_sda_execute_stmt+0x14c ()&lt;BR /&gt;   from /arcsde/sdeexe90/lib/libsdeora8isrvr90.sl&lt;BR /&gt;(gdb) x /xw $sp-32-4*2&lt;BR /&gt;0x7800ce18:     0x0056ccd4&lt;BR /&gt;&lt;BR /&gt;(gdb) x /xw 0x0056ccd4&lt;BR /&gt;0x56ccd4:       Cannot access memory at address 0x56ccd4&lt;BR /&gt;</description>
      <pubDate>Mon, 28 Aug 2006 08:10:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-view-function-parameters-in-core-file/m-p/3849663#M98333</guid>
      <dc:creator>Jose M. del Rio</dc:creator>
      <dc:date>2006-08-28T08:10:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to view function parameters in core file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-view-function-parameters-in-core-file/m-p/3849664#M98334</link>
      <description>More doubts.&lt;BR /&gt;I have developed the following program:&lt;BR /&gt;int main(argc, argv)&lt;BR /&gt;int argc;&lt;BR /&gt;char *argv[];&lt;BR /&gt;{&lt;BR /&gt;  OCIStmtExecute(1, 2, 3, 4, 5, 6, 7, 8);&lt;BR /&gt;  return 1;&lt;BR /&gt;}&lt;BR /&gt;to get a core and check the validity of the rule:&lt;BR /&gt;x /xw $sp-32-4*N&lt;BR /&gt;which doesn't seem to work in this case?:&lt;BR /&gt;(gdb) x /xw $sp-32-4*1&lt;BR /&gt;0x77ff094c:     0x00000000&lt;BR /&gt;(gdb) x /xw $sp-32-4*2&lt;BR /&gt;0x77ff0948:     0x00000000&lt;BR /&gt;(gdb) x /xw $sp-32-4*3&lt;BR /&gt;0x77ff0944:     0x00000000&lt;BR /&gt;&lt;BR /&gt;Is there a different rule for calls to functions in another file? (e.g. shared library).&lt;BR /&gt;Am I doing st wrong?&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 28 Aug 2006 11:04:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-view-function-parameters-in-core-file/m-p/3849664#M98334</guid>
      <dc:creator>Jose M. del Rio</dc:creator>
      <dc:date>2006-08-28T11:04:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to view function parameters in core file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-view-function-parameters-in-core-file/m-p/3849665#M98335</link>
      <description>&amp;gt;I'm a bit confused.&lt;BR /&gt;&amp;gt;I have developed the following program:&lt;BR /&gt;&lt;BR /&gt;&amp;gt;int foo2(char* s)&lt;BR /&gt;&amp;gt;{&lt;BR /&gt;&amp;gt;char* aux;&lt;BR /&gt;&lt;BR /&gt;&amp;gt;printf("dentro\n");&lt;BR /&gt;&amp;gt;aux = 0x12345678;&lt;BR /&gt;&amp;gt;memcpy(aux, s, 3); // &amp;lt;--- here&lt;BR /&gt;&amp;gt;return 9;&lt;BR /&gt;&amp;gt;}&lt;BR /&gt;&amp;gt;int main(argc, argv)&lt;BR /&gt;&amp;gt;int argc;&lt;BR /&gt;&amp;gt;char *argv[];&lt;BR /&gt;&amp;gt;{&lt;BR /&gt;&amp;gt;char* s;&lt;BR /&gt;&amp;gt;s = (char*) malloc(3);&lt;BR /&gt;&amp;gt;if(!s) {printf("fallo malloc\n"); return 1;}&lt;BR /&gt;&amp;gt;printf("0x%x\n", s);&lt;BR /&gt;&amp;gt;memcpy(s, "ABC", 3);&lt;BR /&gt;&amp;gt;foo2(s);&lt;BR /&gt;&amp;gt;free(s);&lt;BR /&gt;&amp;gt;return 0;&lt;BR /&gt;&amp;gt;}&lt;BR /&gt;&lt;BR /&gt;&amp;gt;in order to produce a core and debug it with gdb to test the memcpy()&lt;BR /&gt;&amp;gt;arguments at $r26, $r25, $r24.&lt;BR /&gt;&lt;BR /&gt;A suggestion Jose; variable declaration and assignment is incorrect i.e. aux is a pointer to char but you have assigned it to an array. imho the proper way to do this would be:&lt;BR /&gt;&lt;BR /&gt;change...&lt;BR /&gt;&amp;gt;aux = 0x12345678;&lt;BR /&gt;to...&lt;BR /&gt;char t[] = "0x12345678";&lt;BR /&gt;char *aux = t;&lt;BR /&gt;&lt;BR /&gt;hope it helps!</description>
      <pubDate>Mon, 28 Aug 2006 12:47:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-view-function-parameters-in-core-file/m-p/3849665#M98335</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-08-28T12:47:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to view function parameters in core file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-view-function-parameters-in-core-file/m-p/3849666#M98336</link>
      <description>Hi Sandman,&lt;BR /&gt;Thanks for reading the long post (that deserves some prize ;-) and even answering.&lt;BR /&gt;I don't get your point.&lt;BR /&gt;The syntax you suggest assigns the string "0x12345678" to aux.&lt;BR /&gt;This is not my intention.&lt;BR /&gt;I intend to assign the memory address 0x12345678 to aux and write some data to it so that a sigbus is raised (and a core dumped). And it is, actually.</description>
      <pubDate>Mon, 28 Aug 2006 13:34:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-view-function-parameters-in-core-file/m-p/3849666#M98336</guid>
      <dc:creator>Jose M. del Rio</dc:creator>
      <dc:date>2006-08-28T13:34:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to view function parameters in core file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-view-function-parameters-in-core-file/m-p/3849667#M98337</link>
      <description>Jose,&lt;BR /&gt;&lt;BR /&gt;Compiling your code and executing it gives a core dump and when i do a file on it, it tells me that the executable image actually received a SIGSEGV signal not a SIGBUS?&lt;BR /&gt;&lt;BR /&gt;# file core</description>
      <pubDate>Mon, 28 Aug 2006 13:58:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-view-function-parameters-in-core-file/m-p/3849667#M98337</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-08-28T13:58:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to view function parameters in core file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-view-function-parameters-in-core-file/m-p/3849668#M98338</link>
      <description>&amp;gt; 1) which assembly instruction is faulty? (addib?)&lt;BR /&gt;&lt;BR /&gt;No, PC points at the faulting instruction.  In this case STB.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;2) and what does it mean?&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://h21007.www2.hp.com/dspp/tech/tech_TechDocumentDetailPage_IDX/1,1701,959,00.html" target="_blank"&gt;http://h21007.www2.hp.com/dspp/tech/tech_TechDocumentDetailPage_IDX/1,1701,959,00.html&lt;/A&gt;&lt;BR /&gt;Store a byte from RET1 0xc5 at R26 0x1e79 and increment after.&lt;BR /&gt;&lt;BR /&gt;In this case R26 is bad in that 0x1e79 is a read only constant.&lt;BR /&gt;&lt;BR /&gt; 3) Shall I assume:&lt;BR /&gt;- %r26 is string 's1' = dst string (0x1e79)&lt;BR /&gt;- %r25 is string 's2' = src string (0x44c0fad9)&lt;BR /&gt;- %r24 is num bytes 'n' (5)?&lt;BR /&gt;&lt;BR /&gt;Yes, except it may have already incremented R25 since the char to store is 0xc5.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;4) And that it is trying (unsuccessfully) to copy '08 23 5a 5c 15' to dst?&lt;BR /&gt;&lt;BR /&gt;Or 1 byte sooner.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;gdb can print 0x44c0fad9, so it belongs to the process's memory space. &lt;BR /&gt;&lt;BR /&gt;Yes, while gdb can print 0x1e79, the hardware  will not let the application write to it.  (Though gdb can.)&lt;BR /&gt;&lt;BR /&gt;&amp;gt;5) the memory address 0x44c0fad9 belongs to a data memory region of the process:&lt;BR /&gt;&lt;BR /&gt;Yes.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;6) I have tried with frame 1 to infere the parameters to frame 0 but it is too hard for me.&lt;BR /&gt;&lt;BR /&gt;You can't. I noted that:&lt;BR /&gt;   Note memcpy would be special&lt;BR /&gt;&lt;BR /&gt;Only by disassembling frame 1 could you attempt to figure out the original parms.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;7) &amp;gt;&amp;gt;&amp;gt;&amp;gt; Assuming they have been stored:&lt;BR /&gt;&lt;BR /&gt;&amp;gt;If so, parameter 4 seems rather incorrect:&lt;BR /&gt;&lt;BR /&gt;Then it hasn't been stored.  If you disassemble frame #11, you'll probably see no stores for R23 at the beginning.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;int main(argc, argv)&lt;BR /&gt;&lt;BR /&gt;(This is a K&amp;amp;R style definition, only use strict ANSI C or C++ style.)&lt;BR /&gt;&lt;BR /&gt;&amp;gt;s = (char*)malloc(3);&lt;BR /&gt;&lt;BR /&gt;(If you really want to put a string there, you need to have 3+1 for the NULL char.)&lt;BR /&gt;&lt;BR /&gt;&amp;gt;1) $r25 contains 0x40004bb9 but the src string is 0x40004bb8&lt;BR /&gt;&amp;gt;2) $r24 contains 2 but the number of bytes to copy was 3.&lt;BR /&gt;&amp;gt;Am I misinterpreting something?&lt;BR /&gt;&lt;BR /&gt;You are looking at the CURRENT register contents.  It has already done 2/3 of the work to copy 1 byte.&lt;BR /&gt;0xc01ccb54: ldb,ma 1(%r25),%ret1&lt;BR /&gt;0xc01ccb58: addib,&amp;lt;&amp;gt; -1,%r24,0xc01ccb54&lt;BR /&gt;0xc01ccb5c: stb,ma %ret1,1(%r26) &amp;lt;&amp;lt;&amp;lt;&lt;BR /&gt;&lt;BR /&gt;&amp;gt;parameter 2: it seems it is not included in the process's memory regions.&lt;BR /&gt;&lt;BR /&gt;If R25 hasn't been stored, stored args area will be garbage.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Is there a different rule for calls to functions in another file?&lt;BR /&gt;&lt;BR /&gt;Only that the parms have to be stored, not optimized away.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Sandman! variable declaration and assignment is incorrect&lt;BR /&gt;&lt;BR /&gt;This is perfectly correct if Jose wants it to abort.  You need to take away his 3 points.  :-)&lt;BR /&gt;&lt;BR /&gt;If you want to find out where the illegal address 1e79 comes from, you could look at the parms to frames 10 to 1.&lt;BR /&gt;&lt;BR /&gt;Or this address could come from a field in one of the structs from one of the pointers.</description>
      <pubDate>Mon, 28 Aug 2006 14:31:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-view-function-parameters-in-core-file/m-p/3849668#M98338</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2006-08-28T14:31:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to view function parameters in core file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-view-function-parameters-in-core-file/m-p/3849669#M98339</link>
      <description>&amp;gt;Dennis&lt;BR /&gt;Even with K&amp;amp;R C the syntax of pointer declaration is incorrect i.e. char* s / char* aux should be char *s / char *aux. Hmmm...you need to take away Dennis' 10 points :-)</description>
      <pubDate>Mon, 28 Aug 2006 15:13:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-view-function-parameters-in-core-file/m-p/3849669#M98339</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-08-28T15:13:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to view function parameters in core file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-view-function-parameters-in-core-file/m-p/3849670#M98340</link>
      <description>&amp;gt;Even with K&amp;amp;R C the syntax of pointer&lt;BR /&gt;&lt;BR /&gt;My K&amp;amp;R comment had nothing to do with char *s, or char *aux, why are you connecting it?  Using K&amp;amp;R is not just a stylistic war.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;is incorrect i.e. char* s / char* aux should be char *s / char *aux.&lt;BR /&gt;&lt;BR /&gt;I'm confused.  I see nothing different other than the spacing (and I had a hard time even seeing it) and I prefer the latter style.&lt;BR /&gt;&lt;BR /&gt;The only thing wrong with Jose's case was that he should have had:&lt;BR /&gt;    aux = (char*)0x12345678;</description>
      <pubDate>Mon, 28 Aug 2006 18:06:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-view-function-parameters-in-core-file/m-p/3849670#M98340</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2006-08-28T18:06:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to view function parameters in core file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-view-function-parameters-in-core-file/m-p/3849671#M98341</link>
      <description>Hi Sandman,&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; the executable image actually received a SIGSEGV signal not a SIGBUS&lt;BR /&gt;Yes, you are completely right.&lt;BR /&gt;Sorry.&lt;BR /&gt;&lt;BR /&gt;Dennis:&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; In this case R26 is bad in that 0x1e79 is a read only constant. &lt;BR /&gt;How do you know it?&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; This is a K&amp;amp;R style definition, only use strict ANSI C or C++ style&lt;BR /&gt;Yes, you are right. It's a code example I took from Oracle doc (cdemo81.c).&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; If you really want to put a string there, you need to have 3+1 for the NULL char&lt;BR /&gt;Yes, I know, thanks. I've been programming in C/C++ for several years ;-)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;With respecto to code:&lt;BR /&gt;int main(argc, argv) &lt;BR /&gt;int argc; &lt;BR /&gt;char *argv[]; &lt;BR /&gt;{ &lt;BR /&gt;OCIStmtExecute(1, 2, 3, 4, 5, 6, 7, 8); &lt;BR /&gt;return 1; &lt;BR /&gt;} &lt;BR /&gt;&lt;BR /&gt;following your indications, Dennis, I have disassembled the previous frame in order to see how the arguments are being stored.&lt;BR /&gt;4 of them are kept in registers while the others are stored at $sp-...:&lt;BR /&gt;&lt;BR /&gt;0x6f2c &lt;MAIN&gt;:     ldi 1,%r26&lt;BR /&gt;0x6f30 &lt;MAIN&gt;:     ldi 2,%r25&lt;BR /&gt;0x6f34 &lt;MAIN&gt;:     ldi 3,%r24&lt;BR /&gt;0x6f38 &lt;MAIN&gt;:     ldi 4,%r23&lt;BR /&gt;0x6f3c &lt;MAIN&gt;:     ldi 5,%r31&lt;BR /&gt;0x6f40 &lt;MAIN&gt;:     stw %r31,-0x34(%sp)&lt;BR /&gt;0x6f44 &lt;MAIN&gt;:     ldi 6,%r20&lt;BR /&gt;0x6f48 &lt;MAIN&gt;:     stw %r20,-0x38(%sp)&lt;BR /&gt;0x6f4c &lt;MAIN&gt;:     ldi 7,%r21&lt;BR /&gt;0x6f50 &lt;MAIN&gt;:     stw %r21,-0x3c(%sp)&lt;BR /&gt;0x6f54 &lt;MAIN&gt;:     ldi 8,%r22&lt;BR /&gt;0x6f58 &lt;MAIN&gt;:     stw %r22,-0x40(%sp)&lt;BR /&gt;&lt;BR /&gt;(gdb) x /xw $sp-0x34&lt;BR /&gt;0x77ff093c:     0x00000005&lt;BR /&gt;(gdb) x /xw $sp-0x38&lt;BR /&gt;0x77ff0938:     0x00000006&lt;BR /&gt;(gdb) x /xw $sp-0x3c&lt;BR /&gt;0x77ff0934:     0x00000007&lt;BR /&gt;(gdb) x /xw $sp-0x40&lt;BR /&gt;0x77ff0930:     0x00000008&lt;BR /&gt;&lt;BR /&gt;Is there some convention to decide which arguments will be stored in registers and which ones in the stack?&lt;BR /&gt;Or is it data-dependant / compiler-dependant...?&lt;BR /&gt;&lt;BR /&gt;P.S.:&lt;BR /&gt;Very useful the "PA-RISC 2.0 Architecture" manual. I'm reading it in order to better understand disassembling.&lt;BR /&gt;&lt;/MAIN&gt;&lt;/MAIN&gt;&lt;/MAIN&gt;&lt;/MAIN&gt;&lt;/MAIN&gt;&lt;/MAIN&gt;&lt;/MAIN&gt;&lt;/MAIN&gt;&lt;/MAIN&gt;&lt;/MAIN&gt;&lt;/MAIN&gt;&lt;/MAIN&gt;</description>
      <pubDate>Wed, 30 Aug 2006 09:37:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-view-function-parameters-in-core-file/m-p/3849671#M98341</guid>
      <dc:creator>Jose M. del Rio</dc:creator>
      <dc:date>2006-08-30T09:37:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to view function parameters in core file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-view-function-parameters-in-core-file/m-p/3849672#M98342</link>
      <description>&amp;gt;&amp;gt;&amp;gt;&amp;gt; In this case R26 is bad in that 0x1e79 is a read only constant.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;How do you know it?&lt;BR /&gt;&lt;BR /&gt;Typically, the first quadrant is readonly text and code.  The second is globals, statics, the heap, stack and privately mapped files.  The third and fourth are shared libs, memory or mapped files.  So looking at the first nibble: 0-3, 4-7, 8-b, c-f&lt;BR /&gt;&lt;BR /&gt;Of course linking with -N can combine 0-7.  And various chatr options can combine 8-f, etc.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Is there some convention to decide which arguments will be stored in registers and which ones in the stack?&lt;BR /&gt;&lt;BR /&gt;You need to look at the Procedure Calling Conventions manual.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://devresource.hp.com/drc/STK/archivedocs.jsp" target="_blank"&gt;http://devresource.hp.com/drc/STK/archivedocs.jsp&lt;/A&gt;&lt;BR /&gt;Run-time architecture&lt;BR /&gt;&lt;A href="http://devresource.hp.com/drc/STK/docs/archive/rad_10_20.pdf" target="_blank"&gt;http://devresource.hp.com/drc/STK/docs/archive/rad_10_20.pdf&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;This has some pretty pictures answering your first question.&lt;BR /&gt;&lt;BR /&gt;Basically for PA32, the first 4 parms are in registers.  (It depends on size, type, alignment, etc.)  Whether they are stored depends on the optimization in the callee.</description>
      <pubDate>Wed, 30 Aug 2006 20:21:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-view-function-parameters-in-core-file/m-p/3849672#M98342</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2006-08-30T20:21:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to view function parameters in core file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-view-function-parameters-in-core-file/m-p/3849673#M98343</link>
      <description>&lt;!--!*#--&gt;Thanks again, Dennis.&lt;BR /&gt;I've been reading both manuals:&lt;BR /&gt; HP Assembler Reference Manual&lt;BR /&gt; The 32-bit PA-RISC Run-time Architecture Document&lt;BR /&gt;Very instructive.&lt;BR /&gt;&lt;BR /&gt;You are right: the offending pointer (0x00001e79) seems to belong to a (read-only) subspace:&lt;BR /&gt;(gdb) info target&lt;BR /&gt;...&lt;BR /&gt;0x00001000 - 0x0001339d is $SHLIB_INFO$&lt;BR /&gt;&lt;BR /&gt;As you suggested, I've started backtracking the offending pointer from frame 0, 1...&lt;BR /&gt;till I have realized something shocking:&lt;BR /&gt;at every frame #N level, the value 0x1e79 shows up in 3 registers:&lt;BR /&gt;   arg1/r25:         4568fb79     arg0/r26:             1e79  &lt;BR /&gt;  dp/gp/r27:         40004280     ret0/r28:             1e79  &lt;BR /&gt;   isr/cr20:          5dab400     ior/cr21:             1e79  &lt;BR /&gt;Isn't this strange?&lt;BR /&gt;&lt;BR /&gt;Specially if we consider, for example, that these registers should be:&lt;BR /&gt;   gr26: argc&lt;BR /&gt;   gr25: argv&lt;BR /&gt;   gr24: envp&lt;BR /&gt;gr26 is obviously wrong as 'argc' and I've tried to dereference r25, r24... but I've found nothing meaningful.&lt;BR /&gt;Can you think of any explanation? &lt;BR /&gt;Do you think the core file can be some way corrupted?&lt;BR /&gt;Anyway, I must say every core file that is generated as a result of a sigbus being raised by this program looks the same.&lt;BR /&gt;On the other hand, if I attach to a living process with gdb and dumpcore on demand, the core file looks more normal,  in that it contains syntactically possible values, but not semantically:&lt;BR /&gt;   arg3/r23:               21     arg2/r24:         77fdb200  &lt;BR /&gt;   arg1/r25:                8     arg0/r26:               93  &lt;BR /&gt;  dp/gp/r27:         40004280     ret0/r28:                8  &lt;BR /&gt;&lt;BR /&gt;Â¿argc=93?&lt;BR /&gt;&lt;BR /&gt;By using gdb, chatr... I see the executable file is SOM sharable executable.&lt;BR /&gt;I don't know if this makes any difference with a "normal" executable file where gr26, gr25... work as expected.&lt;BR /&gt;This executable (gsrvr) is never launched directly but forked from its parent (giomgr).&lt;BR /&gt;&lt;BR /&gt;By using tusc I can see it is forked this way:&lt;BR /&gt;15:16:52 [/arcsde/sdee][2213]{2650157} &amp;lt;-0.000000&amp;gt; execve("/arcsde/sdeexe90/bin/gsrvr", 0x400afaa8, &lt;BR /&gt;&lt;BR /&gt;0x40082e80) [entry]&lt;BR /&gt;                              argv[0] @ 0x7f6f37c0: "/arcsde/sdeexe90/bin/gsrvr"&lt;BR /&gt;                              argv[1] @ 0x7f6f2440: "esri_sde"&lt;BR /&gt;                              argv[2] @ 0x7f6f22c0: "desar"&lt;BR /&gt;                              argv[3] @ 0x7f6f1e78: "null=database"&lt;BR /&gt;                              argv[4] @ 0x7f6f0a60: "sde"&lt;BR /&gt;                              argv[5] @ 0x7f6f26f0: "NO_shared_memory_chanl_io"&lt;BR /&gt;                              argv[6] @ 0x7f6f3d60: "1089"&lt;BR /&gt;                              argv[7] @ 0x400601f0: "/tmp/sde_client_to_server_FIFO_esri_sde_1"&lt;BR /&gt;                              argv[8] @ 0x4005fdf0: "/tmp/sde_server_to_client_FIFO_esri_sde_1"&lt;BR /&gt;</description>
      <pubDate>Thu, 31 Aug 2006 14:24:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-view-function-parameters-in-core-file/m-p/3849673#M98343</guid>
      <dc:creator>Jose M. del Rio</dc:creator>
      <dc:date>2006-08-31T14:24:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to view function parameters in core file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-view-function-parameters-in-core-file/m-p/3849674#M98344</link>
      <description>&lt;P&gt;&amp;gt;at every frame #N level, the value 0x1e79 shows up in 3 registers:&lt;BR /&gt;arg0/r26: 1e79 ret0/r28: 1e79 ior/cr21: 1e79&lt;BR /&gt;&lt;BR /&gt;There is only one copy of these caller save registers, so the debugger can only display the top level's copy. The IOR register is the data address in the faulting instruction.&lt;BR /&gt;If R28 contains this text address, it could come from the return value of a function.&lt;BR /&gt;&lt;BR /&gt;My suggestion was for you to look at the stored parm area for each frame.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Specially if we consider, for example, that these registers should be:&lt;BR /&gt;gr26: argc gr25: argv gr24: envp&lt;BR /&gt;&lt;BR /&gt;I'm not sure what point you are making. R26 contains argc ONLY at the start of main.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;where gr26, gr25... work as expected.&lt;BR /&gt;&lt;BR /&gt;These work the way I and the hardware expects, perhaps not how you expect them.&lt;/P&gt;</description>
      <pubDate>Sun, 30 Oct 2011 01:45:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-view-function-parameters-in-core-file/m-p/3849674#M98344</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-10-30T01:45:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to view function parameters in core file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-view-function-parameters-in-core-file/m-p/3849675#M98345</link>
      <description>&lt;!--!*#--&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; R26 contains argc ONLY at the start of main. &lt;BR /&gt;&lt;BR /&gt;According to my first post:&lt;BR /&gt;&amp;gt;&amp;gt; #0 0xc01ccb5c in memcpy+0x144 () from /usr/lib/libc.2 &lt;BR /&gt;&amp;gt;&amp;gt; ...&lt;BR /&gt;&amp;gt;&amp;gt; #24 0x4f8a8 in &lt;UNKNOWN_PROCEDURE&gt; + 0x20 () &lt;BR /&gt;&lt;BR /&gt;I supposed the last frame should always be main().&lt;BR /&gt;That's why I thought r26 should be argc.&lt;BR /&gt;But I see now this is not necessarily true.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt;where gr26, gr25... work as expected. &lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; These work the way I and the hardware expect, perhaps not how you expect them. &lt;BR /&gt;I think this can be more about the same (frame 24 != main())&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; There is only one copy of these caller save registers, so the debugger can only display the top level's copy.&lt;BR /&gt;Yet other registers do vary with every stack frame.&lt;BR /&gt;From "Debugging with GDB":&lt;BR /&gt;"Normally, register values are relative to the selected stack frame (see Section 6.5 [Select-&lt;BR /&gt;ing a frame], page 53). This means that you get the value that the register would contain&lt;BR /&gt;if all stack frames farther in were exited and their saved registers restored. In order to see&lt;BR /&gt;the true contents of hardware registers, you must select the innermost frame (with `frame&lt;BR /&gt;0').&lt;BR /&gt;However, GDB must deduce where registers are saved, from the machine code generated&lt;BR /&gt;by your compiler. If some registers are not saved, or if GDB is unable to locate the saved&lt;BR /&gt;registers, the selected stack frame makes no di erence."&lt;BR /&gt;&lt;BR /&gt;Is there a clear boundary to decide which registers are frame-relative and which ones aren't?&lt;BR /&gt;&lt;BR /&gt;&lt;/UNKNOWN_PROCEDURE&gt;</description>
      <pubDate>Fri, 01 Sep 2006 05:22:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-view-function-parameters-in-core-file/m-p/3849675#M98345</guid>
      <dc:creator>Jose M. del Rio</dc:creator>
      <dc:date>2006-09-01T05:22:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to view function parameters in core file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-view-function-parameters-in-core-file/m-p/3849676#M98346</link>
      <description>&amp;gt;Is there a clear boundary to decide which registers are frame-relative and which ones aren't?&lt;BR /&gt;&lt;BR /&gt;If it is more than 4, it is stored by the caller.  In this case you can manually look at the args using the $sp-32-4*N formula.  If less, it depends on the optimizer.&lt;BR /&gt;&lt;BR /&gt;In regards to which registers are valid for other than the top frame, only the callee save registers are available to be restored. R3-R19, R30.  See the Runtime Architecture manuals I listed above.</description>
      <pubDate>Fri, 01 Sep 2006 20:16:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-view-function-parameters-in-core-file/m-p/3849676#M98346</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2006-09-01T20:16:25Z</dc:date>
    </item>
  </channel>
</rss>

