Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cfg/lookup request to server mode #988

Merged
merged 7 commits into from
Feb 22, 2023
Merged

Add cfg/lookup request to server mode #988

merged 7 commits into from
Feb 22, 2023

Conversation

sim642
Copy link
Member

@sim642 sim642 commented Feb 13, 2023

This request allows programmatic traversal of the CFG for abstract debugging (as opposed to dumping a function's CFG in GraphViz format). The method allows two kinds of lookups:

  1. by source code location,
  2. by node ID.

In both cases the method returns:

  1. node ID and location (useful for lookups by location);
  2. next and previous nodes in the CFG.

Example session

$ rlwrap ./goblint --enable server.enabled --enable server.reparse ./tests/regression/04-mutex/01-simple_rc.c

{"jsonrpc":"2.0","id":0,"method":"analyze","params":{}}
{"id":0,"jsonrpc":"2.0","result":{"status":["Success"]}}

{"jsonrpc":"2.0","id":0,"method":"cfg/lookup","params":{"location":{"file":"tests/regression/04-mutex/01-simple_rc.c","line":18,"column":3,"byte":-1}}}
{"id":0,"jsonrpc":"2.0","result":{"node":"84","location":{"file":"tests/regression/04-mutex/01-simple_rc.c","line":18,"column":3,"byte":52985,"endLine":18,"endColumn":30,"endByte":53012},"next":[[[["Proc",null,"pthread_mutex_lock",["& mutex2"]]],"85"]],"prev":[[[["Proc",null,"pthread_create",["(pthread_t * __restrict  )(& id)","(pthread_attr_t const   * __restrict  )((void *)0)","& t_fun","(void * __restrict  )((void *)0)"]]],"83"]]}}

{"jsonrpc":"2.0","id":0,"method":"cfg/lookup","params":{"node":"85"}}
{"id":0,"jsonrpc":"2.0","result":{"node":"85","location":{"file":"tests/regression/04-mutex/01-simple_rc.c","line":19,"column":3,"byte":53016,"endLine":19,"endColumn":22,"endByte":53035},"next":[[[["Assign","myglobal","myglobal + 1"]],"86"]],"prev":[[[["Proc",null,"pthread_mutex_lock",["& mutex2"]]],"84"]]}}

TODO

/cc @FeldrinH

@sim642 sim642 added feature debugging Abstract debugging labels Feb 13, 2023
Copy link
Member

@karoliineh karoliineh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good to me. I think we will need approval from @FeldrinH before merging this, though.

@FeldrinH
Copy link
Collaborator

Looks good to me.

@sim642 sim642 merged commit d1a17b4 into master Feb 22, 2023
@sim642 sim642 deleted the server-cfg branch February 22, 2023 08:36
sim642 added a commit that referenced this pull request Feb 22, 2023
@sim642 sim642 added this to the v2.2.0 milestone Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debugging Abstract debugging feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants