[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [csmith-dev] Adding variables in Csmith generated code



Let's see if Xuejun chimes in, he's the one who wrote all of the UB-avoidance code in Csmith.

John



On 08/03/2016 10:12 AM, Shafiul Azam wrote:
Thank you a lot Dr. Regehr! As I was thinking of accomplishing my task slightly differently, is there any way to learn which global variables are still safe to read (for example, safely dereferencing a pointer) after main function has executed? I noted that some of the global variables may be unsafe to use (read) after main function execution (a pointer becoming null, e.g.).

If there's a way to instruct Csmith to print these variable names (inside comments) at the end of pretty-printing the code, I could parse it. Should I look into the checksum-calculation code as I think this function knows which variables can be read safely after execution of the main function?

Thanks again!

Shafiul Azam Chowdhury
PhD Student and Graduate Research Assistant
The University of Texas at Arlington

 

On Wed, Aug 3, 2016 at 10:45 AM, John Regehr <regehr@cs.utah.edu> wrote:
Hi Shafiul, you should start by reading Variable.cpp.

John



On 08/03/2016 09:39 AM, Shafiul Azam wrote:
Hi All,

I have been using Csmith in my project where Csmith generated code becomes part of a fixed template (some boilerplate code necessary for the tool I'm using). I have these n number of global variables which I would like to become part of Csmith; i.e. I want Csmith to use these variables in its random generation process, as if Csmith declared these global variables and now should use them just like other global variables it created.

I'm sorry for my limited knowledge of Csmith. I assume Csmith has a registry of all the global variables it has created. Then, simply adding my variable names to this registry might do the job. If this is right, can someone please point me to the code where the registry is located (and how to add variables in this registry, given one exists)? I would also like to know if this might break Csmith anyway (exhibiting undefined/unspecified behaviors etc.)

Thank you!

Shafiul