• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

Program Counter values of an executing Java Program

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it possible to obtain the program counter (PC) register values of a running Java application?

I want to use the values of PC to get the execution path of a Java Program... I don't want to use the stackTrace .

Is there any other method to get the path of execution of a java program?

Thank you
 
author & internet detective
Posts: 41381
853
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A debugger? You might want to describe why stack trace doesn't meet your needs to get a more useful suggestion.
 
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As of Java 5 there's the JVMTI if you want to create a native application that communicates with a JVM.
I'm not quite sure that's what you're after, though.
 
Marshal
Posts: 76802
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving discussion as too difficult for “beginning”.
 
Daanish Suhail
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
StackTrace is a problem because time is an issue for me...and for all i've heard and been told is not to use StackTrace...
 
Marshal
Posts: 27450
88
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, yeah, stack traces aren't going to tell you what you say you need to know. That's because stack traces tell you things about your Java code. But that isn't what you say you want. You say you want to know what memory locations in the compiled version of the Java byte-code are executed.

At least that's what you say. I can't imagine why you need to know that or what you plan to do with it -- especially since the volume of output is going to be enormous. If you have a 1 gigabyte processor, that means that your machine can execute 1 billion operations per second. So the debugging you say you want is going to output 1 billion pieces of information every second. And those billion pieces of information aren't going to be very useful either -- what can you do with something which says "Executed the instruction at location 3055802"?

As you might have guessed, I don't think that is really what you need to know. Or perhaps I misunderstood what you were asking. Perhaps you could go back a step and describe the problem you are trying to solve with this unique debugging technique?
 
Daanish Suhail
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jelle Klap wrote:As of Java 5 there's the JVMTI if you want to create a native application that communicates with a JVM.
I'm not quite sure that's what you're after, though.


I'm basically developing a code coverage tool. So I thought of using the PC's values to perform code coverage.
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Daanish Suhail wrote:I'm basically developing a code coverage tool. So I thought of using the PC's values to perform code coverage.


I fear that you may be re-inventing the wheel. This page lists 12 such products for Java.

Winston
 
Time is the best teacher, but unfortunately, it kills all of its students - Robin Williams. tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic