Debugging core file through disassemble code

My program got cored and in the same frame I ran cmd given below and got the o/p
dbx> dis
0x0008a754: hellworld+0x0024: or %l1, %g0, %o2
0x0008a758: hellworld+0x0028: st %g0, [%fp - 0x4]
0x0008a75c: hellworld+0x002c: st %g0, [%fp - 0x8c]
0x0008a760: hellworld+0x0030: stb %g0, [%fp - 0x8d]
0x0008a764: hellworld+0x0034: stb %g0, [%fp - 0x8e]
0x0008a768: hellworld+0x0038: stb %g0, [%fp - 0x8f]
0x0008a76c: hellworld+0x003c: sth %g0, [%fp - 0x92]
0x0008a770: hellworld+0x0040: add %fp, -0x80, %l0
0x0008a774: hellworld+0x0044: st %l0, [%fp - 0x8c]
How to find where the segmentation fault occur and why
-Neo

Neo12051 wrote:
My program got cored and in the same frame I ran cmd given below and got the o/p
How to find where the segmentation fault occur and why Dbx prints this information right after it loads all modules:
$ dbx - core
Reading ld.so.1
Reading libm.so.2
t@1 (l@1) program terminated by signal ABRT (Abort)
0xfdda5067: _kill+0x0007:       jb       __cerror       [ 0xfdd20510, .-0x84b57 ]The last two lines describe reason (signal ABRT) and location (0xfdda5067) of the fault.
High level reason for segmentation fault (SIGSEGV) is absence of mapped memory at certain location the process is trying to access. Most frequent reason is a variation of NULL pointer dereferece (address 0x0 and other close-to-zero addresses are always left unmapped for this very reason). When your program, for example, tries to write to a string ptr that it forgot to initialize properly, it ends up with something like this:
0x00010e20: main+0x0010:        stb      %o1, [%o0](store byte from register %o1 into memory location addressed by register %o0) while value of %o0 points to unmapped memory:
(dbx:main) print $o0
$o0 = 20ULLAddress 20 is so close to zero that it suggest a bug like uninitialized array of characters, which 20th element is being assigned.
The code you provided looks like initialization of a few small locals and can only fail if %fp (Frame Pointer) contains garbage. Therefore if location of SEGV is somewhere in that code (you didn't give this information, so I'm only guessing), I'd suggest looking for writing past array (string) bounds type of bug. If a function called from this one wrote past its local array bounds, it could've overwritten value of frame pointer saved on stack.
It's hard to say more without knowing value of all relevant registers at location of failure (regs command will help with that).

Similar Messages

  • Debugging core file

    Hi ,
    While debugging a core file on a Solarix box , i find a peculiar problem.
    if i write dbx - /tmp/core , it gives the following error
    dbx: File `/tmp/core' is not ELF executable
    if howevere i use `file /tmp/core ` it gives
    --- tmp/core: ELF 64-bit MSB core file........
    I'm not able to find the root cause of the problem. As i need to debug the core file
    to understand the main cause of the issue. Could you please help me or correct me if i'm doing something
    wrong. I had even tried to do the forcefull load of the core file, but its of no help.
    Regards

    KabhiNahin wrote:
    Hi ,
    I have already tried the changes suggested by you . i.e chnage the permissions and also to replace the
    executable name instead of the "-" . No, I was not suggesting to change permissions, it was actually a bad example, something that you shouldn't do to debug a core. Anyway, changing permissions doesn't hurt; it just doesn't help.
    KabhiNahin wrote:
    But the problem still persists.
    When i do the pstack of the core file, it doesn't provide any informative description.What does pstack print? Also, what does
    $ dbx a.out /tmp/coreprint exactly?

  • Debugging core file with dbx

    I am trying to debug a core file with dbx. My first problem was a core mismatch. I copied the libraries from production to a directory in my development environment, set core_lo_pathmap to on, and used the pathmap command to get the files from the new location. The files I copied include ld.so and ld.so.1 - based on an article I read. I am not getting the core mismatch anymore but this is the result I am getting now:
    Reading libdec.so
    Reading libhpsnls.so
    Reading libc_psr.so.1
    Reading libthread.so.1
    Reading nss_files.so.1
    Reading GMOG1.dll
    Reading vogn2405.dll
    Reading libiiapi.1.so
    detected a multithreaded program
    t@1 (l@1) terminated by signal SEGV (no mapping at the fault address)
    0xff311c5c: fflushu_iops+0x004c: ldub [%i4 + 0xc], %o0
    I am unsure of the next step and any advice would be appreciated.

    If all you're looking for is a stack trace, run pstack on the core file on the
    production system where the core was created.
    tim

  • Debugging core files with dbx

    Here are a few questions one of our developers asked me
    to post:
    There are some things I don't understand about these core files.
    (I get this dbx message examining the core file: dbx: internal warning: writable memory segment 0xfe750000[188416] of size 0 in core)
    Here are the threads:
    (dbx) threads
    > t@1 a l@1 ?() LWP suspended in elflookup_filtee()
    t@2 a l@2 ?() LWP suspended in __open()
    t@4 b l@4 kaiocleanup_thread() LWP suspended in kaio()
    o t@5 a l@5 ?() signal SIGSEGV in runThreadFunction()
    t@6 a l@6 ?() sleep on (unknown) in __lwp_park()
    t@7 a l@7 ?() sleep on (unknown) in __lwp_park()
    (dbx)
    Here's thread 1:
    (dbx) where
    current thread: t@1
    =>[1] elflookup_filtee(0xffbff29c, 0xffbff32c, 0xffbff328, 0x5af8f2f, 0x184, 0xff1208d8), at 0xff3b8e3c
    [2] lookup_sym_interpose(0xffbff330, 0xffbff32c, 0xffbff328, 0x5af8f2f, 0x0, 0xff3c2bcc), at 0xff3b6a2c
    [3] tls_report_modules(0xff3ec0f0, 0xfea905d0, 0x2380c, 0xff3ec0f0, 0xff3ee67c, 0x0), at 0xff3caeac
    [4] rtboot(0x2380c, 0xff000000, 0x0, 0xfe8b6448, 0x0, 0xfe8e9c44), at 0xff3b378c
    [5] 0x4aee0(0x4bfd8, 0x0, 0xff000000, 0x0, 0x0, 0xfe7f2000), at 0x4aedf
    [6] 0x2380c(0x1, 0x1084, 0xfe797cc0, 0x0, 0xfe7f2000, 0x1000), at 0x2380b
    [7] _exithandle(0xfe8e9b80, 0xfe797c00, 0xfe8e8bc0, 0x1, 0x4b104, 0xfc00), at 0xfe83e608
    [8] exit(0x0, 0x1, 0x77c20, 0x4d000, 0xfe7974c0, 0xfe797500), at 0xfe82cf28
    And here's thread 5:
    (dbx) where -h
    current thread: t@5
    =>[1] DataWriter::runThreadFunction(0xffbff1a0, 0x0, 0x431bde83, 0x15a758, 0x0, 0x9f3e), at 0x1eba8
    [2] 0xfeee5724(0xffbff1ac, 0xfe47c000, 0x0, 0x0, 0xffbff1a0, 0x4bb1c), at 0xfeee5723
    (dbx)
    What I dont understand:
    1. Why is where on thread 5 not reporting the SEGV?
    2. Why is thread 1 in the exit handle when some threads have not yet exited?
    3. Why is thread 1 not showing any stack above the exit call?
    How do I get information on these questions?
    Thanks in advance.
    -- prasad

    which version of dbx are you using?
    A message about "size 0" can sometimes mean that
    your core file was truncated by a core limit that is set
    too low. That can cause missing information.
    1. Why is where on thread 5 not reporting the SEGV?I don't know. This seems like a bug, but not a serious one.
    You know there is a seg fault from the "threads" command.
    2. Why is thread 1 in the exit handle when some threads have not yet exited?The program can call exit() whenever it wants to. At that
    point the cleanup handlers will be called. If you want the
    system to wait for all threads to exit, then call thr_exit() instead
    of exit().
    3. Why is thread 1 not showing any stack above the exit call?I don't know the answer. Sometimes stack trace information
    in the process is a little but unreliable. It's only 100% reliable if you
    compile with -g and do not use the optimizer. Even in those cases,
    it is 99% reliable.

  • Run batch files through java code

    Hi All
    I need to run a batch file using java code . I am not getting any error, but also no output. Can someone let me know the problem with my code.The code i am using is
    import java.io.*;
    public class batchtest {
         public static void main(String[] args) {
              Runtime r = Runtime.getRuntime();
         Process p= null;
         String line;
              try{
              p = r.exec("cmd /c testBatch.bat");
              BufferedReader input = new BufferedReader
              (new InputStreamReader(p.getInputStream()));
         while ((line = input.readLine()) != null) {
         System.out.println(line);
         input.close();
              System.out.println("running...");
              }catch(Exception e)
                   e.printStackTrace();
    }

    Maybe this helps:
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

  • Run chm help file through java code

    hello,
    would you tell me how can i run a help.chm file using java code. i am trign this but no luck.
    first try
    Process pp=run.exec("C:/Program Files/Internet Explorer/IEXPLORE.exe ./res/bobftphelp.chm" );
    Second try
              Process pp=run.exec(" ./res/bobftphelp.chm" );
    It run fine a help.doc file but not help.chm file.
    please help me
    Thanka in advance
    Ravi Charan

    The second address given to that function, does it relate to the class that its being called from? cause i've got
    Runtime.getRuntime().exec("C:\\WINDOWS\\hh.exe .\\HelpFile_9_3.chm" );where HelpFile_9_3 is in the same folder as my class, but it won't work. Can anyone help?
    Also, can you search within a chm file from Java? If I get that above code working, I presume it'll open the help file to the main page. I'd like to search within that document for a word or phrase - possible?
    Thanks!
    Edited by: Pulkse.co.uk on Sep 10, 2008 8:18 AM

  • Read SSH (Unix) dynamic file through Java code

    Hi,
    I am trying to create a java code which should read the dynamically changing content in the unix(SSH) system.
    Could you please tell me which is the best way to create the above requirement.
    Thanks in advance...

    corlettk wrote:
    but there are perl libraries... and (I was dumbfounded) a java-embedded-in-perl compiler. I feel a mashup delegate layer coming on.JCraft's JSch is, however, IMHO, a very good, flexible, and reliable implementation of SSH2 protocol (OpenSSH key formats). It allows your program to become an SSH client.
    Edit: And to tell you the truth, the Perl Net::SSH module is simply a wrapper around OpenSSH's libraries, and the Net::SSH::Perl Module (which is complete Perl although many of the Encryption modules need to be compiled, at least on Unix) are much more complicated to get installed, if not necessarily used, than JSch is.
    Edit Again: Although knowing the OP's history, I very much doubt his ability to implement either solution. ;-)

  • How to copy a file from Java code

    I have written a file through Java code in folder, say, "A". Now, I want a copy of that file exactly the same in some other folder "B". How, it can be done?

    http://java.sun.com/docs/books/tutorial/essential/io/streams.html

  • Split XML in Multiple XML files with Java Code

    Hi guys , i have following xml file as input ....
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <T0020
    xsi:schemaLocation="http://www.safersys.org/namespaces/T0020V1 T0020V1.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.safersys.org/namespaces/T0020V1">
    <INTERFACE>
    <NAME>SAFER</NAME>
    <VERSION>04.02</VERSION>
    </INTERFACE>
    <TRANSACTION>
    <VERSION>01.00</VERSION>
    <OPERATION>REPLACE</OPERATION>
    <DATE_TIME>2009-09-01T00:00:00</DATE_TIME>
    <TZ>CT</TZ>
    </TRANSACTION>
    <IRP_ACCOUNT>
    <IRP_CARRIER_ID_NUMBER>274845</IRP_CARRIER_ID_NUMBER>
    <IRP_BASE_COUNTRY>US</IRP_BASE_COUNTRY>
    <IRP_BASE_STATE>AR</IRP_BASE_STATE>
    <IRP_ACCOUNT_NUMBER>55002</IRP_ACCOUNT_NUMBER>
    <IRP_ACCOUNT_TYPE>I</IRP_ACCOUNT_TYPE>
    <IRP_STATUS_CODE>100</IRP_STATUS_CODE>
    <IRP_STATUS_DATE>2007-11-06</IRP_STATUS_DATE>
    <IRP_UPDATE_DATE>2009-08-03</IRP_UPDATE_DATE>
    <IRP_NAME>
    <NAME_TYPE>LG</NAME_TYPE>
    <NAME>A P SUPPLY CO</NAME>
    <IRP_ADDRESS>
    <ADDRESS_TYPE>PH</ADDRESS_TYPE>
    <STREET_LINE_1>1400 N OATS</STREET_LINE_1>
    <STREET_LINE_2/>
    <CITY>TEXARKANA</CITY>
    <STATE>AR</STATE>
    <ZIP_CODE>71854</ZIP_CODE>
    <COUNTY>MILLER</COUNTY>
    <COLONIA/>
    <COUNTRY>US</COUNTRY>
    </IRP_ADDRESS>
    <IRP_ADDRESS>
    <ADDRESS_TYPE>MA</ADDRESS_TYPE>
    <STREET_LINE_1>P O BOX 1927</STREET_LINE_1>
    <STREET_LINE_2/>
    <CITY>TEXARKANA</CITY>
    <STATE>AR</STATE>
    <ZIP_CODE>75504</ZIP_CODE>
    <COUNTY/>
    <COLONIA/>
    <COUNTRY>US</COUNTRY>
    </IRP_ADDRESS>
    </IRP_NAME>
    </IRP_ACCOUNT>
    <IRP_ACCOUNT> ..... </IRP_ACCOUNT>
    <IRP_ACCOUNT> ..... </IRP_ACCOUNT>
    <IRP_ACCOUNT> ..... </IRP_ACCOUNT>
    </T0020>
    and i want to take this xml file and split it into multiple files through java code like this ...
    File1.xml
    <T0020>
    <IRP_ACCOUNT> ..... </IRP_ACCOUNT>
    <IRP_ACCOUNT> ..... </IRP_ACCOUNT>
    </T0020>
    File2.xml
    <T0020>
    <IRP_ACCOUNT> ..... </IRP_ACCOUNT>
    <IRP_ACCOUNT> ..... </IRP_ACCOUNT>
    </T0020>
    like wise...
    Each xml file contain maximum 10 or 15 IRP_ACCOUNT.
    Can somebody please help me ? How can i do it with stax like start element and all ?
    thanks in advance.

    Ah, sorry, strike that. You want multiple files. I think the easiest way is to simply parse with DOM. [http://www.w3schools.com/xpath/default.asp] . And here [http://www.w3schools.com/xpath/default.asp].
    You can output the various XML elements using a PrintWriter or creating a separate DOM document for each file you want to create and serializing that.
    - Saish

  • Problem Attaching CORE files in to SunStudio12

    I am working in Redhat Linux x86-64 bit machine and using Sunstudio12. When I am running my C++ application , CORE DUMP occures . But when I tried to attach the core file through Sun Studio the following error occurs :
    dbx: core file read error: address 0x1895 not in data space
    dbx: attempt to read frame failed -- cannot get return address
    dbx: core file read error: address 0x1895 not in data space
    dbx: attempt to read frame failed -- cannot get return address
    Too many errors ...Please can anyone help me in this regard ? I am urgently required to solve this issue

    Please find my comments in this thread:
    http://forum.java.sun.com/thread.jspa?threadID=5262865

  • Needs to generate CSV file through DME

    Hi Experts,
    I am using DME to generate certain file, the file format is supposed to contain a fixed number of fields even if most are empty, with each field delimited or separated by comma (using CSV Standard File Format), and not tab or space delimited.
    While customising the file through T-Code DMEE, file gets generated but not in CSV format due to which Bank system unable to read the data.
    Please help me out in getting the file in the required format.
    Its an urgent issue, hence looking for a quick reply from the experts.
    Thanks in Advance
    Regards,

    Hi Experts,
    Please help me out....
    Regards

  • How to download files in jsp code {through save dialog}

    can you help me to download files in jsp code {through save dialog}
    i use the following code but it saves the jsp page instead of the downloaded file but with the name of the wanted file to be downloaded
    response.setHeader("Pragma", "public");
    response.setHeader("Cache-Control", "no-cache");
    *** download file
    if((trans !=null)&&(trans.equals("download")) )
    response.setContentType ("application/x-download");
    response.setHeader ("Content-Disposition","attachment;filename=\""+fileName+"\"");
    %>
    <script>
    window.location.href=<%=gallerypath+fileName%>';
    </script>
    <%
    trans="";
    //System.out.print("download : "+fileName );
    //***************************************

    Can you try below code, It should work...
    <%
    String myFileName = request.getParameter("fileName");
    response.setContentType("application/octet-stream");
    response.setHeader("Content-Disposition", "attachment; filename=\"" + myFileName + "\"");
    String root = "D:/";
    InputStream in = null;
    ServletOutputStream outs = response.getOutputStream();
    try {
    in = new BufferedInputStream
    (new FileInputStream(root + myFileName));
    int ch;
    while ((ch = in.read()) != -1) {
    outs.print((char) ch);
    finally {
    if (in != null) in.close(); // very important
    outs.flush();
    outs.close();
    in.close();
    %>

  • How to get the source code of an HTML page in Text file Through J2EE

    How to get the source code of an HTML page in Text file Through J2EE?

    Huh? If you want something like your browser's "view source" command, simply use a URLConnection and read in the data from the URL in question. If the HTML page is instead locally on your machine, use a FileInputStream. There's no magic invovled either way.
    - Saish

  • How to get the source code of an HTML page in Text file Through java?

    How to get the source code of an HTML page in Text file Through java?
    I am coding an application.one module of that application is given below:
    The first part of the application is to connect our application to the existing HTML form.
    This module would make a connection with the HTML page. The HTML page contains the coding for the Form with various elements. The form may be a simple form with one or two fields or a complex one like the form for registering for a new Bank Account or new email account.
    The module will first connect through the HTML page and will fetch the HTML code into a Text File so that the code can be further processed.
    Could any body provide coding hint for that

    You're welcome. How about awarding them duke stars?
    edit: cheers!

  • I need to be able to debug through cfc code

    I need to be able to debug through cfc code being called from a Flex app remote object. I know how to debug straight cfm code using cfeclipse for flex builder but am unable to figure how to get this working for cfc's. If I set a break point in my cfc and start my coldfusion debugging session in Flex Builder and run my flex app and get it to call the cfc the debugger doesn't stop.
    Any ideas? Do i need to modify the Flex-config?

    Write a simple cfm page that invokes the method in question.  Do whatever you have to do to get the cfc working properly.  After that, don't touch it.  Subsequent problems will be due to something else.

Maybe you are looking for

  • Powershell and Outlook 2007, trying to delete messages in a folder older than date

    I was hoping to get a powershell script that would do the following 1) Connect to outlook 2007 2) Go to Mailbox folder (not an inbox subfolder) called 'Processes' 3) Delete all email from that folder older than 3 days old I did some searching, I have

  • External midi interface connection. Please HELP!!!!

    Hi, I just got the iMac 20 inch widescreen, primaritly for use in my recording studio. I have tried on three different occasions, to install an external midi interface (MOTU Micro Lite), but it is not recognised in the system's midi set up window, an

  • Issue in smartforms

    hi experts ple tclarify my doubt.why we use selection screen in smartforms.what is the need to use selection screen in smartforms. regards polureddy

  • How to create groups and add users?

    Hello, I have created 3 groups as Portal_Admin and added 2 users for each group. When I am trying to grant permissions to these groups to the Applications owned by Portal30( I have logged in as portal30 at this point), I am unable to see these groups

  • Time-based publishing in Web Page Composer

    Hi, I'm evaluating Web Page Composer (WPC) for a customer and one of the requirements is time-based publishing for web pages and navigation, but I can’t find any information on that subject. Do you know if it’s possible to set up time-based publishin